Merge "Build DEVICE manifests and fragments for each SKU" into rvc-dev
diff --git a/core/definitions.mk b/core/definitions.mk
index fb11ab6..3d56f4c 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -3242,11 +3242,12 @@
 
 ###########################################################
 ## Find system_$(VER) in LOCAL_SDK_VERSION
+## note: system_server_* is excluded. It's a different API surface
 ##
 ## $(1): LOCAL_SDK_VERSION
 ###########################################################
 define has-system-sdk-version
-$(filter system_%,$(1))
+$(filter-out system_server_%,$(filter system_%,$(1)))
 endef
 
 ###########################################################
diff --git a/core/main.mk b/core/main.mk
index 8f4bcb4..5727bf2 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -1248,6 +1248,7 @@
     $(CUSTOM_MODULES) \
   )
 
+ifdef FULL_BUILD
 #
 # Used by the cleanup logic in soong_ui to remove files that should no longer
 # be installed.
@@ -1268,6 +1269,7 @@
     $(test_files)))))
 
 test_files :=
+endif
 
 
 # Don't include any GNU General Public License shared objects or static
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 61aa67c..c89e203 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -33,6 +33,13 @@
 #   updating the last seen rollback index in the tamper-evident storage.
 BOARD_AVB_ROLLBACK_INDEX := 0
 
+# Enable chain partition for system.
+# GSI need to sign on system.img instead of vbmeta.
+BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
+
 # GSI specific System Properties
 ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
 TARGET_SYSTEM_EXT_PROP := build/make/target/board/gsi_system_ext.prop
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index b14f01f..5df29e6 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -50,9 +50,7 @@
     cmd \
     com.android.adbd \
     com.android.apex.cts.shim.v1 \
-    com.android.appsearch \
     com.android.conscrypt \
-    com.android.cronet \
     com.android.extservices \
     com.android.i18n \
     com.android.ipsec \
@@ -212,7 +210,6 @@
     mtpd \
     ndc \
     netd \
-    NativeAdbDataLoaderService \
     NetworkStackNext \
     org.apache.http.legacy \
     otacerts \
@@ -331,7 +328,6 @@
     framework-telephony
 
 PRODUCT_UPDATABLE_BOOT_JARS := \
-    com.android.appsearch:framework-appsearch \
     com.android.conscrypt:conscrypt \
     com.android.media:updatable-media \
     com.android.mediaprovider:framework-mediaprovider \
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index cf0d5c7..c491d4a 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -156,10 +156,6 @@
 
 ifneq ($(TARGET_SKIP_CURRENT_VNDK),true)
 LOCAL_REQUIRED_MODULES += \
-    llndk.libraries.txt \
-    vndksp.libraries.txt \
-    vndkcore.libraries.txt \
-    vndkprivate.libraries.txt \
     vndkcorevariant.libraries.txt \
     $(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
     $(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES)) \
@@ -169,25 +165,10 @@
 include $(BUILD_PHONY_PACKAGE)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := vndk_snapshot_package
-_binder32 :=
-ifneq ($(TARGET_USES_64_BIT_BINDER),true)
-ifneq ($(TARGET_IS_64_BIT),true)
-_binder32 := _binder32
-endif
-endif
 _vndk_versions := $(PRODUCT_EXTRA_VNDK_VERSIONS)
 ifneq ($(BOARD_VNDK_VERSION),current)
 	_vndk_versions += $(BOARD_VNDK_VERSION)
 endif
-# Phony targets are installed for **.libraries.txt files.
-# TODO(b/141450808): remove following VNDK phony targets when **.libraries.txt files are provided by apexes.
-LOCAL_REQUIRED_MODULES := \
-    $(foreach vndk_ver,$(_vndk_versions),vndk_v$(vndk_ver)_$(TARGET_ARCH)$(_binder32))
-_binder32 :=
-include $(BUILD_PHONY_PACKAGE)
-
-include $(CLEAR_VARS)
 LOCAL_MODULE := vndk_apex_snapshot_package
 LOCAL_REQUIRED_MODULES := $(foreach vndk_ver,$(_vndk_versions),com.android.vndk.v$(vndk_ver))
 include $(BUILD_PHONY_PACKAGE)
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
index 9bf9668..3c66b81 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -36,7 +36,6 @@
     make_f2fs \
     requestsync \
     StatementService \
-    vndk_snapshot_package \
 
 PRODUCT_HOST_PACKAGES += \
     fsck.f2fs \
@@ -60,7 +59,6 @@
 # system server jars which are updated via apex modules.
 # The values should be of the format <apex name>:<jar name>
 PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS := \
-    com.android.appsearch:service-appsearch \
     com.android.permission:service-permission \
     com.android.wifi:wifi-service \
     com.android.ipsec:android.net.ipsec.ike \
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 8249915..cc05c64 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -338,7 +338,7 @@
   # Use repeatable ext4 FS UUID and hash_seed UUID (based on partition name and
   # build fingerprint).
   build_info = common.BuildInfo(info_dict)
-  uuid_seed = what + "-" + build_info.fingerprint
+  uuid_seed = what + "-" + build_info.GetPartitionFingerprint(what)
   image_props["uuid"] = str(uuid.uuid5(uuid.NAMESPACE_URL, uuid_seed))
   hash_seed = "hash_seed-" + uuid_seed
   image_props["hash_seed"] = str(uuid.uuid5(uuid.NAMESPACE_URL, hash_seed))
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index ed9183e..54bb857 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -540,7 +540,6 @@
       "verity_disable",
       "avb_enable",
       "avb_avbtool",
-      "avb_salt",
       "use_dynamic_partition_size",
   )
   for p in common_props:
@@ -553,6 +552,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_system_key_path", "avb_key_path")
     copy_prop("avb_system_algorithm", "avb_algorithm")
+    copy_prop("avb_system_salt", "avb_salt")
     copy_prop("fs_type", "fs_type")
     # Copy the generic system fs type first, override with specific one if
     # available.
@@ -584,6 +584,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_system_other_key_path", "avb_key_path")
     copy_prop("avb_system_other_algorithm", "avb_algorithm")
+    copy_prop("avb_system_other_salt", "avb_salt")
     copy_prop("fs_type", "fs_type")
     copy_prop("system_fs_type", "fs_type")
     copy_prop("system_other_size", "partition_size")
@@ -619,6 +620,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_vendor_key_path", "avb_key_path")
     copy_prop("avb_vendor_algorithm", "avb_algorithm")
+    copy_prop("avb_vendor_salt", "avb_salt")
     copy_prop("vendor_fs_type", "fs_type")
     copy_prop("vendor_size", "partition_size")
     if not copy_prop("vendor_journal_size", "journal_size"):
@@ -641,6 +643,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_product_key_path", "avb_key_path")
     copy_prop("avb_product_algorithm", "avb_algorithm")
+    copy_prop("avb_product_salt", "avb_salt")
     copy_prop("product_fs_type", "fs_type")
     copy_prop("product_size", "partition_size")
     if not copy_prop("product_journal_size", "journal_size"):
@@ -663,6 +666,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_system_ext_key_path", "avb_key_path")
     copy_prop("avb_system_ext_algorithm", "avb_algorithm")
+    copy_prop("avb_system_ext_salt", "avb_salt")
     copy_prop("system_ext_fs_type", "fs_type")
     copy_prop("system_ext_size", "partition_size")
     if not copy_prop("system_ext_journal_size", "journal_size"):
@@ -687,6 +691,7 @@
               "avb_add_hashtree_footer_args")
     copy_prop("avb_odm_key_path", "avb_key_path")
     copy_prop("avb_odm_algorithm", "avb_algorithm")
+    copy_prop("avb_odm_salt", "avb_salt")
     copy_prop("odm_fs_type", "fs_type")
     copy_prop("odm_size", "partition_size")
     if not copy_prop("odm_journal_size", "journal_size"):
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 2e235ee..3276b29 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -319,7 +319,7 @@
   OEM-specific properties, some of them will be calculated from two info dicts.
 
   Users can query properties similarly as using a dict() (e.g. info['fstab']),
-  or to query build properties via GetBuildProp() or GetVendorBuildProp().
+  or to query build properties via GetBuildProp() or GetPartitionBuildProp().
 
   Attributes:
     info_dict: The build-time info dict.
@@ -362,16 +362,31 @@
     if self._oem_props:
       assert oem_dicts, "OEM source required for this build"
 
+    def check_fingerprint(fingerprint):
+      if (" " in fingerprint or any(ord(ch) > 127 for ch in fingerprint)):
+        raise ValueError(
+            'Invalid build fingerprint: "{}". See the requirement in Android CDD '
+            "3.2.2. Build Parameters.".format(fingerprint))
+
+
+    self._partition_fingerprints = {}
+    for partition in PARTITIONS_WITH_CARE_MAP:
+      try:
+        fingerprint = self.CalculatePartitionFingerprint(partition)
+        check_fingerprint(fingerprint)
+        self._partition_fingerprints[partition] = fingerprint
+      except ExternalError:
+        continue
+    if "system" in self._partition_fingerprints:
+      # system_other is not included in PARTITIONS_WITH_CARE_MAP, but does
+      # need a fingerprint when creating the image.
+      self._partition_fingerprints[
+          "system_other"] = self._partition_fingerprints["system"]
+
     # These two should be computed only after setting self._oem_props.
     self._device = self.GetOemProperty("ro.product.device")
     self._fingerprint = self.CalculateFingerprint()
-
-    # Sanity check the build fingerprint.
-    if (' ' in self._fingerprint or
-        any(ord(ch) > 127 for ch in self._fingerprint)):
-      raise ValueError(
-          'Invalid build fingerprint: "{}". See the requirement in Android CDD '
-          '3.2.2. Build Parameters.'.format(self._fingerprint))
+    check_fingerprint(self._fingerprint)
 
   @property
   def is_ab(self):
@@ -386,28 +401,6 @@
     return self._fingerprint
 
   @property
-  def vendor_fingerprint(self):
-    return self._fingerprint_of("vendor")
-
-  @property
-  def product_fingerprint(self):
-    return self._fingerprint_of("product")
-
-  @property
-  def odm_fingerprint(self):
-    return self._fingerprint_of("odm")
-
-  def _fingerprint_of(self, partition):
-    if partition + ".build.prop" not in self.info_dict:
-      return None
-    build_prop = self.info_dict[partition + ".build.prop"]
-    if "ro." + partition + ".build.fingerprint" in build_prop:
-      return build_prop["ro." + partition + ".build.fingerprint"]
-    if "ro." + partition + ".build.thumbprint" in build_prop:
-      return build_prop["ro." + partition + ".build.thumbprint"]
-    return None
-
-  @property
   def oem_props(self):
     return self._oem_props
 
@@ -423,8 +416,22 @@
   def items(self):
     return self.info_dict.items()
 
+  def GetPartitionBuildProp(self, prop, partition):
+    """Returns the inquired build property for the provided partition."""
+    # If provided a partition for this property, only look within that
+    # partition's build.prop.
+    if prop in BuildInfo._RO_PRODUCT_RESOLVE_PROPS:
+      prop = prop.replace("ro.product", "ro.product.{}".format(partition))
+    else:
+      prop = prop.replace("ro.", "ro.{}.".format(partition))
+    try:
+      return self.info_dict.get("{}.build.prop".format(partition), {})[prop]
+    except KeyError:
+      raise ExternalError("couldn't find %s in %s.build.prop" %
+                          (prop, partition))
+
   def GetBuildProp(self, prop):
-    """Returns the inquired build property."""
+    """Returns the inquired build property from the standard build.prop file."""
     if prop in BuildInfo._RO_PRODUCT_RESOLVE_PROPS:
       return self._ResolveRoProductBuildProp(prop)
 
@@ -462,19 +469,28 @@
 
     raise ExternalError("couldn't resolve {}".format(prop))
 
-  def GetVendorBuildProp(self, prop):
-    """Returns the inquired vendor build property."""
-    try:
-      return self.info_dict.get("vendor.build.prop", {})[prop]
-    except KeyError:
-      raise ExternalError(
-          "couldn't find %s in vendor.build.prop" % (prop,))
-
   def GetOemProperty(self, key):
     if self.oem_props is not None and key in self.oem_props:
       return self.oem_dicts[0][key]
     return self.GetBuildProp(key)
 
+  def GetPartitionFingerprint(self, partition):
+    return self._partition_fingerprints.get(partition, None)
+
+  def CalculatePartitionFingerprint(self, partition):
+    try:
+      return self.GetPartitionBuildProp("ro.build.fingerprint", partition)
+    except ExternalError:
+      return "{}/{}/{}:{}/{}/{}:{}/{}".format(
+          self.GetPartitionBuildProp("ro.product.brand", partition),
+          self.GetPartitionBuildProp("ro.product.name", partition),
+          self.GetPartitionBuildProp("ro.product.device", partition),
+          self.GetPartitionBuildProp("ro.build.version.release", partition),
+          self.GetPartitionBuildProp("ro.build.id", partition),
+          self.GetPartitionBuildProp("ro.build.version.incremental", partition),
+          self.GetPartitionBuildProp("ro.build.type", partition),
+          self.GetPartitionBuildProp("ro.build.tags", partition))
+
   def CalculateFingerprint(self):
     if self.oem_props is None:
       try:
@@ -644,7 +660,10 @@
   # hash / hashtree footers.
   if d.get("avb_enable") == "true":
     build_info = BuildInfo(d)
-    d["avb_salt"] = sha256(build_info.fingerprint).hexdigest()
+    for partition in PARTITIONS_WITH_CARE_MAP:
+      fingerprint = build_info.GetPartitionFingerprint(partition)
+      if fingerprint:
+        d["avb_{}_salt".format(partition)] = sha256(fingerprint).hexdigest()
 
   return d
 
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index cce771c..5b7c2ac 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -91,6 +91,14 @@
       Replace the veritykeyid in BOOT/cmdline of input_target_file_zip
       with keyid of the cert pointed by <path_to_X509_PEM_cert_file>.
 
+  --remove_avb_public_keys <key1>,<key2>,...
+      Remove AVB public keys from the first-stage ramdisk. The key file to
+      remove is located at either of the following dirs:
+        - BOOT/RAMDISK/avb/ or
+        - BOOT/RAMDISK/first_stage_ramdisk/avb/
+      The second dir will be used for lookup if BOARD_USES_RECOVERY_AS_BOOT is
+      set to true.
+
   --avb_{boot,system,system_other,vendor,dtbo,vbmeta,vbmeta_system,
          vbmeta_vendor}_algorithm <algorithm>
   --avb_{boot,system,system_other,vendor,dtbo,vbmeta,vbmeta_system,
@@ -150,6 +158,7 @@
 OPTIONS.replace_verity_public_key = False
 OPTIONS.replace_verity_private_key = False
 OPTIONS.replace_verity_keyid = False
+OPTIONS.remove_avb_public_keys = None
 OPTIONS.tag_changes = ("-test-keys", "-dev-keys", "+release-keys")
 OPTIONS.avb_keys = {}
 OPTIONS.avb_algorithms = {}
@@ -585,6 +594,18 @@
           filename in ("BOOT/RAMDISK/verity_key",
                        "ROOT/verity_key")):
       pass
+    elif (OPTIONS.remove_avb_public_keys and
+          (filename.startswith("BOOT/RAMDISK/avb/") or
+           filename.startswith("BOOT/RAMDISK/first_stage_ramdisk/avb/"))):
+        matched_removal = False
+        for key_to_remove in OPTIONS.remove_avb_public_keys:
+          if filename.endswith(key_to_remove):
+            matched_removal = True
+            print("Removing AVB public key from ramdisk: %s" % filename)
+            break
+        if not matched_removal:
+          # Copy it verbatim if we don't want to remove it.
+          common.ZipWriteStr(output_tf_zip, out_info, data)
 
     # Skip verity keyid (for system_root_image use) if we will replace it.
     elif OPTIONS.replace_verity_keyid and filename == "BOOT/cmdline":
@@ -610,8 +631,7 @@
     # Should NOT sign boot-debug.img.
     elif filename in (
         "BOOT/RAMDISK/force_debuggable",
-        "RECOVERY/RAMDISK/force_debuggable"
-        "RECOVERY/RAMDISK/first_stage_ramdisk/force_debuggable"):
+        "BOOT/RAMDISK/first_stage_ramdisk/force_debuggable"):
       raise common.ExternalError("debuggable boot.img cannot be signed")
 
     # A non-APK file; copy it verbatim.
@@ -1135,6 +1155,8 @@
       OPTIONS.replace_verity_private_key = (True, a)
     elif o == "--replace_verity_keyid":
       OPTIONS.replace_verity_keyid = (True, a)
+    elif o == "--remove_avb_public_keys":
+      OPTIONS.remove_avb_public_keys = a.split(",")
     elif o == "--avb_vbmeta_key":
       OPTIONS.avb_keys['vbmeta'] = a
     elif o == "--avb_vbmeta_algorithm":
@@ -1203,6 +1225,7 @@
           "replace_verity_public_key=",
           "replace_verity_private_key=",
           "replace_verity_keyid=",
+          "remove_avb_public_keys=",
           "avb_apex_extra_args=",
           "avb_vbmeta_algorithm=",
           "avb_vbmeta_key=",
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
index 6a91cf4..524c0f2 100644
--- a/tools/releasetools/sparse_img.py
+++ b/tools/releasetools/sparse_img.py
@@ -250,13 +250,17 @@
     with open(fn) as f:
       for line in f:
         fn, ranges_text = line.rstrip().split(None, 1)
-        ranges = rangelib.RangeSet.parse(ranges_text)
+        raw_ranges = rangelib.RangeSet.parse(ranges_text)
 
         # Note: e2fsdroid records holes in the extent tree as "0" blocks.
         # This causes confusion because clobbered_blocks always includes
         # the superblock (physical block #0). Since the 0 blocks here do
         # not represent actual physical blocks, remove them from the set.
-        ranges = ranges.subtract(rangelib.RangeSet("0"))
+        ranges = raw_ranges.subtract(rangelib.RangeSet("0"))
+        # b/150334561 we need to perserve the monotonic property of the raw
+        # range. Otherwise, the validation script will read the blocks with
+        # wrong order when pulling files from the image.
+        ranges.monotonic = raw_ranges.monotonic
         ranges.extra['text_str'] = ranges_text
 
         if allow_shared_blocks:
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 53b5b76..da92163 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -53,8 +53,26 @@
           'ro.build.fingerprint' : 'build-fingerprint',
           'ro.build.foo' : 'build-foo',
       },
+      'system.build.prop' : {
+          'ro.product.system.brand' : 'product-brand',
+          'ro.product.system.name' : 'product-name',
+          'ro.product.system.device' : 'product-device',
+          'ro.system.build.version.release' : 'version-release',
+          'ro.system.build.id' : 'build-id',
+          'ro.system.build.version.incremental' : 'version-incremental',
+          'ro.system.build.type' : 'build-type',
+          'ro.system.build.tags' : 'build-tags',
+          'ro.system.build.foo' : 'build-foo',
+      },
       'vendor.build.prop' : {
-          'ro.vendor.build.fingerprint' : 'vendor-build-fingerprint',
+          'ro.product.vendor.brand' : 'vendor-product-brand',
+          'ro.product.vendor.name' : 'vendor-product-name',
+          'ro.product.vendor.device' : 'vendor-product-device',
+          'ro.vendor.build.version.release' : 'vendor-version-release',
+          'ro.vendor.build.id' : 'vendor-build-id',
+          'ro.vendor.build.version.incremental' : 'vendor-version-incremental',
+          'ro.vendor.build.type' : 'vendor-build-type',
+          'ro.vendor.build.tags' : 'vendor-build-tags',
       },
       'property1' : 'value1',
       'property2' : 4096,
@@ -186,39 +204,27 @@
     self.assertRaises(common.ExternalError, target_info.GetBuildProp,
                       'ro.build.nonexistent')
 
-  def test_GetVendorBuildProp(self):
+  def test_GetPartitionFingerprint(self):
     target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
-    self.assertEqual('vendor-build-fingerprint',
-                     target_info.GetVendorBuildProp(
-                         'ro.vendor.build.fingerprint'))
-    self.assertRaises(common.ExternalError, target_info.GetVendorBuildProp,
-                      'ro.build.nonexistent')
+    self.assertEqual(
+        target_info.GetPartitionFingerprint('vendor'),
+        'vendor-product-brand/vendor-product-name/vendor-product-device'
+        ':vendor-version-release/vendor-build-id/vendor-version-incremental'
+        ':vendor-build-type/vendor-build-tags')
 
-  def test_GetVendorBuildProp_with_oem_props(self):
-    target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,
-                                   self.TEST_OEM_DICTS)
-    self.assertEqual('vendor-build-fingerprint',
-                     target_info.GetVendorBuildProp(
-                         'ro.vendor.build.fingerprint'))
-    self.assertRaises(common.ExternalError, target_info.GetVendorBuildProp,
-                      'ro.build.nonexistent')
-
-  def test_vendor_fingerprint(self):
+  def test_GetPartitionFingerprint_system_other_uses_system(self):
     target_info = common.BuildInfo(self.TEST_INFO_DICT, None)
-    self.assertEqual('vendor-build-fingerprint',
-                     target_info.vendor_fingerprint)
+    self.assertEqual(
+        target_info.GetPartitionFingerprint('system_other'),
+        target_info.GetPartitionFingerprint('system'))
 
-  def test_vendor_fingerprint_blacklisted(self):
-    target_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
-    del target_info_dict['vendor.build.prop']['ro.vendor.build.fingerprint']
-    target_info = common.BuildInfo(target_info_dict, self.TEST_OEM_DICTS)
-    self.assertIsNone(target_info.vendor_fingerprint)
-
-  def test_vendor_fingerprint_without_vendor_build_prop(self):
-    target_info_dict = copy.deepcopy(self.TEST_INFO_DICT_USES_OEM_PROPS)
-    del target_info_dict['vendor.build.prop']
-    target_info = common.BuildInfo(target_info_dict, self.TEST_OEM_DICTS)
-    self.assertIsNone(target_info.vendor_fingerprint)
+  def test_GetPartitionFingerprint_uses_fingerprint_prop_if_available(self):
+    info_dict = copy.deepcopy(self.TEST_INFO_DICT)
+    info_dict['vendor.build.prop']['ro.vendor.build.fingerprint'] = 'vendor:fingerprint'
+    target_info = common.BuildInfo(info_dict, None)
+    self.assertEqual(
+        target_info.GetPartitionFingerprint('vendor'),
+        'vendor:fingerprint')
 
   def test_WriteMountOemScript(self):
     target_info = common.BuildInfo(self.TEST_INFO_DICT_USES_OEM_PROPS,