libandroidfw: Search all packages for an identifier

In order to allow multiple packages with the same package name, but
different package ID, we need to keep searching packages until the
resource is found.

Bug: 30999713
Test: make libandroidfw_tests
Change-Id: If4540e12731ca18a18e9e550a9bf248606a586c5
This commit is contained in:
Adam Lesinski
2017-03-10 15:14:27 -08:00
parent b0c47ef877
commit 0e25d9ae77
6 changed files with 15 additions and 10 deletions

View File

@@ -4765,7 +4765,6 @@ nope:
&& (targetTypeLen = attrPrivate.size())
);
}
break;
}
return 0;
}

View File

@@ -44,8 +44,8 @@ struct R {
density = 0x7f030002,
// From feature
test3 = 0x7f080000,
test4 = 0x7f080001,
test3 = 0x80020000,
test4 = 0x80020001,
};
};
@@ -57,7 +57,7 @@ struct R {
ref2 = 0x7f040003,
// From feature
number3 = 0x7f090000,
number3 = 0x80030000,
};
};

View File

@@ -15,5 +15,6 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.basic">
package="com.android.basic"
featureName="feature">
</manifest>

View File

@@ -19,4 +19,10 @@ set -e
PATH_TO_FRAMEWORK_RES=${ANDROID_BUILD_TOP}/prebuilts/sdk/current/android.jar
aapt package -M AndroidManifest.xml -S res -I $PATH_TO_FRAMEWORK_RES --feature-of ../basic/basic.apk -F feature.apk -f
aapt2 compile --dir res -o compiled.flata
aapt2 link -o feature.apk \
--manifest AndroidManifest.xml \
-I $PATH_TO_FRAMEWORK_RES \
-I ../basic/basic.apk \
--package-id 0x80 \
compiled.flata

View File

@@ -15,13 +15,12 @@
-->
<resources>
<!-- Features are offset, so 7f020000 will become 7f080000 at runtime. -->
<public type="string" name="test3" id="0x7f020000" />
<public type="string" name="test3" id="0x80020000" />
<string name="test3">test3</string>
<public type="string" name="test4" id="0x7f020001" />
<public type="string" name="test4" id="0x80020001" />
<string name="test4">test4</string>
<public type="integer" name="number3" id="0x7f030000" />
<public type="integer" name="number3" id="0x80030000" />
<integer name="number3">200</integer>
</resources>