diff options
-rw-r--r-- | tests/Compatibility/Android.mk | 2 | ||||
-rw-r--r-- | tests/Compatibility/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java | 12 |
3 files changed, 11 insertions, 5 deletions
diff --git a/tests/Compatibility/Android.mk b/tests/Compatibility/Android.mk index 5385413..0ec4d9d 100644 --- a/tests/Compatibility/Android.mk +++ b/tests/Compatibility/Android.mk @@ -18,12 +18,12 @@ include $(CLEAR_VARS) # We only want this apk build for tests. LOCAL_MODULE_TAGS := tests +LOCAL_JAVA_LIBRARIES := android.test.runner # Include all test java files. LOCAL_SRC_FILES := \ $(call all-java-files-under, src) -LOCAL_SDK_VERSION := 8 LOCAL_PACKAGE_NAME := AppCompatibilityTest include $(BUILD_PACKAGE) diff --git a/tests/Compatibility/AndroidManifest.xml b/tests/Compatibility/AndroidManifest.xml index 103ef4c..2884532 100644 --- a/tests/Compatibility/AndroidManifest.xml +++ b/tests/Compatibility/AndroidManifest.xml @@ -24,6 +24,4 @@ android:name=".AppCompatibilityRunner" android:targetPackage="com.android.compatibilitytest" android:label="App Compability Test Runner" /> - - <uses-sdk android:minSdkVersion="8"></uses-sdk> </manifest> diff --git a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java index a2e9117..5794b2b 100644 --- a/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java +++ b/tests/Compatibility/src/com/android/compatibilitytest/AppCompatibility.java @@ -147,11 +147,19 @@ public class AppCompatibility extends InstrumentationTestCase { * during the app launch. */ private ProcessErrorStateInfo launchActivity(String packageName) { + // the recommended way to see if this is a tv or not. + boolean isleanback = !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN) + && !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); Intent homeIntent = new Intent(Intent.ACTION_MAIN); homeIntent.addCategory(Intent.CATEGORY_HOME); homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - - Intent intent = mPackageManager.getLaunchIntentForPackage(packageName); + Intent intent; + if (isleanback) { + Log.d(TAG, "Leanback and relax!"); + intent = mPackageManager.getLeanbackLaunchIntentForPackage(packageName); + } else { + intent = mPackageManager.getLaunchIntentForPackage(packageName); + } // Skip if the apk does not have a launch intent. if (intent == null) { Log.d(TAG, "Skipping " + packageName + "; missing launch intent"); |