Cameraservice: Cache camera service proxy interface
To improve camera launch performance, cache the proxy service
interface. System tracing indicates fetching the interface can take
up to 8-10 ms during real camera opens, which is a percent or two
of total camera startup time.
Test: atest CameraCtsTestCases
Bug: 130173970
Change-Id: Icdf5218b04f608b897dcbf2085f971b04a913f3b
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 344dd92..4bcdeb2 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -930,6 +930,11 @@
static StatusInternal mapToInternal(hardware::camera::common::V1_0::CameraDeviceStatus status);
static int32_t mapToInterface(StatusInternal status);
+ // Guard mCameraServiceProxy
+ static Mutex sProxyMutex;
+ // Cached interface to the camera service proxy in system service
+ static sp<hardware::ICameraServiceProxy> sCameraServiceProxy;
+
static sp<hardware::ICameraServiceProxy> getCameraServiceProxy();
static void pingCameraServiceProxy();