Selecting uninstall button based on text

Since some OEMs still use the old layout for InstalledAppDetails
activity, their uninstall button is placed on the right, and therefore
has the id right_button instead of left_button. Changing the uiautomater
test to use the button text to find the uninstall button to solve this

Bug: 29960172
Change-Id: I48eaa040aeaa6639d39d57861783047048cc768c
diff --git a/tests/deviceadmin/uninstalltest/src/android/devicepolicy/cts/uiautomatertest/ b/tests/deviceadmin/uninstalltest/src/android/devicepolicy/cts/uiautomatertest/
index d070cb0..a8e7cc1 100644
--- a/tests/deviceadmin/uninstalltest/src/android/devicepolicy/cts/uiautomatertest/
+++ b/tests/deviceadmin/uninstalltest/src/android/devicepolicy/cts/uiautomatertest/
@@ -37,7 +37,7 @@
 import java.util.List;
+import java.util.regex.Pattern;
@@ -58,13 +58,16 @@
     private static final String DEVICE_ADMIN_PACKAGE_NAME =
     private static final String URI_PACKAGE_PREFIX = "package:";
+    private static final String UNINSTALL_BUTTON_TEXT_REGEX = "(?i)uninstall";
     private static final UiSelector DEACTIVATE_AND_UNINSTALL_BUTTON_SELECTOR = new UiSelector()
+    // Changing the below two selectors to match the button based on text due to b/29960172
     private static final UiSelector UNINSTALL_BUTTON_SELECTOR = new UiSelector()
-            .resourceId("");
+            .clickable(true).textMatches(UNINSTALL_BUTTON_TEXT_REGEX);
     private static final BySelector UNINSTALL_BUTTON_BYSELECTOR = By
-            .res("", "left_button");
+            .clickable(true).text(Pattern.compile(UNINSTALL_BUTTON_TEXT_REGEX));
     private static final UiSelector OK_BUTTON_SELECTOR = new UiSelector()
     private static final UiSelector SCROLL_VIEW_SELECTOR =