Query the uid process state in opChanged instead of relying on callbacks.

Occasionally, Android may enter a state where onUidStateChanged arrives
late or not at all until another process state change occurs. In some
situations that may mean isUidVisible is (incorrectly) false when the
app is in the foreground. Instead of relying on the onUidStateChanged
callback, query the state directly through activity manager.

The flag protecting this is only needed while data_delivery_permission_checks
is not flipped, and can be removed if that advances first.

Test: CameraPermissionTest
Bug: 378016494
Flag: com.android.internal.camera.flags.query_process_state
Change-Id: Ie609c87f27dc0610f5fe9c735e68b4e9366c510f
diff --git a/camera/camera_platform.aconfig b/camera/camera_platform.aconfig
index 968b28f..2feebb4 100644
--- a/camera/camera_platform.aconfig
+++ b/camera/camera_platform.aconfig
@@ -246,3 +246,13 @@
         purpose: PURPOSE_FEATURE
     }
 }
+
+flag {
+    namespace: "camera_platform"
+    name: "query_process_state"
+    description: "In opChanged, query the process state from AM instead of relying on mUidPolicy"
+    bug: "378016494"
+    metadata {
+        purpose: PURPOSE_BUGFIX
+    }
+}