Add CTS test for power usage page.
Bug: 79528124
Test: runtest --path cts/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
Change-Id: Ibfe72258013580cd141af362b5f9546705fae982
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index b2c85a4..ddedb84 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -413,7 +413,9 @@
}
public void testPowerUsageSummarySettings() {
- assertCanBeHandled(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY));
+ if (isHandheld()) {
+ assertCanBeHandled(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY));
+ }
}
public void testEasyConnectIntent() {
@@ -453,4 +455,14 @@
Intent intent = new Intent(Settings.ACTION_VOICE_INPUT_SETTINGS);
assertCanBeHandled(intent);
}
+
+ private boolean isHandheld() {
+ // handheld nature is not exposed to package manager, for now
+ // we check for touchscreen and NOT watch, NOT tv and NOT car
+ PackageManager pm = getContext().getPackageManager();
+ return pm.hasSystemFeature(pm.FEATURE_TOUCHSCREEN)
+ && !pm.hasSystemFeature(pm.FEATURE_WATCH)
+ && !pm.hasSystemFeature(pm.FEATURE_TELEVISION)
+ && !pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
+ }
}