DO NOT MERGE Wait WINDOWS_CHANGED event when a popup is shown

For leacy apps, revoking permission shows the confirmation dialog popup
before the pemission is actually revoked. This popup is detected with
not WINDOW_CONTENT_CHANGED but WINDOWS_CHANGED event.

ag/969033 caused the regression around this logic. This change makes it
not to see WINDOWS_CHANGED event but only WINODW_CONTENT_CHANGED event.

This CL changes it to see WINDOWS_CHANGED event.

Bug: 139639150
Test: Ran PermissionsHostTest#testCompatRevoked22 on eve and sargo
Change-Id: If046532a4860e10fbd0311d555a5c2914bac31f2
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
index d6b39fd..68ec7cc 100755
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
@@ -394,15 +394,17 @@
             if (granted != wasGranted) {
                 // Toggle the permission
 
+                boolean willShowPopup = (wasGranted && legacyApp);
+
                 if (!itemView.getActionList().contains(AccessibilityAction.ACTION_CLICK)) {
-                    click(toggleView, false);
+                    click(toggleView, willShowPopup);
                 } else {
-                    click(itemView, false);
+                    click(itemView, willShowPopup);
                 }
 
                 waitForIdle();
 
-                if (wasGranted && legacyApp) {
+                if (willShowPopup) {
                     scrollToBottomIfWatch();
                     String packageName = getInstrumentation().getContext().getPackageManager()
                             .getPermissionControllerPackageName();