Fix FeatureSplit tests to work properly with Java code

Change-Id: I2f6d770c860c05e0d5a407fd76dc59dd748e3c3f
This commit is contained in:
Adam Lesinski
2016-01-14 15:11:57 -08:00
parent 44859db74b
commit e05d8fb91b
10 changed files with 105 additions and 4 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);
}
}

View File

@@ -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)

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);
}
}

View File

@@ -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)

View File

@@ -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>