Finds APK shared UID violations when merging target files.

This involved moving the find-shareduid-violation.py script to
releasetools to simplify the cross-tool usage. This new location aligns
this script with other similar python host tools.

In a future change this violation file will be used to check for
shared UID violations across the input build partition boundary.

Bug: 171431774
Test: test_merge_target_files
Test: Use merge_target_files.py to merge two partial builds,
      observe shared UID violations file contents in the result.
Test: m dist out/dist/shareduid_violation_modules.json
      (Checking that existing behavior in core/tasks is presereved)
Change-Id: I7deecbe019379c71bfdbedce56edac55e7b27b41
This commit is contained in:
Daniel Norman
2020-10-26 17:55:00 -07:00
parent 865b6605ca
commit b8d52a2fdc
5 changed files with 221 additions and 103 deletions

View File

@@ -98,6 +98,7 @@ import build_super_image
import check_target_files_vintf
import common
import img_from_target_files
import find_shareduid_violation
import ota_from_target_files
logger = logging.getLogger(__name__)
@@ -943,6 +944,21 @@ 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')
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',
}
violation = find_shareduid_violation.FindShareduidViolation(
output_target_files_temp_dir, partition_map)
f.write(violation)
# TODO(b/171431774): Add a check to common.py to check if the
# shared UIDs cross the input build partition boundary.
generate_images(output_target_files_temp_dir, rebuild_recovery)
generate_super_empty_image(output_target_files_temp_dir, output_super_empty)