Should not run telecom test with device that have no telephony support
Bug: 28652905
Change-Id: I33955e87e6d67de562288726cfa8f36f23030377
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index db61f82..eb1c44b 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -64,6 +64,8 @@
private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
private static final String FEATURE_CAMERA = "android.hardware.camera";
private static final String FEATURE_WIFI = "android.hardware.wifi";
+ private static final String FEATURE_TELEPHONY = "android.hardware.telephony";
+ private static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
private static final String ADD_RESTRICTION_COMMAND = "add-restriction";
@@ -621,6 +623,9 @@
if (!mHasFeature) {
return;
}
+ if (!shouldRunTelecomTest()) {
+ return;
+ }
try {
// Register phone account in parent user.
assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".PhoneAccountTest",
@@ -658,6 +663,9 @@
if (!mHasFeature) {
return;
}
+ if (!shouldRunTelecomTest()) {
+ return;
+ }
// Place a outgoing call through work phone account using TelecomManager and verify the
// call is inserted properly.
assertTrue(runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".PhoneAccountTest",
@@ -769,6 +777,10 @@
mProfileUserId));
}
+ private boolean shouldRunTelecomTest() throws DeviceNotAvailableException {
+ return hasDeviceFeature(FEATURE_TELEPHONY) && hasDeviceFeature(FEATURE_CONNECTION_SERVICE);
+ }
+
private void runManagedContactsTest(Callable<Void> callable) throws Exception {
if (!mHasFeature) {
return;