@@ -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