Merge "Revert "Default NDK modules to libc++_shared.""
diff --git a/Changes.md b/Changes.md
index 53ff007..3e48bad 100644
--- a/Changes.md
+++ b/Changes.md
@@ -86,6 +86,11 @@
$(TARGET): myscript.py $(sort $(shell find my/python/lib -name '*.py'))
PYTHONPATH=my/python/lib:$$PYTHONPATH myscript.py -o $@
```
+### Stop using PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE directly {#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE}
+
+Specify Framework Compatibility Matrix Version in device manifest by adding a `target-level`
+attribute to the root element `<manifest>`. If `PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE`
+is 26 or 27, you can add `"target-level"="1"` to your device manifest instead.
### Other envsetup.sh variables {#other_envsetup_variables}
diff --git a/core/binary.mk b/core/binary.mk
index 2f306b2..7fb6924 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -870,6 +870,9 @@
###########################################################
## Compile the .proto files to .cc (or .c) and then to .o
###########################################################
+ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
+ LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+endif
proto_sources := $(filter %.proto,$(my_src_files))
ifneq ($(proto_sources),)
proto_gen_dir := $(generated_sources_dir)/proto
@@ -891,7 +894,7 @@
endif
my_proto_c_includes := external/protobuf/src
my_cflags += -DGOOGLE_PROTOBUF_NO_RTTI
-my_protoc_flags := --cpp_out=$(proto_gen_dir)
+my_protoc_flags := --cpp_out=$(if $(filter lite lite-static,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite:,)$(proto_gen_dir)
my_protoc_deps :=
endif
my_proto_c_includes += $(proto_gen_dir)
diff --git a/core/config.mk b/core/config.mk
index e43793a..d317bd0 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -75,6 +75,7 @@
ANDROID_EMULATOR_PREBUILTS \
ANDROID_PRE_BUILD_PATHS \
,See $(CHANGES_URL)#other_envsetup_variables)
+$(KATI_obsolete_var PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE,Set FCM Version in device manifest instead. See $(CHANGES_URL)#PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
CHANGES_URL :=
@@ -784,44 +785,7 @@
endif
FRAMEWORK_MANIFEST_FILE := system/libhidl/manifest.xml
-
-# Compatibility matrix versioning:
-# MATRIX_LEVEL_OVERRIDE defined: MATRIX_LEVEL = MATRIX_LEVEL_OVERRIDE
-# MATRIX_LEVEL_OVERRIDE undefined:
-# FULL_TREBLE != true: MATRIX_LEVEL = legacy
-# FULL_TREBLE == true:
-# SHIPPING_API_LEVEL defined: MATRIX_LEVEL = SHIPPING_API_LEVEL
-# SHIPPING_API_LEVEL undefined: MATRIX_LEVEL = PLATFORM_SDK_VERSION
-# MATRIX_LEVEL == legacy => legacy.xml
-# MATRIX_LEVEL <= 26 => 26.xml
-# MATRIX_LEVEL == 27 => 27.xml # define when 27 releases
-# MATRIX_LEVEL == 28 => 28.xml # define when 28 releases
-# ...
-# otherwise => current.xml
-
-ifneq ($(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE),)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL_OVERRIDE)
-else ifneq ($(PRODUCT_FULL_TREBLE),true)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := legacy
-else ifneq ($(PRODUCT_SHIPPING_API_LEVEL),)
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PRODUCT_SHIPPING_API_LEVEL)
-else
- PRODUCT_COMPATIBILITY_MATRIX_LEVEL := $(PLATFORM_SDK_VERSION)
-endif
-
-ifeq ($(strip $(PRODUCT_COMPATIBILITY_MATRIX_LEVEL)),legacy)
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.legacy.xml
-else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),26),)
- # All PRODUCT_FULL_TREBLE devices with shipping API levels < 26 get the level 26 manifest
- # as that is the first.
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.26.xml
-else ifeq ($(call math_gt_or_eq,$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL),28),)
- # All shipping API levels with released compatibility matrices get the corresponding matrix.
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := \
- hardware/interfaces/compatibility_matrix.$(PRODUCT_COMPATIBILITY_MATRIX_LEVEL).xml
-else
- FRAMEWORK_COMPATIBILITY_MATRIX_FILE := hardware/interfaces/compatibility_matrix.current.xml
-endif
+FRAMEWORK_COMPATIBILITY_MATRIX_FILES := $(wildcard hardware/interfaces/compatibility_matrix.*.xml)
BUILD_NUMBER_FROM_FILE := $$(cat $(OUT_DIR)/build_number.txt)
BUILD_DATETIME_FROM_FILE := $$(cat $(OUT_DIR)/build_date.txt)
diff --git a/core/java_common.mk b/core/java_common.mk
index a816324..aac5982 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -38,6 +38,9 @@
###########################################################
## .proto files: Compile proto files to .java
###########################################################
+ifeq ($(strip $(LOCAL_PROTOC_OPTIMIZE_TYPE)),)
+ LOCAL_PROTOC_OPTIMIZE_TYPE := lite
+endif
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
# Because names of the .java files compiled from .proto files are unknown until the
# .proto files are compiled, we use a timestamp file as depedency.
@@ -67,7 +70,7 @@
endif
endif
$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
+$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
$(call transform-proto-to-java)
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index 0b8fa4d..e94c019 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -43,6 +43,12 @@
$(call dexpreopt-one-file,$<,$@)
endif
+PACKAGES := $(PACKAGES) $(LOCAL_MODULE)
+ifdef LOCAL_CERTIFICATE
+ PACKAGES.$(LOCAL_MODULE).PRIVATE_KEY := $(LOCAL_CERTIFICATE)
+ PACKAGES.$(LOCAL_MODULE).CERTIFICATE := $(patsubst %.x509.pem,%.pk8,$(LOCAL_CERTIFICATE))
+endif
+
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),system_current)
my_link_type := java:system
diff --git a/core/soong_config.mk b/core/soong_config.mk
index b9b9cbe..eb19a8c 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -116,7 +116,11 @@
$(call add_json_list, ExtraVndkVersions, $(PRODUCT_EXTRA_VNDK_VERSIONS))
$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
-$(call add_json_bool, Treble, $(filter true,$(PRODUCT_FULL_TREBLE)))
+
+$(call add_json_bool, Treble_linker_namespaces, $(filter true,$(PRODUCT_TREBLE_LINKER_NAMESPACES)))
+$(call add_json_bool, Sepolicy_split, $(filter true,$(PRODUCT_SEPOLICY_SPLIT)))
+$(call add_json_bool, Enforce_vintf_manifest, $(filter true,$(PRODUCT_ENFORCE_VINTF_MANIFEST)))
+
$(call add_json_bool, Uml, $(filter true,$(TARGET_USER_MODE_LINUX)))
$(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR))
$(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
diff --git a/target/board/Android.mk b/target/board/Android.mk
index f8d3bb3..fc32cd9 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -34,7 +34,8 @@
ifdef DEVICE_MANIFEST_FILE
# $(DEVICE_MANIFEST_FILE) can be a list of files
include $(CLEAR_VARS)
-LOCAL_MODULE := manifest.xml
+LOCAL_MODULE := device_manifest.xml
+LOCAL_MODULE_STEM := manifest.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)
@@ -42,6 +43,8 @@
$(GEN): PRIVATE_DEVICE_MANIFEST_FILE := $(DEVICE_MANIFEST_FILE)
$(GEN): $(DEVICE_MANIFEST_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
+ PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
+ PRODUCT_SHIPPING_API_LEVEL=$(PRODUCT_SHIPPING_API_LEVEL) \
$(HOST_OUT_EXECUTABLES)/assemble_vintf -o $@ \
-i $(call normalize-path-list,$(PRIVATE_DEVICE_MANIFEST_FILE))
@@ -53,7 +56,8 @@
# Device Compatibility Matrix
ifdef DEVICE_MATRIX_FILE
include $(CLEAR_VARS)
-LOCAL_MODULE := compatibility_matrix.xml
+LOCAL_MODULE := device_compatibility_matrix.xml
+LOCAL_MODULE_STEM := compatibility_matrix.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)
@@ -69,7 +73,7 @@
# Framework Manifest
include $(CLEAR_VARS)
-LOCAL_MODULE := system_manifest.xml
+LOCAL_MODULE := framework_manifest.xml
LOCAL_MODULE_STEM := manifest.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)
@@ -94,7 +98,7 @@
# Framework Compatibility Matrix
include $(CLEAR_VARS)
-LOCAL_MODULE := system_compatibility_matrix.xml
+LOCAL_MODULE := framework_compatibility_matrix.xml
LOCAL_MODULE_STEM := compatibility_matrix.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)
@@ -103,12 +107,10 @@
$(GEN): PRIVATE_FLAGS :=
-ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
ifdef BUILT_VENDOR_MANIFEST
$(GEN): $(BUILT_VENDOR_MANIFEST)
$(GEN): PRIVATE_FLAGS += -c "$(BUILT_VENDOR_MANIFEST)"
endif
-endif
ifeq (true,$(BOARD_AVB_ENABLE))
$(GEN): $(AVBTOOL)
@@ -139,12 +141,15 @@
KERNEL_VERSIONS :=
KERNEL_CONFIG_DATA :=
-$(GEN): $(FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(HOST_OUT_EXECUTABLES)/assemble_vintf
+$(GEN): $(FRAMEWORK_COMPATIBILITY_MATRIX_FILES) $(HOST_OUT_EXECUTABLES)/assemble_vintf
# TODO(b/37405869) (b/37715375) inject avb versions as well for devices that have avb enabled.
POLICYVERS=$(POLICYVERS) \
BOARD_SEPOLICY_VERS=$(BOARD_SEPOLICY_VERS) \
FRAMEWORK_VBMETA_VERSION=$(FRAMEWORK_VBMETA_VERSION) \
- $(HOST_OUT_EXECUTABLES)/assemble_vintf -i $< -o $@ $(PRIVATE_FLAGS)
+ PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
+ $(HOST_OUT_EXECUTABLES)/assemble_vintf \
+ -i $(call normalize-path-list,$(FRAMEWORK_COMPATIBILITY_MATRIX_FILES)) \
+ -o $@ $(PRIVATE_FLAGS)
LOCAL_PREBUILT_MODULE_FILE := $(GEN)
include $(BUILD_PREBUILT)
BUILT_SYSTEM_COMPATIBILITY_MATRIX := $(LOCAL_BUILT_MODULE)
diff --git a/target/product/embedded.mk b/target/product/embedded.mk
index 246a553..55ee6dc 100644
--- a/target/product/embedded.mk
+++ b/target/product/embedded.mk
@@ -81,10 +81,13 @@
tzdatacheck \
vndservice \
vndservicemanager \
- compatibility_matrix.xml \
- manifest.xml \
- system_manifest.xml \
- system_compatibility_matrix.xml \
+
+# VINTF data
+PRODUCT_PACKAGES += \
+ device_compatibility_matrix.xml \
+ device_manifest.xml \
+ framework_manifest.xml \
+ framework_compatibility_matrix.xml \
# SELinux packages are added as dependencies of the selinux_policy
# phony package.
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index cc946ca..0f33f38 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -131,3 +131,9 @@
PRODUCT_CHARACTERISTICS := emulator
PRODUCT_FULL_TREBLE_OVERRIDE := true
+
+
+#watchdog tiggers reboot because location service is not
+#responding, disble it for now
+PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
+config.disable_location=true
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index e295760..8b55a45 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -467,16 +467,12 @@
def ReplaceUpdatedFiles(zip_filename, files_list):
- """Update all the zip entries listed in the files_list.
+ """Updates all the ZIP entries listed in files_list.
For now the list includes META/care_map.txt, and the related files under
SYSTEM/ after rebuilding recovery.
"""
-
- cmd = ["zip", "-d", zip_filename] + files_list
- p = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
- p.communicate()
-
+ common.ZipDelete(zip_filename, files_list)
output_zip = zipfile.ZipFile(zip_filename, "a",
compression=zipfile.ZIP_DEFLATED,
allowZip64=True)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index fc1f52a..829b8db 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1147,6 +1147,28 @@
zipfile.ZIP64_LIMIT = saved_zip64_limit
+def ZipDelete(zip_filename, entries):
+ """Deletes entries from a ZIP file.
+
+ Since deleting entries from a ZIP file is not supported, it shells out to
+ 'zip -d'.
+
+ Args:
+ zip_filename: The name of the ZIP file.
+ entries: The name of the entry, or the list of names to be deleted.
+
+ Raises:
+ AssertionError: In case of non-zero return from 'zip'.
+ """
+ if isinstance(entries, basestring):
+ entries = [entries]
+ cmd = ["zip", "-d", zip_filename] + entries
+ proc = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ stdoutdata, _ = proc.communicate()
+ assert proc.returncode == 0, "Failed to delete %s:\n%s" % (entries,
+ stdoutdata)
+
+
def ZipClose(zip_file):
# http://b/18015246
# zipfile also refers to ZIP64_LIMIT during close() when it writes out the
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 60aa84e..07037f1 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -58,7 +58,7 @@
very rarely used, since it's expected to have a dedicated OEM partition
for OEM-specific properties. Only meaningful when -o is specified.
- -w (--wipe_user_data)
+ --wipe_user_data
Generate an OTA package that will wipe the user data partition
when installed.
@@ -137,7 +137,6 @@
print("Python 2.7 or newer is required.", file=sys.stderr)
sys.exit(1)
-import copy
import multiprocessing
import os.path
import subprocess
@@ -1239,44 +1238,33 @@
common.ZipClose(output_zip)
# SignOutput(), which in turn calls signapk.jar, will possibly reorder the
- # zip entries, as well as padding the entry headers. We do a preliminary
+ # ZIP entries, as well as padding the entry headers. We do a preliminary
# signing (with an incomplete metadata entry) to allow that to happen. Then
- # compute the zip entry offsets, write back the final metadata and do the
+ # compute the ZIP entry offsets, write back the final metadata and do the
# final signing.
- prelim_signing = tempfile.NamedTemporaryFile()
- SignOutput(temp_zip_file.name, prelim_signing.name)
+ prelim_signing = common.MakeTempFile(suffix='.zip')
+ SignOutput(temp_zip_file.name, prelim_signing)
common.ZipClose(temp_zip_file)
# Open the signed zip. Compute the final metadata that's needed for streaming.
- prelim_zip = zipfile.ZipFile(prelim_signing, "r",
- compression=zipfile.ZIP_DEFLATED)
+ prelim_signing_zip = zipfile.ZipFile(prelim_signing, 'r')
expected_length = len(metadata['ota-streaming-property-files'])
metadata['ota-streaming-property-files'] = ComputeStreamingMetadata(
- prelim_zip, reserve_space=False, expected_length=expected_length)
+ prelim_signing_zip, reserve_space=False, expected_length=expected_length)
+ common.ZipClose(prelim_signing_zip)
- # Copy the zip entries, as we cannot update / delete entries with zipfile.
- final_signing = tempfile.NamedTemporaryFile()
- output_zip = zipfile.ZipFile(final_signing, "w",
+ # Replace the METADATA entry.
+ common.ZipDelete(prelim_signing, METADATA_NAME)
+ output_zip = zipfile.ZipFile(prelim_signing, 'a',
compression=zipfile.ZIP_DEFLATED)
- for item in prelim_zip.infolist():
- if item.filename == METADATA_NAME:
- continue
-
- data = prelim_zip.read(item.filename)
- out_info = copy.copy(item)
- common.ZipWriteStr(output_zip, out_info, data)
-
- # Now write the final metadata entry.
WriteMetadata(metadata, output_zip)
- common.ZipClose(prelim_zip)
common.ZipClose(output_zip)
# Re-sign the package after updating the metadata entry.
- SignOutput(final_signing.name, output_file)
- final_signing.close()
+ SignOutput(prelim_signing, output_file)
# Reopen the final signed zip to double check the streaming metadata.
- output_zip = zipfile.ZipFile(output_file, "r")
+ output_zip = zipfile.ZipFile(output_file, 'r')
actual = metadata['ota-streaming-property-files'].strip()
expected = ComputeStreamingMetadata(output_zip)
assert actual == expected, \
@@ -1295,7 +1283,7 @@
OPTIONS.full_radio = True
elif o == "--full_bootloader":
OPTIONS.full_bootloader = True
- elif o in ("-w", "--wipe_user_data"):
+ elif o == "--wipe_user_data":
OPTIONS.wipe_user_data = True
elif o == "--downgrade":
OPTIONS.downgrade = True
@@ -1347,7 +1335,7 @@
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:k:i:d:we:t:2o:",
+ extra_opts="b:k:i:d:e:t:2o:",
extra_long_opts=[
"package_key=",
"incremental_from=",
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 10ec0d3..bb93937 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -309,6 +309,51 @@
finally:
os.remove(zip_file_name)
+ def test_ZipDelete(self):
+ zip_file = tempfile.NamedTemporaryFile(delete=False, suffix='.zip')
+ output_zip = zipfile.ZipFile(zip_file.name, 'w',
+ compression=zipfile.ZIP_DEFLATED)
+ with tempfile.NamedTemporaryFile() as entry_file:
+ entry_file.write(os.urandom(1024))
+ common.ZipWrite(output_zip, entry_file.name, arcname='Test1')
+ common.ZipWrite(output_zip, entry_file.name, arcname='Test2')
+ common.ZipWrite(output_zip, entry_file.name, arcname='Test3')
+ common.ZipClose(output_zip)
+ zip_file.close()
+
+ try:
+ common.ZipDelete(zip_file.name, 'Test2')
+ with zipfile.ZipFile(zip_file.name, 'r') as check_zip:
+ entries = check_zip.namelist()
+ self.assertTrue('Test1' in entries)
+ self.assertFalse('Test2' in entries)
+ self.assertTrue('Test3' in entries)
+
+ self.assertRaises(AssertionError, common.ZipDelete, zip_file.name,
+ 'Test2')
+ with zipfile.ZipFile(zip_file.name, 'r') as check_zip:
+ entries = check_zip.namelist()
+ self.assertTrue('Test1' in entries)
+ self.assertFalse('Test2' in entries)
+ self.assertTrue('Test3' in entries)
+
+ common.ZipDelete(zip_file.name, ['Test3'])
+ with zipfile.ZipFile(zip_file.name, 'r') as check_zip:
+ entries = check_zip.namelist()
+ self.assertTrue('Test1' in entries)
+ self.assertFalse('Test2' in entries)
+ self.assertFalse('Test3' in entries)
+
+ common.ZipDelete(zip_file.name, ['Test1', 'Test2'])
+ with zipfile.ZipFile(zip_file.name, 'r') as check_zip:
+ entries = check_zip.namelist()
+ self.assertFalse('Test1' in entries)
+ self.assertFalse('Test2' in entries)
+ self.assertFalse('Test3' in entries)
+ finally:
+ os.remove(zip_file.name)
+
+
class InstallRecoveryScriptFormatTest(unittest.TestCase):
"""Check the format of install-recovery.sh