[DO NOT MERGE] Replace UiSelector usages with BySelector

BySelector will look for UI elements in any window/hierarchy, whereas
UiSelector is limited to the layout hierarchy. The latter can be
problematic in Privacy Indicator tests if the chip or privacy panel
are implemented as views attached to the WindowManager's parent window
because the test needs to look for elements in both that window and
the test app's view hierarchy at the same time.

Bug: 235020326
Test: atest CameraMicIndicatorPermissionTest
Change-Id: Ic0d52f8a34ad1bbb0a4c3606553e139a21c7c020
diff --git a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
index fe9037a..05ae502 100644
--- a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
+++ b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
@@ -274,8 +274,8 @@
         openApp(useMic, useCamera, useHotword)
         try {
             eventually {
-                val appView = uiDevice.findObject(UiSelector().textContains(APP_LABEL))
-                assertTrue("View with text $APP_LABEL not found", appView.exists())
+                val appView = uiDevice.findObject(By.textContains(APP_LABEL))
+                assertNotNull("View with text $APP_LABEL not found", appView)
             }
             if (chainUsage) {
                 chainAttribution = createChainAttribution()
@@ -405,15 +405,15 @@
                 return@eventually
             }
             if (useMic) {
-                val iconView = uiDevice.findObject(UiSelector().descriptionContains(micLabel))
-                assertTrue("View with description $micLabel not found", iconView.exists())
+                val iconView = uiDevice.findObject(By.descContains(micLabel))
+                assertNotNull("View with description $micLabel not found", iconView)
             }
             if (useCamera) {
-                val iconView = uiDevice.findObject(UiSelector().descriptionContains(cameraLabel))
-                assertTrue("View with text $APP_LABEL not found", iconView.exists())
+                val iconView = uiDevice.findObject(By.descContains(cameraLabel))
+                assertNotNull("View with text $APP_LABEL not found", iconView)
             }
-            val appView = uiDevice.findObject(UiSelector().textContains(APP_LABEL))
-            assertTrue("View with text $APP_LABEL not found", appView.exists())
+            val appView = uiDevice.findObject(By.textContains(APP_LABEL))
+            assertNotNull("View with text $APP_LABEL not found", appView)
             if (safetyCenterEnabled) {
                 assertTrue("Did not find safety center views",
                     uiDevice.findObjects(By.res(SAFETY_CENTER_ITEM_ID)).size > 0)