Skip to content

Commit 604057b

Browse files
abdelrahmanIbrAndroid Build Cherrypicker Worker
authored andcommitted
Don't run the VPN tests on watches.
- Watches don't support VPN apps. - The VpnService CTS tests verify the VpnService API on watches bypassing the consent dialogs. - The tests for VpnManager VPNs do run on watches, but there isn't actually a way to start a VpnManager VPN on a watch because there is no way to display the consent dialog to the user. - Because there is no way to start a VPN app on a watch, there's no point requiring the tests to pass. - Disabling the tests allows watches to disable the VPN service, reducing startup time and memory usage. bug: b/286240194 (cherry picked from https://android-review.googlesource.com/q/commit:16e96aa28b0bcf64a190894d522ea01e6cd27a38) Merged-In: I35f5a2aa9e52a008b379348846efb5e91bc08252 Change-Id: I35f5a2aa9e52a008b379348846efb5e91bc08252
1 parent 85433d0 commit 604057b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ public void testSensorsRelatedPermissionsNotGrantedViaPolicy() throws Exception
246246
@RequiresDevice
247247
@Test
248248
public void testAlwaysOnVpn() throws Exception {
249+
assumeIsNotWatch();
249250
int userId = getUserIdForAlwaysOnVpnTests();
250251
installAppAsUser(VPN_APP_APK, userId);
251252
executeDeviceTestClassNoRestrictBackground(".AlwaysOnVpnTest", userId);
@@ -258,6 +259,7 @@ protected int getUserIdForAlwaysOnVpnTests() {
258259
@RequiresDevice
259260
@Test
260261
public void testAlwaysOnVpnLockDown() throws Exception {
262+
assumeIsNotWatch();
261263
int userId = getUserIdForAlwaysOnVpnTests();
262264
installAppAsUser(VPN_APP_APK, userId);
263265
try {
@@ -272,6 +274,7 @@ public void testAlwaysOnVpnLockDown() throws Exception {
272274
@RequiresDevice
273275
@Test
274276
public void testAlwaysOnVpnAcrossReboot() throws Exception {
277+
assumeIsNotWatch();
275278
int userId = getUserIdForAlwaysOnVpnTests();
276279
try {
277280
installAppAsUser(VPN_APP_APK, userId);
@@ -291,6 +294,7 @@ public void testAlwaysOnVpnAcrossReboot() throws Exception {
291294
@RequiresDevice
292295
@Test
293296
public void testAlwaysOnVpnPackageUninstalled() throws Exception {
297+
assumeIsNotWatch();
294298
int userId = getUserIdForAlwaysOnVpnTests();
295299
installAppAsUser(VPN_APP_APK, userId);
296300
try {
@@ -308,6 +312,7 @@ public void testAlwaysOnVpnPackageUninstalled() throws Exception {
308312
@RequiresDevice
309313
@Test
310314
public void testAlwaysOnVpnUnsupportedPackage() throws Exception {
315+
assumeIsNotWatch();
311316
int userId = getUserIdForAlwaysOnVpnTests();
312317
try {
313318
// Target SDK = 23: unsupported
@@ -333,6 +338,7 @@ public void testAlwaysOnVpnUnsupportedPackage() throws Exception {
333338
@RequiresDevice
334339
@Test
335340
public void testAlwaysOnVpnUnsupportedPackageReplaced() throws Exception {
341+
assumeIsNotWatch();
336342
int userId = getUserIdForAlwaysOnVpnTests();
337343
try {
338344
// Target SDK = 24: supported
@@ -355,6 +361,7 @@ public void testAlwaysOnVpnUnsupportedPackageReplaced() throws Exception {
355361
@RequiresDevice
356362
@Test
357363
public void testAlwaysOnVpnPackageLogged() throws Exception {
364+
assumeIsNotWatch();
358365
int userId = getUserIdForAlwaysOnVpnTests();
359366
// Will be uninstalled in tearDown().
360367
installAppAsUser(VPN_APP_APK, userId);
@@ -675,7 +682,7 @@ private void setDefaultContentCaptureServiceEnabled(boolean enabled)
675682
@Test
676683
public void testSetMeteredDataDisabledPackages() throws Exception {
677684
assumeHasWifiFeature();
678-
assumeFalse("is watch", hasDeviceFeature("android.hardware.type.watch"));
685+
assumeIsNotWatch();
679686

680687
installAppAsUser(METERED_DATA_APP_APK, mUserId);
681688

@@ -1712,4 +1719,8 @@ private void restoreRestrictBackgroundPolicyTo(boolean restricted) throws Except
17121719
getDevice().executeShellCommand(
17131720
restricted ? RESTRICT_BACKGROUND_ON_CMD : RESTRICT_BACKGROUND_OFF_CMD);
17141721
}
1722+
1723+
private void assumeIsNotWatch() throws Exception {
1724+
assumeFalse("is watch", hasDeviceFeature("android.hardware.type.watch"));
1725+
}
17151726
}

0 commit comments

Comments
 (0)