Check for BACKUP_FEATURE for testBackupService.
Check for presence of this feature, as not all android devices have a
backup service.
Bug: 63141361
Test: Tested on bullhead and swordfish devices.
Change-Id: I1fcedceb3817375e82a8162d70844f46c0296d6a
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index ac846a3..e054f81 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -32,6 +32,8 @@
private static final String MANAGED_PROFILE_ADMIN =
MANAGED_PROFILE_PKG + ".BaseManagedProfileTest$BasicAdminReceiver";
+ private static final String FEATURE_BACKUP = "android.software.backup";
+
private static final String INTENT_RECEIVER_PKG = "com.android.cts.intent.receiver";
private static final String INTENT_RECEIVER_APK = "CtsIntentReceiverApp.apk";
@@ -544,7 +546,9 @@
}
public void testBackupServiceEnabling() throws Exception {
- if (!mHasFeature) {
+ final boolean hasBackupService = getDevice().hasFeature(FEATURE_BACKUP);
+ // The backup service cannot be enabled if the backup feature is not supported.
+ if (!mHasFeature || !hasBackupService) {
return;
}
executeDeviceOwnerTest("BackupServiceEnabledTest");