Camera / UidObserver: Add the ability to subscribe to specific UIDs
UidObserver sends updates about the state of all packages installed on
the system. In the case of the cameraserver, we only care about a
handful of them. The current status quo is to filter out these callbacks
but there is a significant IPC cost that is not addressed by that
approach.
This patch adds new entrypoints to ActivityManagerService to listen only
to specified UIDs. This set of uids can be updated dynamically.
Change-Id: I13c35c7025496bac35dda4c8a6cf89d49c42e447
Bug: 274486653
Test: -- on physical device:
-- testCamera2AccessCallbackInSplitMode x10
-- ActivityManagerServiceTest
-- ActivityManagerProcessStateTest
-- ActivityManagerFgsBgStartTest
-- UidObserverControllerTest
-- Alternate focus in split screen between Camera2 + GCA x20
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 8c57d26..d84cb00 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -798,6 +798,7 @@
// Monitored uid map
std::unordered_map<uid_t, MonitoredUid> mMonitoredUids;
std::unordered_map<uid_t, bool> mOverrideUids;
+ sp<IBinder> mObserverToken;
}; // class UidPolicy
// If sensor privacy is enabled then all apps, including those that are active, should be