cameraservice: cache IPermissionChecker and IPermissionController

CameraService makes frequent calls to PermissionChecker and
PermissionController services while handler application requests.
However it requests a new instance of both from the service manager
for each call. Retrieving an instance from service manager results
in a binder call, which can quickly add up if the application is
making frequent calls to CameraService.

To reduce the latency of fetching the services, this CL caches the
PermissionChecker and IPermissionController objects for the lifetime
of CameraService.

Bug: 326139956
Test: atest CtsCameraTestCases:PerformanceTest#testCameraLaunch
      passes.
Test: Verified by vendors that getCameraCharacteristics calls are
      faster.
Change-Id: I9d7471c00d43bb89135d4026dcb8016be234938b
diff --git a/camera/camera_platform.aconfig b/camera/camera_platform.aconfig
index 1dc45c3..7e646cf 100644
--- a/camera/camera_platform.aconfig
+++ b/camera/camera_platform.aconfig
@@ -160,3 +160,13 @@
      bug: "297083874"
 }
 
+
+flag {
+     namespace: "camera_platform"
+     name: "cache_permission_services"
+     description: "Cache IPermissionController and IPermissionChecker in CameraService to reduce query latency."
+     bug: "326139956"
+     metadata {
+       purpose: PURPOSE_BUGFIX
+     }
+}