Checks for APK sharedUserIds that cross partition group boundaries.
This check is used when merging target files to ensure that a merged build does not contain any APKs that share UID across builds. Bug: 171431774 Test: test_common Test: Use merge_target_files.py to merge two partial builds, observe no failures for inputs without colliding APKs. Test: Use merge_target_files.py to merge two partial builds, observe failure for inputs that have an APK that shares a UID across input partition groups. Change-Id: I9dc57216882741ae46a99cfd7847f34702c75582
This commit is contained in:
@@ -85,6 +85,7 @@ Usage: merge_target_files [args]
|
||||
from __future__ import print_function
|
||||
|
||||
import fnmatch
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
@@ -944,20 +945,32 @@ def merge_target_files(temp_dir, framework_target_files, framework_item_list,
|
||||
if not check_target_files_vintf.CheckVintf(output_target_files_temp_dir):
|
||||
raise RuntimeError('Incompatible VINTF metadata')
|
||||
|
||||
# Generate and check for cross-partition violations of sharedUserId
|
||||
# values in APKs. This requires the input target-files packages to contain
|
||||
# *.apk files.
|
||||
shareduid_violation_modules = os.path.join(
|
||||
output_target_files_temp_dir, 'META', 'shareduid_violation_modules.json')
|
||||
with open(shareduid_violation_modules, 'w') as f:
|
||||
partition_map = {
|
||||
'system': 'SYSTEM',
|
||||
'vendor': 'VENDOR',
|
||||
'product': 'PRODUCT',
|
||||
'system_ext': 'SYSTEM_EXT',
|
||||
}
|
||||
framework_partitions = item_list_to_partition_set(framework_item_list)
|
||||
vendor_partitions = item_list_to_partition_set(vendor_item_list)
|
||||
|
||||
partition_map = {}
|
||||
for partition in (framework_partitions.union(vendor_partitions)):
|
||||
partition_map[partition.lower()] = partition.upper()
|
||||
violation = find_shareduid_violation.FindShareduidViolation(
|
||||
output_target_files_temp_dir, partition_map)
|
||||
|
||||
# Write the output to a file to enable debugging.
|
||||
f.write(violation)
|
||||
# TODO(b/171431774): Add a check to common.py to check if the
|
||||
# shared UIDs cross the input build partition boundary.
|
||||
|
||||
# Check for violations across the input builds' partition groups.
|
||||
shareduid_errors = common.SharedUidPartitionViolations(
|
||||
json.loads(violation), [framework_partitions, vendor_partitions])
|
||||
if shareduid_errors:
|
||||
for error in shareduid_errors:
|
||||
logger.error(error)
|
||||
raise ValueError('sharedUserId APK error. See %s' %
|
||||
shareduid_violation_modules)
|
||||
|
||||
generate_images(output_target_files_temp_dir, rebuild_recovery)
|
||||
|
||||
|
Reference in New Issue
Block a user