From b79e8771ae2b0b343951da65c4d6e4ff81fc80c3 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Sat, 19 Sep 2015 10:56:35 -0700 Subject: [PATCH 01/14] Don't add build number to apps' version name for platform build. Bug: 24201956 Change-Id: I4a4bb483bb7b1bf7b7a856050d548bee4db0fe93 --- core/definitions.mk | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index 78b0a3912..fad468e66 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1633,8 +1633,12 @@ endef ## Commands for running javac to make .class files ########################################################### -#@echo "Source intermediates dir: $(PRIVATE_SOURCE_INTERMEDIATES_DIR)" -#@echo "Source intermediates: $$(find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java')" +# Add BUILD_NUMBER to apps default version name if it's unbundled build. +ifdef TARGET_BUILD_APPS +APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION)-$(BUILD_NUMBER) +else +APPS_DEFAULT_VERSION_NAME := $(PLATFORM_VERSION) +endif # TODO: Right now we generate the asset resources twice, first as part # of generating the Java classes, then at the end when packaging the final @@ -1661,8 +1665,8 @@ $(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m \ $(addprefix -G , $(PRIVATE_PROGUARD_OPTIONS_FILE)) \ $(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ $(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ - $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-code , $(PLATFORM_SDK_VERSION))) \ - $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER))) \ + $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \ + $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \ $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \ $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \ --skip-symbols-without-default-localization @@ -2010,8 +2014,8 @@ $(hide) $(AAPT) package -u $(PRIVATE_AAPT_FLAGS) \ $(addprefix --min-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ $(addprefix --target-sdk-version , $(PRIVATE_DEFAULT_APP_TARGET_SDK)) \ $(if $(filter --product,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --product , $(TARGET_AAPT_CHARACTERISTICS))) \ - $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-code , $(PLATFORM_SDK_VERSION))) \ - $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,$(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER))) \ + $(if $(filter --version-code,$(PRIVATE_AAPT_FLAGS)),,--version-code $(PLATFORM_SDK_VERSION)) \ + $(if $(filter --version-name,$(PRIVATE_AAPT_FLAGS)),,--version-name $(APPS_DEFAULT_VERSION_NAME)) \ $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \ $(addprefix --rename-instrumentation-target-package , $(PRIVATE_MANIFEST_INSTRUMENTATION_FOR)) \ --skip-symbols-without-default-localization \ From 3d593455272b2be8c3e7d62c40fd003a015cbad3 Mon Sep 17 00:00:00 2001 From: "smain@google.com" Date: Fri, 9 Oct 2015 16:30:05 -0700 Subject: [PATCH 02/14] add unique ID to each windows download link. These IDs are necessary for the TOS wall to identify which link should be applied to the download button. Change-Id: I1b5b8b516a5b8d7fd8433c02011cb4fb2044b71f --- tools/droiddoc/templates-sdk/sdkpage.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs index 3a3a9a3b5..47c299269 100644 --- a/tools/droiddoc/templates-sdk/sdkpage.cs +++ b/tools/droiddoc/templates-sdk/sdkpage.cs @@ -353,7 +353,7 @@ var:sdk.linux_download -
(No SDK tools included) @@ -364,7 +364,7 @@ var:sdk.linux_download - From 338da607e89bcb67394e0580fe02bb1ae0c69b8b Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Wed, 30 Sep 2015 16:01:14 -0700 Subject: [PATCH 03/14] DO NOT MERGE: Only use a fixed timestamp when packaging. This CL changes to use a fixed timestamp only when packaging into the target_files zip. Bug: 24377993 Change-Id: I01d136f4b99e1eff80c559192d93db83a3c5c0a4 (cherry picked from commit 822f5840c0f498e33829a0a00f383d9be3a7e913) --- tools/releasetools/add_img_to_target_files.py | 19 +++++++++++++++++++ tools/releasetools/build_image.py | 1 + 2 files changed, 20 insertions(+) diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index f7332b2de..f2bf1e177 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -28,6 +28,7 @@ if sys.hexversion < 0x02070000: print >> sys.stderr, "Python 2.7 or newer is required." sys.exit(1) +import datetime import errno import os import tempfile @@ -122,6 +123,12 @@ def CreateImage(input_dir, info_dict, what, block_list=None): if fstab: image_props["fs_type"] = fstab["/" + what].fs_type + # Use a fixed timestamp (01/01/2009) when packaging the image. + # Bug: 24377993 + epoch = datetime.datetime.fromtimestamp(0) + timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() + image_props["timestamp"] = int(timestamp) + if what == "system": fs_config_prefix = "" else: @@ -173,6 +180,12 @@ def AddUserdata(output_zip, prefix="IMAGES/"): print "creating userdata.img..." + # Use a fixed timestamp (01/01/2009) when packaging the image. + # Bug: 24377993 + epoch = datetime.datetime.fromtimestamp(0) + timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() + image_props["timestamp"] = int(timestamp) + # The name of the directory it is making an image out of matters to # mkyaffs2image. So we create a temp dir, and within it we create an # empty dir named "data", and build the image from that. @@ -210,6 +223,12 @@ def AddCache(output_zip, prefix="IMAGES/"): print "creating cache.img..." + # Use a fixed timestamp (01/01/2009) when packaging the image. + # Bug: 24377993 + epoch = datetime.datetime.fromtimestamp(0) + timestamp = (datetime.datetime(2009, 1, 1) - epoch).total_seconds() + image_props["timestamp"] = int(timestamp) + # The name of the directory it is making an image out of matters to # mkyaffs2image. So we create a temp dir, and within it we create an # empty dir named "cache", and build the image from that. diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 4b43c0cf5..357a666fc 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -399,6 +399,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): mount_point: such as "system", "data" etc. """ d = {} + if "build.prop" in glob_dict: bp = glob_dict["build.prop"] if "ro.build.date.utc" in bp: From ab4d8594591b715934d7a1106d5284e9721070ba Mon Sep 17 00:00:00 2001 From: Hans Boehm Date: Mon, 12 Oct 2015 17:08:04 -0700 Subject: [PATCH 04/14] Switch from Calculator to ExactCalculator Bug: 24875598 Use ExactCalculator for AOSP builds. This is a manual (due to intervening commits) cherrypick of commit 53c5891460408ffe37f2aecc2044320d49cef801 (ag/748830). Change-Id: I6c0acef640e62f8a70b7b2832b7eea662a0d301b --- target/product/core.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/product/core.mk b/target/product/core.mk index 519dbb8ef..d453303ff 100644 --- a/target/product/core.mk +++ b/target/product/core.mk @@ -23,7 +23,6 @@ PRODUCT_PACKAGES += \ BasicDreams \ Browser \ - Calculator \ Calendar \ CalendarProvider \ CaptivePortalLogin \ @@ -33,6 +32,7 @@ PRODUCT_PACKAGES += \ DocumentsUI \ DownloadProviderUi \ Email \ + ExactCalculator \ Exchange2 \ ExternalStorageProvider \ FusedLocation \ From 76a89d3a0a39ffa2c9172728165da42c3b3379be Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 22 Sep 2015 16:54:12 -0700 Subject: [PATCH 05/14] Sort all files found via $(shell find) Don't rely on filesystem ordering to make these the same for all builds. Bug: 24204119 Change-Id: I7313062157764091acecf45f4b57405c28858546 --- core/definitions.mk | 46 ++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index fad468e66..bc284aefc 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -181,10 +181,10 @@ endef ########################################################### define all-java-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.java" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -203,10 +203,10 @@ endef ########################################################### define all-c-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.c" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -225,10 +225,10 @@ endef ########################################################### define all-Iaidl-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "I*.aidl" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -246,10 +246,10 @@ endef ########################################################### define all-logtags-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.logtags" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -259,10 +259,10 @@ endef ########################################################### define all-proto-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.proto" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -272,10 +272,10 @@ endef ########################################################### define all-renderscript-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -285,10 +285,10 @@ endef ########################################################### define all-S-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.S" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -298,10 +298,10 @@ endef ########################################################### define all-html-files-under -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(LOCAL_PATH) ; \ find -L $(1) -name "*.html" -and -not -name ".*") \ - ) + )) endef ########################################################### @@ -319,7 +319,7 @@ endef ########################################################### define find-subdir-files -$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) ; find -L $(1))) +$(sort $(patsubst ./%,%,$(shell cd $(LOCAL_PATH) ; find -L $(1)))) endef ########################################################### @@ -331,8 +331,8 @@ endef ########################################################### define find-subdir-subdir-files -$(filter-out $(patsubst %,$(1)/%,$(3)),$(patsubst ./%,%,$(shell cd \ - $(LOCAL_PATH) ; find -L $(1) -maxdepth 1 -name $(2)))) +$(sort $(filter-out $(patsubst %,$(1)/%,$(3)),$(patsubst ./%,%,$(shell cd \ + $(LOCAL_PATH) ; find -L $(1) -maxdepth 1 -name $(2))))) endef ########################################################### @@ -341,10 +341,10 @@ endef ########################################################### define find-subdir-assets -$(if $(1),$(patsubst ./%,%, \ +$(sort $(if $(1),$(patsubst ./%,%, \ $(shell if [ -d $(1) ] ; then cd $(1) ; find ./ -not -name '.*' -and -type f -and -not -type l ; fi)), \ $(warning Empty argument supplied to find-subdir-assets) \ -) +)) endef ########################################################### @@ -369,10 +369,10 @@ endef ########################################################### define find-files-in-subdirs -$(patsubst ./%,%, \ +$(sort $(patsubst ./%,%, \ $(shell cd $(1) ; \ find -L $(3) -name $(2) -and -not -name ".*") \ - ) + )) endef ########################################################### From 7a74e5ee0e6c41395493d9259ccfff80717a4eaf Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 29 Sep 2015 16:26:28 -0700 Subject: [PATCH 06/14] Add all-cpp-files-under There are multiple versions of this in the tree. Let's standardize on one that will work for everyone, and will sort the results. Bug: 24204119 Change-Id: I09fcd80e1e8e35e64d8a8a62bbc096f87b02603f --- core/definitions.mk | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/core/definitions.mk b/core/definitions.mk index bc284aefc..0ea704029 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -218,6 +218,29 @@ define all-subdir-c-files $(call all-c-files-under,.) endef +########################################################### +## Find all of the cpp files under the named directories. +## LOCAL_CPP_EXTENSION is respected if set. +## Meant to be used like: +## SRC_FILES := $(call all-cpp-files-under,src tests) +########################################################### + +define all-cpp-files-under +$(sort $(patsubst ./%,%, \ + $(shell cd $(LOCAL_PATH) ; \ + find -L $(1) -name "*$(or $(LOCAL_CPP_EXTENSION),.cpp)" -and -not -name ".*") \ + )) +endef + +########################################################### +## Find all of the cpp files from here. Meant to be used like: +## SRC_FILES := $(call all-subdir-cpp-files) +########################################################### + +define all-subdir-cpp-files +$(call all-cpp-files-under,.) +endef + ########################################################### ## Find all files named "I*.aidl" under the named directories, ## which must be relative to $(LOCAL_PATH). The returned list From 57a64e015c0dd670f9adf5a2016526678ce96a1e Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 12 Oct 2015 15:26:52 -0700 Subject: [PATCH 07/14] Add all-named-(dirs|files)-under and related To consolidate the number of places that we're using 'find' in the tree, add some more helpers: all-named-dirs-under all-subdir-named-dirs all-named-files-under all-subdir-named-files This change also makes many of the current helpers use these helpers instead of using their own implementation. The 'dirs' helpers are using '-type d' so that they only output directories. It's probably safe to use '-type f' for the files helpers, but that increased the kati load time by ~20%. Bug: 24204119 Change-Id: I3312e2fe8c146f10955e1d986ad15d9c8be494e1 --- core/definitions.mk | 84 +++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 34 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index 0ea704029..9dea18c20 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -174,6 +174,46 @@ define all-named-subdir-makefiles $(wildcard $(addsuffix /Android.mk, $(addprefix $(call my-dir)/,$(1)))) endef +########################################################### +## Find all of the directories under the named directories with +## the specified name. +## Meant to be used like: +## INC_DIRS := $(call all-named-dirs-under,inc,.) +########################################################### + +define all-named-dirs-under +$(call find-subdir-files,$(2) -type d -name "$(1)") +endef + +########################################################### +## Find all the directories under the current directory that +## haves name that match $(1) +########################################################### + +define all-subdir-named-dirs +$(call all-named-dirs-under,$(1),.) +endef + +########################################################### +## Find all of the files under the named directories with +## the specified name. +## Meant to be used like: +## SRC_FILES := $(call all-named-files-under,*.h,src tests) +########################################################### + +define all-named-files-under +$(call find-files-in-subdirs,$(LOCAL_PATH),"$(1)",$(2)) +endef + +########################################################### +## Find all of the files under the current directory with +## the specified name. +########################################################### + +define all-subdir-named-files +$(call all-named-files-under,$(1),.) +endef + ########################################################### ## Find all of the java files under the named directories. ## Meant to be used like: @@ -181,10 +221,7 @@ endef ########################################################### define all-java-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.java" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.java,$(1)) endef ########################################################### @@ -203,10 +240,7 @@ endef ########################################################### define all-c-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.c" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.c,$(1)) endef ########################################################### @@ -248,10 +282,7 @@ endef ########################################################### define all-Iaidl-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "I*.aidl" -and -not -name ".*") \ - )) +$(call all-named-files-under,I*.aidl,$(1)) endef ########################################################### @@ -269,10 +300,7 @@ endef ########################################################### define all-logtags-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.logtags" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.logtags,$(1)) endef ########################################################### @@ -282,10 +310,7 @@ endef ########################################################### define all-proto-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.proto" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.proto,$(1)) endef ########################################################### @@ -295,10 +320,7 @@ endef ########################################################### define all-renderscript-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*") \ - )) +$(call find-subdir-files,$(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*") endef ########################################################### @@ -308,10 +330,7 @@ endef ########################################################### define all-S-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.S" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.S,$(1)) endef ########################################################### @@ -321,10 +340,7 @@ endef ########################################################### define all-html-files-under -$(sort $(patsubst ./%,%, \ - $(shell cd $(LOCAL_PATH) ; \ - find -L $(1) -name "*.html" -and -not -name ".*") \ - )) +$(call all-named-files-under,*.html,$(1)) endef ########################################################### @@ -375,11 +391,11 @@ endef ########################################################### define find-other-java-files - $(call find-subdir-files,$(1) -name "*.java" -and -not -name ".*") +$(call all-java-files-under,$(1)) endef define find-other-html-files - $(call find-subdir-files,$(1) -name "*.html" -and -not -name ".*") +$(call all-html-files-under,$(1)) endef ########################################################### From 539c7400468ba526253bc46771590aa9c68ec392 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 13 Oct 2015 21:16:07 -0700 Subject: [PATCH 08/14] fix merge of all-named-files-under Change-Id: Iad4c30abdcfca1e73a2a3d525dfcea57f92c5c40 --- core/definitions.mk | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/core/definitions.mk b/core/definitions.mk index a605515c4..5e45e1f5d 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -221,46 +221,6 @@ define all-subdir-named-files $(call all-named-files-under,$(1),.) endef -########################################################### -## Find all of the directories under the named directories with -## the specified name. -## Meant to be used like: -## INC_DIRS := $(call all-named-dirs-under,inc,.) -########################################################### - -define all-named-dirs-under -$(call find-subdir-files,$(2) -type d -name "$(1)") -endef - -########################################################### -## Find all the directories under the current directory that -## haves name that match $(1) -########################################################### - -define all-subdir-named-dirs -$(call all-named-dirs-under,$(1),.) -endef - -########################################################### -## Find all of the files under the named directories with -## the specified name. -## Meant to be used like: -## SRC_FILES := $(call all-named-files-under,*.h,src tests) -########################################################### - -define all-named-files-under -$(call find-files-in-subdirs,$(LOCAL_PATH),"$(1)",$(2)) -endef - -########################################################### -## Find all of the files under the current directory with -## the specified name. -########################################################### - -define all-subdir-named-files -$(call all-named-files-under,$(1),.) -endef - ########################################################### ## Find all of the java files under the named directories. ## Meant to be used like: From 3203bc10f0bc6a1acce8afeee6d8df1f0f64f72c Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Sat, 5 Sep 2015 20:35:32 -0700 Subject: [PATCH 09/14] DO NOT MERGE releasetools: Always write the last block if it's padded. In BBOTAs if the last block of a DataImage is padded, we should always write the whole block even for incremental OTAs. Because otherwise the last block may be skipped if unchanged, but would fail the post-install verification if it has non-zero contents in the padding bytes. Bug: 24981812 Change-Id: Id0608384fcff0375aec8c158e6f909569b873d31 (cherry picked from commit 7589e961a7b8b7d964704db87f83ed8811e97ac6) --- tools/releasetools/blockimgdiff.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py index 6ed9ca2e3..8060b588b 100644 --- a/tools/releasetools/blockimgdiff.py +++ b/tools/releasetools/blockimgdiff.py @@ -105,11 +105,13 @@ class DataImage(Image): assert not (trim and pad) partial = len(self.data) % self.blocksize + padded = False if partial > 0: if trim: self.data = self.data[:-partial] elif pad: self.data += '\0' * (self.blocksize - partial) + padded = True else: raise ValueError(("data for DataImage must be multiple of %d bytes " "unless trim or pad is specified") % @@ -119,14 +121,23 @@ class DataImage(Image): self.total_blocks = len(self.data) / self.blocksize self.care_map = RangeSet(data=(0, self.total_blocks)) - self.clobbered_blocks = RangeSet() + # When the last block is padded, we always write the whole block even for + # incremental OTAs. Because otherwise the last block may get skipped if + # unchanged for an incremental, but would fail the post-install + # verification if it has non-zero contents in the padding bytes. + # Bug: 23828506 + if padded: + self.clobbered_blocks = RangeSet( + data=(self.total_blocks-1, self.total_blocks)) + else: + self.clobbered_blocks = RangeSet() self.extended = RangeSet() zero_blocks = [] nonzero_blocks = [] reference = '\0' * self.blocksize - for i in range(self.total_blocks): + for i in range(self.total_blocks-1 if padded else self.total_blocks): d = self.data[i*self.blocksize : (i+1)*self.blocksize] if d == reference: zero_blocks.append(i) @@ -138,14 +149,18 @@ class DataImage(Image): self.file_map = {"__ZERO": RangeSet(zero_blocks), "__NONZERO": RangeSet(nonzero_blocks)} + if self.clobbered_blocks: + self.file_map["__COPY"] = self.clobbered_blocks + def ReadRangeSet(self, ranges): return [self.data[s*self.blocksize:e*self.blocksize] for (s, e) in ranges] def TotalSha1(self, include_clobbered_blocks=False): - # DataImage always carries empty clobbered_blocks, so - # include_clobbered_blocks can be ignored. - assert self.clobbered_blocks.size() == 0 - return sha1(self.data).hexdigest() + if not include_clobbered_blocks: + ranges = self.care_map.subtract(self.clobbered_blocks) + return sha1(self.ReadRangeSet(ranges)).hexdigest() + else: + return sha1(self.data).hexdigest() class Transfer(object): From e09359abc0f8c29fbb16d35ab7375d80fde6f931 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 13 Oct 2015 16:37:12 -0700 Subject: [PATCH 10/14] DO NOT MERGE Pass source's info_dict to vendor's releasetools.py. When building incremental packages, the info_dict from the source build should be the one in use. We have done that for most of the partitions (system and etc.), and should pass that to vendor's script as well. Also includes the CL in commit aac4ad56b6c60e271d807604b20f72084c58b426 that fixes a bug in commit 6f0b219ac551710c724e3f344023943178cdc217. Bug: 24898607 Change-Id: I4ea6037dad7061e1683661fc4c394fa3a7a7c5cd (cherry picked from commit 6f0b219ac551710c724e3f344023943178cdc217) --- tools/releasetools/common.py | 10 +++++++++- tools/releasetools/ota_from_target_files.py | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 99b319db6..27b8f274b 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -59,6 +59,8 @@ class Options(object): self.device_specific = None self.extras = {} self.info_dict = None + self.source_info_dict = None + self.target_info_dict = None self.worker_threads = None @@ -1193,7 +1195,11 @@ class BlockDifference(object): self.path = os.path.join(tmpdir, partition) b.Compute(self.path) - _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict) + if src is None: + _, self.device = GetTypeAndDevice("/" + partition, OPTIONS.info_dict) + else: + _, self.device = GetTypeAndDevice("/" + partition, + OPTIONS.source_info_dict) def WriteScript(self, script, output_zip, progress=None): if not self.src: @@ -1391,6 +1397,8 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img, output_sink("recovery-from-boot.p", patch) try: + # The following GetTypeAndDevice()s need to use the path in the target + # info_dict instead of source_info_dict. boot_type, boot_device = GetTypeAndDevice("/boot", info_dict) recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict) except KeyError: diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index b148fc190..c6fd47eec 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -753,7 +753,7 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip): output_zip=output_zip, script=script, metadata=metadata, - info_dict=OPTIONS.info_dict) + info_dict=OPTIONS.source_info_dict) # TODO: Currently this works differently from WriteIncrementalOTAPackage(). # This function doesn't consider thumbprints when writing @@ -1153,7 +1153,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): output_zip=output_zip, script=script, metadata=metadata, - info_dict=OPTIONS.info_dict) + info_dict=OPTIONS.source_info_dict) system_diff = FileDifference("system", source_zip, target_zip, output_zip) script.Mount("/system", recovery_mount_options) From 0f1512bc03b7820a2b9b93757a2309fb872f6677 Mon Sep 17 00:00:00 2001 From: Zach Jang Date: Mon, 19 Oct 2015 17:57:33 -0700 Subject: [PATCH 11/14] Update security string to 2015-12-01 Change-Id: I525bab4579449dd285ba87d7ddc9cb36223bf7fd --- core/version_defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/version_defaults.mk b/core/version_defaults.mk index 9bb5a2c94..63cc4a3b5 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -103,7 +103,7 @@ ifeq "" "$(PLATFORM_SECURITY_PATCH)" # Can be an arbitrary string, but must be a single word. # # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. - PLATFORM_SECURITY_PATCH := 2015-10-01 + PLATFORM_SECURITY_PATCH := 2015-12-01 endif ifeq "" "$(PLATFORM_BASE_OS)" From 0a20c942c4bb110ebd971e7959ed1b2fa53e452a Mon Sep 17 00:00:00 2001 From: Ian Pedowitz Date: Sat, 10 Oct 2015 11:00:52 -0700 Subject: [PATCH 12/14] Bump Android to 6.0.1 Bug: 24777474 Change-Id: Ibaca3c2d583aa92c8ca998b6d380ee720b71b1b8 --- core/version_defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/version_defaults.mk b/core/version_defaults.mk index 63cc4a3b5..a67a82ea0 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -42,7 +42,7 @@ ifeq "" "$(PLATFORM_VERSION)" # which is the version that we reveal to the end user. # Update this value when the platform version changes (rather # than overriding it somewhere else). Can be an arbitrary string. - PLATFORM_VERSION := 6.0 + PLATFORM_VERSION := 6.0.1 endif ifeq "" "$(PLATFORM_SDK_VERSION)" From 6575d4a2a8c78a703e5c2e2889ecb358668d1bbd Mon Sep 17 00:00:00 2001 From: Zach Jang Date: Thu, 22 Oct 2015 15:00:30 -0700 Subject: [PATCH 13/14] Update security string to 2015-12-01 - DO NOT MERGE Change-Id: I155ec6c2b57c899f20bb85f5a5cf031499ba81b0 --- core/version_defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/version_defaults.mk b/core/version_defaults.mk index e405b6d1d..0b47ac049 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -73,7 +73,7 @@ ifeq "" "$(PLATFORM_SECURITY_PATCH)" # Can be an arbitrary string, but must be a single word. # # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. - PLATFORM_SECURITY_PATCH := 2015-11-01 + PLATFORM_SECURITY_PATCH := 2015-12-01 endif ifeq "" "$(PLATFORM_BASE_OS)" From 19eec071220298786b345788bce3dc93e233b9d6 Mon Sep 17 00:00:00 2001 From: Zach Jang Date: Thu, 22 Oct 2015 15:03:14 -0700 Subject: [PATCH 14/14] Update security string to 2015-12-01 Change-Id: I2e07d57e457effdcf685203dabfcfefa47c70bf3 --- core/version_defaults.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/version_defaults.mk b/core/version_defaults.mk index a130799fd..63cc4a3b5 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -103,7 +103,7 @@ ifeq "" "$(PLATFORM_SECURITY_PATCH)" # Can be an arbitrary string, but must be a single word. # # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. - PLATFORM_SECURITY_PATCH := 2015-11-01 + PLATFORM_SECURITY_PATCH := 2015-12-01 endif ifeq "" "$(PLATFORM_BASE_OS)"