这里只说明如何合入marline部分,文档如下:
Mainline Implementation Guide
Android Q
Contents
Integrating Mainline module release packages
Integrating Mainline in Settings
© 2019 Google LLC. All Rights Reserved. No express or implied warranties are provided for herein. All specifications are subject to change and
any expected future products, features or functionality will be provided on an if and when available basis.
Android Q includes support for Mainline modules, which are system components that can be
updated outside of the normal Android release cycle via an over-the-air (OTA) mechanism.
●
For GMS devices, partners integrate Google-built, Google-signed, Mainline module release
packages into their own device builds. End user devices receive module updates via the
Google Play Store.
●
For non-GMS devices, partners either distribute Google-built, Google-signed, modules or
build their own modules from the provided AOSP code. End user devices receive module
updates via partner-provided OTA mechanism.
This document describes how to obtain and integrate a Mainline module release package with
an Android device build and provides technical guidance on implementing Mainline UX
requirements in the Settings application.
Integrating Mainline module release packages
Partners can access Mainline module release packages from a
shared Drive
(temporary
location; future access will be provided via a Mainline website).
To integrate a module release package into your device build:
1. Navigate to your Android implementation repository and delete any files in the following
directories:
○
vendor/unbundled_google/modules
○
vendor/unbundled_google/modules_overlay
2. Download the module release package from the
shared Drive
, then extract package
contents to the root of your Android implementation repository.
2018-04-17 1
Google Confidential and Proprietary
3. Review the directory structure, which now has a
vendor/unbundled_google/modules
and
vendor/unbundled_google/modules_overlay
directory. Example (
tentative
):
○
vendor/unbundled_google/modules
■
ANGLEPrebuilt2
■
CaptivePortalLoginPrebuilt
■
ConscryptPrebuilt
■
DnsResolverPrebuilt
■
DocumentsUIPrebuilt
■
ExtServicesPrebuilt
(APK-based module example)
■
Android.mk
■
ExtServicesGoogle.apk
■
ExtServices_permissions.xml
■
MediaFrameworkPrebuilt
■
MediaSwCodecPrebuilt
■
ModuleMetadataGoogle2
■
NetworkPermissionConfigPrebuilt
■
NetworkStackPrebuilt
■
PermissionControllerPrebuilt
■
TimezoneDataPrebuilt (APEX-based module example)
●
Android.bp
●
tzdata_190800030_arm64_v8a.apex
●
tzdata_190800030_x86_64.apex
●
tzdata_190800030_armeabi_v7a.apex
●
tzdata_190800030_x86.apex
○
vendor/unbundled_google/modules_overlay
■
ExtServicesConfigOverlay
●
Android.mk
●
AndroidManifest.mk
●
res/values/config.xml
■
…
4. Add the following lines to the device’s
product.mk
file:
# mainline modules
PRODUCT_PACKAGES += \
GoogleANGLE \
GoogleCaptivePortalLogin \
GoogleDocumentsUIPrebuilt \
GoogleExtServicesPrebuilt \
ModuleMetadataGoogle \
GoogleNetworkPermissionConfig \
GoogleNetworkStack \
GooglePermissionControllerPrebuilt
# mainline module overlay
PRODUCT_PACKAGES += \
2018-04-17 2
Google Confidential and Proprietary
GoogleExtServicesConfigOverlay \
GooglePermissionControllerConfigOverlay
5. Set the following property in the device’s product.mk file to ensure that APEXs are
updatable:
PRODUCT_PROPERTY_OVERRIDES += \
ro.apex.updatable=true
6. Google signed module pre-load requirements are defined in the
Android Q Mainline GMS
Requirements
document. Depending on the nature of a device build (upgrades, new
launches or Android Go), the number of modules that need to be pre-loaded vary.
○
To remove a module from the build delete the corresponding module directory
under
vendor/unbundled_google/modules/
7. Move the
networkstack.x509.pem
file in the
vendor/unbundled_google/modules/NetworkStackPrebuilt
folder to the
$DEFAULT_SYSTEM_DEV_CERTIFICATE
(typically located here -
build/make/target/product/security/
) folder, overwriting the existing
networkstack.x509.pem
file.
○
If this step is skipped, the network functions like Wi-Fi will not work on devices
that preload the Google-signed Networking Stack module.
8. Run a regular build command for the target. The build does the following:
○
Installs APK-based, Google-signed, pre-built modules in
/system/priv-apps
,
replacing AOSP counterparts (the package does not install AOSP APK-based modules
in the system target image).
○
Installs ModuleMetaData.apk to
/product/apps
.
○
Installs APEX-based, Google-signed, pre-built modules (one for each architecture) in
/system/apex
.
■
APEX files are named
com.android.<module name>
.
■
Package names for Google-signed APEX files are
com.google.android.<module name>
.
○
Installs
*_permissions.xml
files per module in
/etc/permissions
.
2018-04-17 3
Google Confidential and Proprietary
○
Builds all Runtime Resource Overlay (RRO) packages in
vendor/unbundled_google/modules_overlay
and installs the resultant APK file
in /
product/overlay
.
Integrating Mainline in Settings
Per the Android Q Mainline GMS Requirements, the Settings application must display the current
Mainline train version. You can get the version using the following Google Play Services API:
String metadataPackageName =
mContext.getResources().getString(R.string.config_defaultModuleMetadataProvider);
long mainlineTrainVersion =
mContext.getPackageManager().getPackageInfo(metadataPackageName,
0).getLongVersionCode();
You can also add a Settings option that enables end users to trigger a Mainline update
manually. This API is in Google Play Services application (code example coming soon)
具体修改如下:
diff --git a/device/qcom/C60/C60.mk b/device/qcom/C60/C60.mk
index d6320b3..413ce25 100755
--- a/device/qcom/C60/C60.mk
+++ b/device/qcom/C60/C60.mk
@@ -513,6 +513,26 @@ PRODUCT_PACKAGES += libwvdrmengine
#PRODUCT_PACKAGES += evlSample
#endif
+# mainline module
+PRODUCT_PACKAGES += \
+ GoogleANGLE \
+ GoogleCaptivePortalLogin \
+ GoogleDocumentsUIPrebuilt \
+ GoogleExtServicesPrebuilt \
+ ModuleMetadataGoogle \
+ GoogleNetworkPermissionConfig \
+ GoogleNetworkStack \
+ GooglePermissionControllerPrebuilt
+
+# mainline module overlay
+PRODUCT_PACKAGES += \
+ GoogleExtServicesConfigOverlay \
+ GooglePermissionControllerConfigOverlay
+
+# mainline module update the apex
+PRODUCT_PROPERTY_OVERRIDES += \
+ ro.apex.updatable=true
+