Merge "Add ANGLE.apk to the base system." into rvc-dev
diff --git a/core/Makefile b/core/Makefile
index 1c39fe8..c93bb09 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -5199,7 +5199,6 @@
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(INSTALLED_RAMDISK_TARGET) \
$(ALL_DOCS) \
- $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
$(ALL_SDK_FILES)
endif
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 04a970f..862d874 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -259,8 +259,6 @@
# Jars present in the ART apex. These should match exactly the list of
# Java libraries in the ART apex build rule.
ART_APEX_JARS := core-oj core-libart core-icu4j okhttp bouncycastle apache-xml
-TARGET_CORE_JARS := $(ART_APEX_JARS) conscrypt
-HOST_CORE_JARS := $(addsuffix -hostdex,$(TARGET_CORE_JARS))
#################################################################
# Read the product specs so we can get TARGET_DEVICE and other
diff --git a/core/main.mk b/core/main.mk
index 5727bf2..ab54ffe 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -310,7 +310,7 @@
endif
ifndef is_sdk_build
# To speedup startup of non-preopted builds, don't verify or compile the boot image.
- ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-at-runtime
+ ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=extract
endif
endif
diff --git a/core/product.mk b/core/product.mk
index 25a9c44..8e82f71 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -213,6 +213,12 @@
# A list of module names of BOOTCLASSPATH (jar files)
_product_list_vars += PRODUCT_BOOT_JARS
+
+# A list of extra BOOTCLASSPATH jars (to be appended after common jars).
+# Products that include device-specific makefiles before AOSP makefiles should use this
+# instead of PRODUCT_BOOT_JARS, so that device-specific jars go after common jars.
+_product_list_vars += PRODUCT_BOOT_JARS_EXTRA
+
_product_list_vars += PRODUCT_SUPPORTS_BOOT_SIGNER
_product_list_vars += PRODUCT_SUPPORTS_VBOOT
_product_list_vars += PRODUCT_SUPPORTS_VERITY
diff --git a/core/product_config.mk b/core/product_config.mk
index c4361d0..aabd472 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -228,6 +228,9 @@
PRODUCT_AAPT_CONFIG_SP := $(PRODUCT_AAPT_CONFIG)
PRODUCT_AAPT_CONFIG := $(subst $(space),$(comma),$(PRODUCT_AAPT_CONFIG))
+# Extra boot jars must be appended at the end after common boot jars.
+PRODUCT_BOOT_JARS += $(PRODUCT_BOOT_JARS_EXTRA)
+
ifndef PRODUCT_SYSTEM_NAME
PRODUCT_SYSTEM_NAME := $(PRODUCT_NAME)
endif
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 0a5ba9d..a001e3a 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -202,4 +202,11 @@
)
endif
+ifdef LOCAL_PREBUILT_COVERAGE_ARCHIVE
+ my_coverage_dir := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
+ my_coverage_copy_pairs := $(foreach f,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(f):$(my_coverage_dir)/$(notdir $(f)))
+ my_coverage_files := $(call copy-many-files,$(my_coverage_copy_pairs))
+ $(LOCAL_INSTALLED_MODULE): $(my_coverage_files)
+endif
+
SOONG_ALREADY_CONV := $(SOONG_ALREADY_CONV) $(LOCAL_MODULE)
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index bb77a9b..a01133b 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -313,8 +313,8 @@
tz_version_host \
tz_version_host_tzdata_apex \
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
+ifeq ($(ART_APEX_JARS),)
+$(error ART_APEX_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
endif
# The order matters for runtime class lookup performance.
diff --git a/target/product/base_system_ext.mk b/target/product/base_system_ext.mk
index 6847bfa..b67549a 100644
--- a/target/product/base_system_ext.mk
+++ b/target/product/base_system_ext.mk
@@ -17,4 +17,5 @@
# Base modules and settings for the system_ext partition.
PRODUCT_PACKAGES += \
group_system_ext \
+ system_ext_manifest.xml \
passwd_system_ext \
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 1c5ea3b..3234139 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -85,7 +85,6 @@
VNDK-core: android.hardware.automotive.sv@1.0.so
VNDK-core: android.hardware.automotive.vehicle@2.0.so
VNDK-core: android.hardware.biometrics.face@1.0.so
-VNDK-core: android.hardware.biometrics.face@1.1.so
VNDK-core: android.hardware.biometrics.fingerprint@2.1.so
VNDK-core: android.hardware.biometrics.fingerprint@2.2.so
VNDK-core: android.hardware.bluetooth.a2dp@1.0.so
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
index 4332389..5ff747f 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -60,7 +60,7 @@
# The values should be of the format <apex name>:<jar name>
PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS := \
com.android.permission:service-permission \
- com.android.wifi:wifi-service \
+ com.android.wifi:service-wifi \
com.android.ipsec:android.net.ipsec.ike \
PRODUCT_COPY_FILES += \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index b59feaf..1fff8b0 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -16,10 +16,6 @@
# Provides a functioning ART environment without Android frameworks
-ifeq ($(TARGET_CORE_JARS),)
-$(error TARGET_CORE_JARS is empty; cannot update PRODUCT_PACKAGES variable)
-endif
-
# Additional mixins to the boot classpath.
PRODUCT_PACKAGES += \
android.test.base \
@@ -33,8 +29,7 @@
# ART APEX module.
# Note that this package includes the minimal boot classpath JARs (listed in
-# TARGET_CORE_JARS), which should no longer be added directly to
-# PRODUCT_PACKAGES.
+# ART_APEX_JARS), which should no longer be added directly to PRODUCT_PACKAGES.
PRODUCT_PACKAGES += com.android.art
PRODUCT_HOST_PACKAGES += com.android.art
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index 4fac6f3..ae9b793 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -27,6 +27,8 @@
OPTIONS = common.OPTIONS
+APEX_PAYLOAD_IMAGE = 'apex_payload.img'
+
class ApexInfoError(Exception):
"""An Exception raised during Apex Information command."""
@@ -50,15 +52,11 @@
self.key_passwords = key_passwords
self.codename_to_api_level_map = codename_to_api_level_map
- def ProcessApexFile(self, apk_keys, payload_key, payload_public_key,
- signing_args=None):
+ def ProcessApexFile(self, apk_keys, payload_key, signing_args=None):
"""Scans and signs the apk files and repack the apex
Args:
apk_keys: A dict that holds the signing keys for apk files.
- payload_key: The path to the apex payload signing key.
- payload_public_key: The path to the public key corresponding to the
- payload signing key.
Returns:
The repacked apex file containing the signed apk files.
@@ -89,8 +87,7 @@
logger.info('No apk file has been signed in %s', self.apex_path)
return self.apex_path
- return self.RepackApexPayload(payload_dir, payload_key, payload_public_key,
- signing_args)
+ return self.RepackApexPayload(payload_dir, payload_key, signing_args)
def ExtractApexPayloadAndSignApks(self, apk_entries, apk_keys):
"""Extracts the payload image and signs the containing apk files."""
@@ -118,27 +115,15 @@
has_signed_apk = True
return payload_dir, has_signed_apk
- def RepackApexPayload(self, payload_dir, payload_key, payload_public_key,
- signing_args=None):
+ def RepackApexPayload(self, payload_dir, payload_key, signing_args=None):
"""Rebuilds the apex file with the updated payload directory."""
apex_dir = common.MakeTempDir()
# Extract the apex file and reuse its meta files as repack parameters.
common.UnzipToDir(self.apex_path, apex_dir)
-
- android_jar_path = common.OPTIONS.android_jar_path
- if not android_jar_path:
- android_jar_path = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''),
- 'prebuilts', 'sdk', 'current', 'public',
- 'android.jar')
- logger.warning('android_jar_path not found in options, falling back to'
- ' use %s', android_jar_path)
-
arguments_dict = {
'manifest': os.path.join(apex_dir, 'apex_manifest.pb'),
'build_info': os.path.join(apex_dir, 'apex_build_info.pb'),
- 'android_jar_path': android_jar_path,
'key': payload_key,
- 'pubkey': payload_public_key,
}
for filename in arguments_dict.values():
assert os.path.exists(filename), 'file {} not found'.format(filename)
@@ -151,29 +136,36 @@
elif os.path.isdir(path):
shutil.rmtree(path)
- repacked_apex = common.MakeTempFile(suffix='.apex')
- repack_cmd = ['apexer', '--force', '--include_build_info',
- '--do_not_check_keyname', '--apexer_tool_path',
- os.getenv('PATH')]
+ # TODO(xunchang) the signing process can be improved by using
+ # '--unsigned_payload_only'. But we need to parse the vbmeta earlier for
+ # the signing arguments, e.g. algorithm, salt, etc.
+ payload_img = os.path.join(apex_dir, APEX_PAYLOAD_IMAGE)
+ generate_image_cmd = ['apexer', '--force', '--payload_only',
+ '--do_not_check_keyname', '--apexer_tool_path',
+ os.getenv('PATH')]
for key, val in arguments_dict.items():
- repack_cmd.extend(['--' + key, val])
+ generate_image_cmd.extend(['--' + key, val])
+
# Add quote to the signing_args as we will pass
# --signing_args "--signing_helper_with_files=%path" to apexer
if signing_args:
- repack_cmd.extend(['--signing_args', '"{}"'.format(signing_args)])
+ generate_image_cmd.extend(['--signing_args', '"{}"'.format(signing_args)])
+
# optional arguments for apex repacking
manifest_json = os.path.join(apex_dir, 'apex_manifest.json')
if os.path.exists(manifest_json):
- repack_cmd.extend(['--manifest_json', manifest_json])
- assets_dir = os.path.join(apex_dir, 'assets')
- if os.path.isdir(assets_dir):
- repack_cmd.extend(['--assets_dir', assets_dir])
- repack_cmd.extend([payload_dir, repacked_apex])
+ generate_image_cmd.extend(['--manifest_json', manifest_json])
+ generate_image_cmd.extend([payload_dir, payload_img])
if OPTIONS.verbose:
- repack_cmd.append('-v')
- common.RunAndCheckOutput(repack_cmd)
+ generate_image_cmd.append('-v')
+ common.RunAndCheckOutput(generate_image_cmd)
- return repacked_apex
+ # Add the payload image back to the apex file.
+ common.ZipDelete(self.apex_path, APEX_PAYLOAD_IMAGE)
+ with zipfile.ZipFile(self.apex_path, 'a') as output_apex:
+ common.ZipWrite(output_apex, payload_img, APEX_PAYLOAD_IMAGE,
+ compress_type=zipfile.ZIP_STORED)
+ return self.apex_path
def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
@@ -311,16 +303,13 @@
with open(apex_file, 'wb') as apex_fp:
apex_fp.write(apex_data)
- APEX_PAYLOAD_IMAGE = 'apex_payload.img'
APEX_PUBKEY = 'apex_pubkey'
# 1. Extract the apex payload image and sign the containing apk files. Repack
# the apex file after signing.
- payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
apk_signer = ApexApkSigner(apex_file, container_pw,
codename_to_api_level_map)
- apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key,
- payload_public_key, signing_args)
+ apex_file = apk_signer.ProcessApexFile(apk_keys, payload_key, signing_args)
# 2a. Extract and sign the APEX_PAYLOAD_IMAGE entry with the given
# payload_key.
@@ -341,7 +330,7 @@
signing_args)
# 2b. Update the embedded payload public key.
-
+ payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
common.ZipDelete(apex_file, APEX_PAYLOAD_IMAGE)
if APEX_PUBKEY in zip_items:
common.ZipDelete(apex_file, APEX_PUBKEY)
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index 07284ad..e19bc90 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -14,8 +14,10 @@
# limitations under the License.
#
+import re
import os
import os.path
+import shutil
import zipfile
import apex_utils
@@ -32,6 +34,7 @@
self.testdata_dir = test_utils.get_testdata_dir()
# The default payload signing key.
self.payload_key = os.path.join(self.testdata_dir, 'testkey.key')
+ self.apex_with_apk = os.path.join(self.testdata_dir, 'has_apk.apex')
common.OPTIONS.search_path = test_utils.get_search_path()
@@ -134,35 +137,43 @@
def test_ApexApkSigner_noApkPresent(self):
apex_path = os.path.join(self.testdata_dir, 'foo.apex')
signer = apex_utils.ApexApkSigner(apex_path, None, None)
- processed_apex = signer.ProcessApexFile({}, self.payload_key,
- None)
+ processed_apex = signer.ProcessApexFile({}, self.payload_key)
self.assertEqual(apex_path, processed_apex)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ApexApkSigner_apkKeyNotPresent(self):
- apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ apex_path = common.MakeTempFile(suffix='.apex')
+ shutil.copy(self.apex_with_apk, apex_path)
signer = apex_utils.ApexApkSigner(apex_path, None, None)
- self.assertRaises(apex_utils.ApexSigningError, signer.ProcessApexFile, {},
- self.payload_key, None)
+ self.assertRaises(apex_utils.ApexSigningError, signer.ProcessApexFile,
+ {}, self.payload_key)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ApexApkSigner_signApk(self):
- apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
+ apex_path = common.MakeTempFile(suffix='.apex')
+ shutil.copy(self.apex_with_apk, apex_path)
signer = apex_utils.ApexApkSigner(apex_path, None, None)
apk_keys = {'wifi-service-resources.apk': os.path.join(
self.testdata_dir, 'testkey')}
self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
- payload_pubkey = common.ExtractAvbPublicKey('avbtool',
- self.payload_key)
- signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
+ apex_file = signer.ProcessApexFile(apk_keys, self.payload_key)
+ package_name_extract_cmd = ['aapt', 'dump', 'badging', apex_file]
+ output = common.RunAndCheckOutput(package_name_extract_cmd)
+ for line in output.splitlines():
+ # Sample output from aapt: "package: name='com.google.android.wifi'
+ # versionCode='1' versionName='' platformBuildVersionName='R'
+ # compileSdkVersion='29' compileSdkVersionCodename='R'"
+ match = re.search(r"^package:.* name='([\w|\.]+)'", line, re.IGNORECASE)
+ if match:
+ package_name = match.group(1)
+ self.assertEquals('com.google.android.wifi', package_name)
@test_utils.SkipIfExternalToolsUnavailable()
def test_ApexApkSigner_noAssetDir(self):
- apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
no_asset = common.MakeTempFile(suffix='.apex')
with zipfile.ZipFile(no_asset, 'w') as output_zip:
- with zipfile.ZipFile(apex_path, 'r') as input_zip:
+ with zipfile.ZipFile(self.apex_with_apk, 'r') as input_zip:
name_list = input_zip.namelist()
for name in name_list:
if not name.startswith('assets'):
@@ -173,23 +184,4 @@
self.testdata_dir, 'testkey')}
self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
- payload_pubkey = common.ExtractAvbPublicKey('avbtool',
- self.payload_key)
- signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey)
-
- @test_utils.SkipIfExternalToolsUnavailable()
- def test_ApexApkSigner_withSignerHelper(self):
- apex_path = os.path.join(self.testdata_dir, 'has_apk.apex')
- signer = apex_utils.ApexApkSigner(apex_path, None, None)
- apk_keys = {'wifi-service-resources.apk': os.path.join(
- self.testdata_dir, 'testkey')}
-
- self.payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
- payload_pubkey = common.ExtractAvbPublicKey('avbtool', self.payload_key)
-
- signing_helper = os.path.join(self.testdata_dir, 'signing_helper.sh')
- os.chmod(signing_helper, 0o700)
- payload_signer_args = '--signing_helper_with_files={}'.format(
- signing_helper)
- signer.ProcessApexFile(apk_keys, self.payload_key, payload_pubkey,
- payload_signer_args)
+ signer.ProcessApexFile(apk_keys, self.payload_key)
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index 9809ed4..1853749 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -40,6 +40,7 @@
import com.android.apksig.apk.ApkUtils;
import com.android.apksig.apk.MinSdkVersionException;
import com.android.apksig.util.DataSink;
+import com.android.apksig.util.DataSource;
import com.android.apksig.util.DataSources;
import com.android.apksig.zip.ZipFormatException;
@@ -56,6 +57,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
+import java.io.RandomAccessFile;
import java.lang.reflect.Constructor;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -1020,9 +1022,10 @@
"[-providerClass <className>] " +
"[--min-sdk-version <n>] " +
"[--disable-v2] " +
+ "[--enable-v4] " +
"publickey.x509[.pem] privatekey.pk8 " +
"[publickey2.x509[.pem] privatekey2.pk8 ...] " +
- "input.jar output.jar");
+ "input.jar output.jar [output-v4-file]");
System.exit(2);
}
@@ -1042,6 +1045,7 @@
int alignment = 4;
Integer minSdkVersionOverride = null;
boolean signUsingApkSignatureSchemeV2 = true;
+ boolean signUsingApkSignatureSchemeV4 = false;
int argstart = 0;
while (argstart < args.length && args[argstart].startsWith("-")) {
@@ -1069,13 +1073,22 @@
} else if ("--disable-v2".equals(args[argstart])) {
signUsingApkSignatureSchemeV2 = false;
++argstart;
+ } else if ("--enable-v4".equals(args[argstart])) {
+ signUsingApkSignatureSchemeV4 = true;
+ ++argstart;
} else {
usage();
}
}
- if ((args.length - argstart) % 2 == 1) usage();
- int numKeys = ((args.length - argstart) / 2) - 1;
+ int numArgsExcludeV4FilePath;
+ if (signUsingApkSignatureSchemeV4) {
+ numArgsExcludeV4FilePath = args.length - 1;
+ } else {
+ numArgsExcludeV4FilePath = args.length;
+ }
+ if ((numArgsExcludeV4FilePath - argstart) % 2 == 1) usage();
+ int numKeys = ((numArgsExcludeV4FilePath - argstart) / 2) - 1;
if (signWholeFile && numKeys > 1) {
System.err.println("Only one key may be used with -w.");
System.exit(2);
@@ -1083,8 +1096,12 @@
loadProviderIfNecessary(providerClass);
- String inputFilename = args[args.length-2];
- String outputFilename = args[args.length-1];
+ String inputFilename = args[numArgsExcludeV4FilePath - 2];
+ String outputFilename = args[numArgsExcludeV4FilePath - 1];
+ String outputV4Filename = "";
+ if (signUsingApkSignatureSchemeV4) {
+ outputV4Filename = args[args.length - 1];
+ }
JarFile inputJar = null;
FileOutputStream outputFile = null;
@@ -1221,6 +1238,13 @@
outputFile.close();
outputFile = null;
apkSigner.outputDone();
+
+ if (signUsingApkSignatureSchemeV4) {
+ final DataSource outputApkIn = DataSources.asDataSource(
+ new RandomAccessFile(new File(outputFilename), "r"));
+ final File outputV4File = new File(outputV4Filename);
+ apkSigner.signV4(outputApkIn, outputV4File, false /* ignore failures */);
+ }
}
return;