Removed assertion in testPerformGlobalActionRecents()

Removed assertion that performGlobalAction(GLOBAL_ACTION_RECENTS)
returns true as it might return false on devices that do not support
recents action (e.g. watches)

Bug: 31986988
Change-Id: I079e8d07a354c1732af91a4df6b32426878415ee
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGlobalActionsTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGlobalActionsTest.java
index b4f839e..127b6cc 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGlobalActionsTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGlobalActionsTest.java
@@ -58,20 +58,23 @@
 
     @MediumTest
     public void testPerformGlobalActionRecents() throws Exception {
-        // Check whether the action succeeded.
-        assertTrue(getInstrumentation().getUiAutomation().performGlobalAction(
-                AccessibilityService.GLOBAL_ACTION_RECENTS));
+        // Perform the action.
+        boolean actionWasPerformed =
+                getInstrumentation().getUiAutomation().performGlobalAction(
+                        AccessibilityService.GLOBAL_ACTION_RECENTS);
 
         // Sleep a bit so the UI is settled.
         waitForIdle();
 
-        // This is a necessary since the back action does not
-        // dismiss recents until they stop animating. Sigh...
-        SystemClock.sleep(5000);
+        if (actionWasPerformed) {
+            // This is a necessary since the back action does not
+            // dismiss recents until they stop animating. Sigh...
+            SystemClock.sleep(5000);
 
-        // Clean up.
-        getInstrumentation().getUiAutomation().performGlobalAction(
-                AccessibilityService.GLOBAL_ACTION_BACK);
+            // Clean up.
+            getInstrumentation().getUiAutomation().performGlobalAction(
+                    AccessibilityService.GLOBAL_ACTION_BACK);
+        }
 
         // Sleep a bit so the UI is settled.
         waitForIdle();