diff options
author | Adam Lesinski <adamlesinski@google.com> | 2016-01-14 15:11:57 -0800 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2016-01-14 15:14:59 -0800 |
commit | e05d8fb91bdb579d2b532e6c4ea529b18ded2bd8 (patch) | |
tree | a162f7d90a74a9dd247bb7a0338eea78780517e7 | |
parent | 44859db74bb1cc2341524c5484cc3e765ec42c42 (diff) |
Fix FeatureSplit tests to work properly with Java code
Change-Id: I2f6d770c860c05e0d5a407fd76dc59dd748e3c3f
10 files changed, 105 insertions, 4 deletions
diff --git a/tests/FeatureSplit/base/AndroidManifest.xml b/tests/FeatureSplit/base/AndroidManifest.xml index 989e80250405..e82b3b9d45fc 100644 --- a/tests/FeatureSplit/base/AndroidManifest.xml +++ b/tests/FeatureSplit/base/AndroidManifest.xml @@ -16,7 +16,15 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.split.feature"> - <application android:label="@string/app_title" - android:hasCode="false"> + + <uses-sdk android:minSdkVersion="21" /> + + <application android:label="@string/app_title"> + <activity android:name=".ActivityMain" android:label="Feature Base"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> </application> </manifest> diff --git a/tests/FeatureSplit/base/res/layout/main.xml b/tests/FeatureSplit/base/res/layout/main.xml new file mode 100644 index 000000000000..f01b920be9ec --- /dev/null +++ b/tests/FeatureSplit/base/res/layout/main.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:padding="16dp"> + <TextView android:id="@+id/text" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:textAppearance="?android:textAppearanceLarge" /> +</RelativeLayout> diff --git a/tests/FeatureSplit/base/res/values/values.xml b/tests/FeatureSplit/base/res/values/values.xml index 564d301bae71..854a8bb7c4a1 100644 --- a/tests/FeatureSplit/base/res/values/values.xml +++ b/tests/FeatureSplit/base/res/values/values.xml @@ -16,6 +16,7 @@ <resources> <string name="app_title">FeatureSplit APK</string> + <string name="base">Base</string> <item type="id" name="test_id"/> <integer name="test_integer">100</integer> diff --git a/tests/FeatureSplit/base/src/com/android/test/split/feature/ActivityMain.java b/tests/FeatureSplit/base/src/com/android/test/split/feature/ActivityMain.java new file mode 100644 index 000000000000..6cca7c3a2dc1 --- /dev/null +++ b/tests/FeatureSplit/base/src/com/android/test/split/feature/ActivityMain.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.test.split.feature; + +import android.app.Activity; +import android.os.Bundle; +import android.widget.TextView; + +public class ActivityMain extends Activity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + ((TextView) findViewById(R.id.text)).setText(R.string.base); + } +} + diff --git a/tests/FeatureSplit/feature1/Android.mk b/tests/FeatureSplit/feature1/Android.mk index adfb575a0da6..aa222dd6aa66 100644 --- a/tests/FeatureSplit/feature1/Android.mk +++ b/tests/FeatureSplit/feature1/Android.mk @@ -22,10 +22,12 @@ LOCAL_PACKAGE_NAME := FeatureSplit1 LOCAL_MODULE_TAGS := tests featureOf := FeatureSplitBase + +LOCAL_APK_LIBRARIES := $(featureOf) featureOfApk := $(call intermediates-dir-for,APPS,$(featureOf))/package.apk localRStamp := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)/src/R.stamp $(localRStamp): $(featureOfApk) -LOCAL_AAPT_FLAGS := --feature-of $(featureOfApk) +LOCAL_AAPT_FLAGS := --feature-of $(featureOfApk) --custom-package com.android.test.split.feature.one include $(BUILD_PACKAGE) diff --git a/tests/FeatureSplit/feature1/AndroidManifest.xml b/tests/FeatureSplit/feature1/AndroidManifest.xml index 2aadc6d9c2f3..42619b623e10 100644 --- a/tests/FeatureSplit/feature1/AndroidManifest.xml +++ b/tests/FeatureSplit/feature1/AndroidManifest.xml @@ -17,5 +17,15 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.split.feature" featureName="feature1"> - <application android:hasCode="false" /> + + <uses-sdk android:minSdkVersion="21" /> + + <application> + <activity android:name=".one.One" android:label="Feature One"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <category android:name="android.intent.category.LAUNCHER" /> + </intent-filter> + </activity> + </application> </manifest> diff --git a/tests/FeatureSplit/feature1/res/values/values.xml b/tests/FeatureSplit/feature1/res/values/values.xml index 70eb56a76fb3..10dbd9733889 100644 --- a/tests/FeatureSplit/feature1/res/values/values.xml +++ b/tests/FeatureSplit/feature1/res/values/values.xml @@ -15,6 +15,7 @@ --> <resources> + <string name="feature_string">Feature1</string> <item type="id" name="test_id2"/> <integer name="test_integer2">200</integer> <color name="test_color2">#00ff00</color> 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 new file mode 100644 index 000000000000..def133919f90 --- /dev/null +++ b/tests/FeatureSplit/feature1/src/com/android/test/split/feature/one/One.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.test.split.feature.one; + +import com.android.test.split.feature.ActivityMain; + +import android.widget.TextView; +import android.os.Bundle; + +public class One extends ActivityMain { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + ((TextView) findViewById(com.android.test.split.feature.R.id.text)) + .setText(R.string.feature_string); + } +} diff --git a/tests/FeatureSplit/feature2/Android.mk b/tests/FeatureSplit/feature2/Android.mk index e69cbe89234f..1a0322bf686e 100644 --- a/tests/FeatureSplit/feature2/Android.mk +++ b/tests/FeatureSplit/feature2/Android.mk @@ -24,6 +24,8 @@ LOCAL_MODULE_TAGS := tests featureOf := FeatureSplitBase featureAfter := FeatureSplit1 +LOCAL_APK_LIBRARIES := $(featureOf) + featureOfApk := $(call intermediates-dir-for,APPS,$(featureOf))/package.apk featureAfterApk := $(call intermediates-dir-for,APPS,$(featureAfter))/package.apk localRStamp := $(call intermediates-dir-for,APPS,$(LOCAL_PACKAGE_NAME),,COMMON)/src/R.stamp @@ -31,5 +33,6 @@ $(localRStamp): $(featureOfApk) $(featureAfterApk) LOCAL_AAPT_FLAGS := --feature-of $(featureOfApk) LOCAL_AAPT_FLAGS += --feature-after $(featureAfterApk) +LOCAL_AAPT_FLAGS += --custom-package com.android.test.split.feature.two include $(BUILD_PACKAGE) diff --git a/tests/FeatureSplit/feature2/AndroidManifest.xml b/tests/FeatureSplit/feature2/AndroidManifest.xml index d139900eae46..b50044ac37b7 100644 --- a/tests/FeatureSplit/feature2/AndroidManifest.xml +++ b/tests/FeatureSplit/feature2/AndroidManifest.xml @@ -17,5 +17,8 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.split.feature" featureName="feature2"> + + <uses-sdk android:minSdkVersion="21" /> + <application android:hasCode="false"/> </manifest> |