diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-04-26 21:49:53 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-04-26 21:55:31 -0700 |
commit | 4ca56978a9aea3f021a54ed9265de10811984d94 (patch) | |
tree | 1634b01c81b725ff3d286b7a8bf6cd16682cf7eb /tests/FeatureSplit | |
parent | 9e55fcbdc254da098bb792f460296ff0649c3b00 (diff) |
AAPT2: Add workaround for non-standard package IDs
The dynamic ref table used to map build-time IDs to runtime IDs
is mainly used for shared resource libraries and has a few built-in
mappings (app 0x7f and framework 0x01).
Using a non-standard package ID like 0x80 causes a failure in package ID
lookup. The solution is to ship the dynamic_ref_table with an identity mapping
with any resource table that uses a non-standard package ID.
Adds some tests to ensure this works correctly.
Bug: 37498913
Test: make libandroidfw_tests
Test: make aapt2_tests
Change-Id: Ic3f67942384d34e7fdcbc94ded360e940e3ebc8a
Diffstat (limited to 'tests/FeatureSplit')
5 files changed, 19 insertions, 7 deletions
diff --git a/tests/FeatureSplit/feature1/AndroidManifest.xml b/tests/FeatureSplit/feature1/AndroidManifest.xml index 42619b623e10..b87361faac62 100644 --- a/tests/FeatureSplit/feature1/AndroidManifest.xml +++ b/tests/FeatureSplit/feature1/AndroidManifest.xml @@ -16,7 +16,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.split.feature" - featureName="feature1"> + featureSplit="feature1"> <uses-sdk android:minSdkVersion="21" /> diff --git a/tests/FeatureSplit/feature1/res/layout/included.xml b/tests/FeatureSplit/feature1/res/layout/included.xml new file mode 100644 index 000000000000..c64bdb7ff85f --- /dev/null +++ b/tests/FeatureSplit/feature1/res/layout/included.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<TextView xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> diff --git a/tests/FeatureSplit/feature1/res/layout/main.xml b/tests/FeatureSplit/feature1/res/layout/main.xml new file mode 100644 index 000000000000..dbea42ab23d0 --- /dev/null +++ b/tests/FeatureSplit/feature1/res/layout/main.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + <include layout="@layout/included" + android:layout_width="match_parent" + android:layout_height="match_parent" /> +</FrameLayout> diff --git a/tests/FeatureSplit/feature1/src/com/android/test/split/feature/one/One.java b/tests/FeatureSplit/feature1/src/com/android/test/split/feature/one/One.java index def133919f90..61ac9dfba1cb 100644 --- a/tests/FeatureSplit/feature1/src/com/android/test/split/feature/one/One.java +++ b/tests/FeatureSplit/feature1/src/com/android/test/split/feature/one/One.java @@ -15,17 +15,16 @@ */ package com.android.test.split.feature.one; -import com.android.test.split.feature.ActivityMain; - +import android.app.Activity; import android.widget.TextView; import android.os.Bundle; -public class One extends ActivityMain { +public class One extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - ((TextView) findViewById(com.android.test.split.feature.R.id.text)) - .setText(R.string.feature_string); + setContentView(R.layout.main); + ((TextView) findViewById(R.id.text)).setText(R.string.feature_string); } } diff --git a/tests/FeatureSplit/feature2/AndroidManifest.xml b/tests/FeatureSplit/feature2/AndroidManifest.xml index b50044ac37b7..abd0b5eb6933 100644 --- a/tests/FeatureSplit/feature2/AndroidManifest.xml +++ b/tests/FeatureSplit/feature2/AndroidManifest.xml @@ -16,7 +16,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.split.feature" - featureName="feature2"> + featureSplit="feature2"> <uses-sdk android:minSdkVersion="21" /> |