Merge "CameraService: Fix missing torch state callback"

am: 5a80267cc4

Change-Id: I48c777c60d142335f69522bbd8fe64439ac9702b
gugelfrei
Shuzhen Wang 6 years ago committed by android-build-merger
commit 28c5bca5a9

@ -208,6 +208,14 @@ void CameraService::pingCameraServiceProxy() {
proxyBinder->pingForUserUpdate();
}
void CameraService::broadcastTorchModeStatus(const String8& cameraId, TorchModeStatus status) {
Mutex::Autolock lock(mStatusListenerLock);
for (auto& i : mListenerList) {
i->onTorchStatusChanged(mapToInterface(status), String16{cameraId});
}
}
CameraService::~CameraService() {
VendorTagDescriptor::clearGlobalVendorTagDescriptor();
mUidPolicy->unregisterSelf();
@ -246,6 +254,8 @@ void CameraService::addStates(const String8 id) {
if (mFlashlight->hasFlashUnit(id)) {
Mutex::Autolock al(mTorchStatusMutex);
mTorchStatusMap.add(id, TorchModeStatus::AVAILABLE_OFF);
broadcastTorchModeStatus(id, TorchModeStatus::AVAILABLE_OFF);
}
updateCameraNumAndIds();
@ -398,12 +408,7 @@ void CameraService::onTorchStatusChangedLocked(const String8& cameraId,
}
}
{
Mutex::Autolock lock(mStatusListenerLock);
for (auto& i : mListenerList) {
i->onTorchStatusChanged(mapToInterface(newStatus), String16{cameraId});
}
}
broadcastTorchModeStatus(cameraId, newStatus);
}
Status CameraService::getNumberOfCameras(int32_t type, int32_t* numCameras) {

@ -857,6 +857,8 @@ private:
static sp<hardware::ICameraServiceProxy> getCameraServiceProxy();
static void pingCameraServiceProxy();
void broadcastTorchModeStatus(const String8& cameraId,
hardware::camera::common::V1_0::TorchModeStatus status);
};
} // namespace android

Loading…
Cancel
Save