Loading services/camera/libcameraservice/CameraService.cpp +14 −9 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,9 @@ static void setLogLevel(int level) { static const String16 sManageCameraPermission("android.permission.MANAGE_CAMERA"); static const String16 sManageCameraPermission("android.permission.MANAGE_CAMERA"); Mutex CameraService::sProxyMutex; sp<hardware::ICameraServiceProxy> CameraService::sCameraServiceProxy; CameraService::CameraService() : CameraService::CameraService() : mEventLog(DEFAULT_EVENT_LOG_LENGTH), mEventLog(DEFAULT_EVENT_LOG_LENGTH), mNumberOfCameras(0), mNumberOfCameras(0), Loading Loading @@ -203,18 +206,20 @@ status_t CameraService::enumerateProviders() { } } sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() { sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() { sp<ICameraServiceProxy> proxyBinder = nullptr; #ifndef __BRILLO__ #ifndef __BRILLO__ Mutex::Autolock al(sProxyMutex); if (sCameraServiceProxy == nullptr) { sp<IServiceManager> sm = defaultServiceManager(); sp<IServiceManager> sm = defaultServiceManager(); // Use checkService because cameraserver normally starts before the // Use checkService because cameraserver normally starts before the // system server and the proxy service. So the long timeout that getService // system server and the proxy service. So the long timeout that getService // has before giving up is inappropriate. // has before giving up is inappropriate. sp<IBinder> binder = sm->checkService(String16("media.camera.proxy")); sp<IBinder> binder = sm->checkService(String16("media.camera.proxy")); if (binder != nullptr) { if (binder != nullptr) { proxyBinder = interface_cast<ICameraServiceProxy>(binder); sCameraServiceProxy = interface_cast<ICameraServiceProxy>(binder); } } } #endif #endif return proxyBinder; return sCameraServiceProxy; } } void CameraService::pingCameraServiceProxy() { void CameraService::pingCameraServiceProxy() { Loading services/camera/libcameraservice/CameraService.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -930,6 +930,11 @@ private: static StatusInternal mapToInternal(hardware::camera::common::V1_0::CameraDeviceStatus status); static StatusInternal mapToInternal(hardware::camera::common::V1_0::CameraDeviceStatus status); static int32_t mapToInterface(StatusInternal 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 sp<hardware::ICameraServiceProxy> getCameraServiceProxy(); static void pingCameraServiceProxy(); static void pingCameraServiceProxy(); Loading Loading
services/camera/libcameraservice/CameraService.cpp +14 −9 Original line number Original line Diff line number Diff line Loading @@ -117,6 +117,9 @@ static void setLogLevel(int level) { static const String16 sManageCameraPermission("android.permission.MANAGE_CAMERA"); static const String16 sManageCameraPermission("android.permission.MANAGE_CAMERA"); Mutex CameraService::sProxyMutex; sp<hardware::ICameraServiceProxy> CameraService::sCameraServiceProxy; CameraService::CameraService() : CameraService::CameraService() : mEventLog(DEFAULT_EVENT_LOG_LENGTH), mEventLog(DEFAULT_EVENT_LOG_LENGTH), mNumberOfCameras(0), mNumberOfCameras(0), Loading Loading @@ -203,18 +206,20 @@ status_t CameraService::enumerateProviders() { } } sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() { sp<ICameraServiceProxy> CameraService::getCameraServiceProxy() { sp<ICameraServiceProxy> proxyBinder = nullptr; #ifndef __BRILLO__ #ifndef __BRILLO__ Mutex::Autolock al(sProxyMutex); if (sCameraServiceProxy == nullptr) { sp<IServiceManager> sm = defaultServiceManager(); sp<IServiceManager> sm = defaultServiceManager(); // Use checkService because cameraserver normally starts before the // Use checkService because cameraserver normally starts before the // system server and the proxy service. So the long timeout that getService // system server and the proxy service. So the long timeout that getService // has before giving up is inappropriate. // has before giving up is inappropriate. sp<IBinder> binder = sm->checkService(String16("media.camera.proxy")); sp<IBinder> binder = sm->checkService(String16("media.camera.proxy")); if (binder != nullptr) { if (binder != nullptr) { proxyBinder = interface_cast<ICameraServiceProxy>(binder); sCameraServiceProxy = interface_cast<ICameraServiceProxy>(binder); } } } #endif #endif return proxyBinder; return sCameraServiceProxy; } } void CameraService::pingCameraServiceProxy() { void CameraService::pingCameraServiceProxy() { Loading
services/camera/libcameraservice/CameraService.h +5 −0 Original line number Original line Diff line number Diff line Loading @@ -930,6 +930,11 @@ private: static StatusInternal mapToInternal(hardware::camera::common::V1_0::CameraDeviceStatus status); static StatusInternal mapToInternal(hardware::camera::common::V1_0::CameraDeviceStatus status); static int32_t mapToInterface(StatusInternal 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 sp<hardware::ICameraServiceProxy> getCameraServiceProxy(); static void pingCameraServiceProxy(); static void pingCameraServiceProxy(); Loading