From 325129964e5b0a9794cf5bb63a2d2d8774ea6a1b Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Wed, 25 Apr 2018 16:45:59 -0700 Subject: Allow using reserved package IDs Pre-O, the platform treats negative resource IDs [those with a package ID of 0x80 or higher] as invalid. In order to work around this limitation, we allow the use of traditionally reserved resource IDs [those between 0x02 and 0x7E]. Bug: 78041707 Test: ./out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests Test: ./out/host/linux-x86/nativetest/libandroidfw_tests/libandroidfw_tests Test: Manual. Create a feature split with a package ID of 0x7E and see it runs and can reference base resources. Change-Id: I3d9782cc05d3a55e1a2467bf39566788847e1160 --- tools/aapt2/ResourceValues.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tools/aapt2/ResourceValues.cpp') diff --git a/tools/aapt2/ResourceValues.cpp b/tools/aapt2/ResourceValues.cpp index 6f213e19e5f6..34b46c552e0c 100644 --- a/tools/aapt2/ResourceValues.cpp +++ b/tools/aapt2/ResourceValues.cpp @@ -117,8 +117,7 @@ bool Reference::Equals(const Value* value) const { bool Reference::Flatten(android::Res_value* out_value) const { const ResourceId resid = id.value_or_default(ResourceId(0)); - const bool dynamic = resid.is_valid_dynamic() && resid.package_id() != kFrameworkPackageId && - resid.package_id() < kAppPackageId; + const bool dynamic = resid.is_valid_dynamic() && is_dynamic; if (reference_type == Reference::Type::kResource) { if (dynamic) { -- cgit v1.2.3-59-g8ed1b