Loading services/camera/libcameraservice/CameraService.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -487,12 +487,12 @@ status_t CameraService::initializeShimMetadata(int cameraId) { } if (client == NULL) { needsNewClient = true; ret = connectHelperLocked(/*cameraClient*/NULL, // Empty binder callbacks ret = connectHelperLocked(/*out*/client, /*cameraClient*/NULL, // Empty binder callbacks cameraId, internalPackageName, uid, pid, client); pid); if (ret != OK) { // Error already logged by callee Loading Loading @@ -659,14 +659,17 @@ bool CameraService::canConnectUnsafe(int cameraId, return true; } status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClient, status_t CameraService::connectHelperLocked( /*out*/ sp<Client>& client, /*in*/ const sp<ICameraClient>& cameraClient, int cameraId, const String16& clientPackageName, int clientUid, int callingPid, /*out*/ sp<Client>& client, int halVersion) { int halVersion, bool legacyMode) { int facing = -1; int deviceVersion = getDeviceVersion(cameraId, &facing); Loading @@ -678,7 +681,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien case CAMERA_DEVICE_API_VERSION_1_0: client = new CameraClient(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); break; case CAMERA_DEVICE_API_VERSION_2_0: case CAMERA_DEVICE_API_VERSION_2_1: Loading @@ -687,7 +690,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien case CAMERA_DEVICE_API_VERSION_3_2: client = new Camera2Client(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); break; case -1: ALOGE("Invalid camera id %d", cameraId); Loading @@ -704,7 +707,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien // Only support higher HAL version device opened as HAL1.0 device. client = new CameraClient(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); } else { // Other combinations (e.g. HAL3.x open as HAL2.x) are not supported yet. ALOGE("Invalid camera HAL version %x: HAL %x device can only be" Loading Loading @@ -760,12 +763,12 @@ status_t CameraService::connect( return OK; } status = connectHelperLocked(cameraClient, status = connectHelperLocked(/*out*/client, cameraClient, cameraId, clientPackageName, clientUid, callingPid, client); callingPid); if (status != OK) { return status; } Loading Loading @@ -823,13 +826,14 @@ status_t CameraService::connectLegacy( return OK; } status = connectHelperLocked(cameraClient, status = connectHelperLocked(/*out*/client, cameraClient, cameraId, clientPackageName, clientUid, callingPid, client, halVersion); halVersion, /*legacyMode*/true); if (status != OK) { return status; } Loading services/camera/libcameraservice/CameraService.h +11 −8 Original line number Diff line number Diff line Loading @@ -452,14 +452,17 @@ private: * * Returns OK on success, or a negative error code. */ status_t connectHelperLocked(const sp<ICameraClient>& cameraClient, status_t connectHelperLocked( /*out*/ sp<Client>& client, /*in*/ const sp<ICameraClient>& cameraClient, int cameraId, const String16& clientPackageName, int clientUid, int callingPid, /*out*/ sp<Client>& client, int halVersion = CAMERA_HAL_API_VERSION_UNSPECIFIED); int halVersion = CAMERA_HAL_API_VERSION_UNSPECIFIED, bool legacyMode = false); }; } // namespace android Loading services/camera/libcameraservice/api1/Camera2Client.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ Camera2Client::Camera2Client(const sp<CameraService>& cameraService, int cameraFacing, int clientPid, uid_t clientUid, int servicePid): int servicePid, bool legacyMode): Camera2ClientBase(cameraService, cameraClient, clientPackageName, cameraId, cameraFacing, clientPid, clientUid, servicePid), mParameters(cameraId, cameraFacing) Loading @@ -62,6 +63,8 @@ Camera2Client::Camera2Client(const sp<CameraService>& cameraService, SharedParameters::Lock l(mParameters); l.mParameters.state = Parameters::DISCONNECTED; mLegacyMode = legacyMode; } status_t Camera2Client::initialize(camera_module_t *module) Loading Loading @@ -1449,6 +1452,13 @@ status_t Camera2Client::commandEnableShutterSoundL(bool enable) { return OK; } // the camera2 api legacy mode can unconditionally disable the shutter sound if (mLegacyMode) { ALOGV("%s: Disable shutter sound in legacy mode", __FUNCTION__); l.mParameters.playShutterSound = false; return OK; } // Disabling shutter sound may not be allowed. In that case only // allow the mediaserver process to disable the sound. char value[PROPERTY_VALUE_MAX]; Loading services/camera/libcameraservice/api1/Camera2Client.h +3 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ public: int cameraFacing, int clientPid, uid_t clientUid, int servicePid); int servicePid, bool legacyMode); virtual ~Camera2Client(); Loading Loading @@ -203,6 +204,7 @@ private: bool mAfInMotion; /** Utility members */ bool mLegacyMode; // Wait until the camera device has received the latest control settings status_t syncWithDevice(); Loading services/camera/libcameraservice/api1/CameraClient.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService, const String16& clientPackageName, int cameraId, int cameraFacing, int clientPid, int clientUid, int servicePid): int servicePid, bool legacyMode): Client(cameraService, cameraClient, clientPackageName, cameraId, cameraFacing, clientPid, clientUid, servicePid) { Loading @@ -54,6 +54,7 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = CAMERA_FRAME_CALLBACK_FLAG_NOOP; mOrientation = getOrientation(0, mCameraFacing == CAMERA_FACING_FRONT); mLegacyMode = legacyMode; mPlayShutterSound = true; LOG1("CameraClient::CameraClient X (pid %d, id %d)", callingPid, cameraId); } Loading Loading @@ -576,6 +577,13 @@ status_t CameraClient::enableShutterSound(bool enable) { return OK; } // the camera2 api legacy mode can unconditionally disable the shutter sound if (mLegacyMode) { ALOGV("%s: Disable shutter sound in legacy mode", __FUNCTION__); mPlayShutterSound = false; return OK; } // Disabling shutter sound may not be allowed. In that case only // allow the mediaserver process to disable the sound. char value[PROPERTY_VALUE_MAX]; Loading Loading
services/camera/libcameraservice/CameraService.cpp +24 −20 Original line number Diff line number Diff line Loading @@ -487,12 +487,12 @@ status_t CameraService::initializeShimMetadata(int cameraId) { } if (client == NULL) { needsNewClient = true; ret = connectHelperLocked(/*cameraClient*/NULL, // Empty binder callbacks ret = connectHelperLocked(/*out*/client, /*cameraClient*/NULL, // Empty binder callbacks cameraId, internalPackageName, uid, pid, client); pid); if (ret != OK) { // Error already logged by callee Loading Loading @@ -659,14 +659,17 @@ bool CameraService::canConnectUnsafe(int cameraId, return true; } status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClient, status_t CameraService::connectHelperLocked( /*out*/ sp<Client>& client, /*in*/ const sp<ICameraClient>& cameraClient, int cameraId, const String16& clientPackageName, int clientUid, int callingPid, /*out*/ sp<Client>& client, int halVersion) { int halVersion, bool legacyMode) { int facing = -1; int deviceVersion = getDeviceVersion(cameraId, &facing); Loading @@ -678,7 +681,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien case CAMERA_DEVICE_API_VERSION_1_0: client = new CameraClient(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); break; case CAMERA_DEVICE_API_VERSION_2_0: case CAMERA_DEVICE_API_VERSION_2_1: Loading @@ -687,7 +690,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien case CAMERA_DEVICE_API_VERSION_3_2: client = new Camera2Client(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); break; case -1: ALOGE("Invalid camera id %d", cameraId); Loading @@ -704,7 +707,7 @@ status_t CameraService::connectHelperLocked(const sp<ICameraClient>& cameraClien // Only support higher HAL version device opened as HAL1.0 device. client = new CameraClient(this, cameraClient, clientPackageName, cameraId, facing, callingPid, clientUid, getpid()); facing, callingPid, clientUid, getpid(), legacyMode); } else { // Other combinations (e.g. HAL3.x open as HAL2.x) are not supported yet. ALOGE("Invalid camera HAL version %x: HAL %x device can only be" Loading Loading @@ -760,12 +763,12 @@ status_t CameraService::connect( return OK; } status = connectHelperLocked(cameraClient, status = connectHelperLocked(/*out*/client, cameraClient, cameraId, clientPackageName, clientUid, callingPid, client); callingPid); if (status != OK) { return status; } Loading Loading @@ -823,13 +826,14 @@ status_t CameraService::connectLegacy( return OK; } status = connectHelperLocked(cameraClient, status = connectHelperLocked(/*out*/client, cameraClient, cameraId, clientPackageName, clientUid, callingPid, client, halVersion); halVersion, /*legacyMode*/true); if (status != OK) { return status; } Loading
services/camera/libcameraservice/CameraService.h +11 −8 Original line number Diff line number Diff line Loading @@ -452,14 +452,17 @@ private: * * Returns OK on success, or a negative error code. */ status_t connectHelperLocked(const sp<ICameraClient>& cameraClient, status_t connectHelperLocked( /*out*/ sp<Client>& client, /*in*/ const sp<ICameraClient>& cameraClient, int cameraId, const String16& clientPackageName, int clientUid, int callingPid, /*out*/ sp<Client>& client, int halVersion = CAMERA_HAL_API_VERSION_UNSPECIFIED); int halVersion = CAMERA_HAL_API_VERSION_UNSPECIFIED, bool legacyMode = false); }; } // namespace android Loading
services/camera/libcameraservice/api1/Camera2Client.cpp +11 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,8 @@ Camera2Client::Camera2Client(const sp<CameraService>& cameraService, int cameraFacing, int clientPid, uid_t clientUid, int servicePid): int servicePid, bool legacyMode): Camera2ClientBase(cameraService, cameraClient, clientPackageName, cameraId, cameraFacing, clientPid, clientUid, servicePid), mParameters(cameraId, cameraFacing) Loading @@ -62,6 +63,8 @@ Camera2Client::Camera2Client(const sp<CameraService>& cameraService, SharedParameters::Lock l(mParameters); l.mParameters.state = Parameters::DISCONNECTED; mLegacyMode = legacyMode; } status_t Camera2Client::initialize(camera_module_t *module) Loading Loading @@ -1449,6 +1452,13 @@ status_t Camera2Client::commandEnableShutterSoundL(bool enable) { return OK; } // the camera2 api legacy mode can unconditionally disable the shutter sound if (mLegacyMode) { ALOGV("%s: Disable shutter sound in legacy mode", __FUNCTION__); l.mParameters.playShutterSound = false; return OK; } // Disabling shutter sound may not be allowed. In that case only // allow the mediaserver process to disable the sound. char value[PROPERTY_VALUE_MAX]; Loading
services/camera/libcameraservice/api1/Camera2Client.h +3 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,8 @@ public: int cameraFacing, int clientPid, uid_t clientUid, int servicePid); int servicePid, bool legacyMode); virtual ~Camera2Client(); Loading Loading @@ -203,6 +204,7 @@ private: bool mAfInMotion; /** Utility members */ bool mLegacyMode; // Wait until the camera device has received the latest control settings status_t syncWithDevice(); Loading
services/camera/libcameraservice/api1/CameraClient.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService, const String16& clientPackageName, int cameraId, int cameraFacing, int clientPid, int clientUid, int servicePid): int servicePid, bool legacyMode): Client(cameraService, cameraClient, clientPackageName, cameraId, cameraFacing, clientPid, clientUid, servicePid) { Loading @@ -54,6 +54,7 @@ CameraClient::CameraClient(const sp<CameraService>& cameraService, // Callback is disabled by default mPreviewCallbackFlag = CAMERA_FRAME_CALLBACK_FLAG_NOOP; mOrientation = getOrientation(0, mCameraFacing == CAMERA_FACING_FRONT); mLegacyMode = legacyMode; mPlayShutterSound = true; LOG1("CameraClient::CameraClient X (pid %d, id %d)", callingPid, cameraId); } Loading Loading @@ -576,6 +577,13 @@ status_t CameraClient::enableShutterSound(bool enable) { return OK; } // the camera2 api legacy mode can unconditionally disable the shutter sound if (mLegacyMode) { ALOGV("%s: Disable shutter sound in legacy mode", __FUNCTION__); mPlayShutterSound = false; return OK; } // Disabling shutter sound may not be allowed. In that case only // allow the mediaserver process to disable the sound. char value[PROPERTY_VALUE_MAX]; Loading