Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraService: Support hooks for motorized camera #5

Open
wants to merge 1 commit into
base: dot11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion services/camera/libcameraservice/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ cc_library_shared {
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
"[email protected]",
"[email protected]"
],

static_libs: [
Expand Down
13 changes: 13 additions & 0 deletions services/camera/libcameraservice/CameraService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
#include "utils/TagMonitor.h"
#include "utils/CameraThreadState.h"

#include <vendor/lineage/camera/motor/1.0/ICameraMotor.h>

namespace {
const char* kPermissionServiceName = "permission";
}; // namespace anonymous
Expand All @@ -94,6 +96,7 @@ using hardware::camera::common::V1_0::CameraDeviceStatus;
using hardware::camera::common::V1_0::TorchModeStatus;
using hardware::camera2::utils::CameraIdAndSessionConfiguration;
using hardware::camera2::utils::ConcurrentCameraIdCombination;
using vendor::lineage::camera::motor::V1_0::ICameraMotor;

// ----------------------------------------------------------------------------
// Logging support -- this is for debugging only
Expand Down Expand Up @@ -1778,6 +1781,11 @@ Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8&
} else {
// Otherwise, add client to active clients list
finishConnectLocked(client, partial);

sp<ICameraMotor> cameraMotor = ICameraMotor::getService();
if (cameraMotor != nullptr) {
cameraMotor->onConnect(cameraId.string());
}
}
} // lock is destroyed, allow further connect calls

Expand Down Expand Up @@ -2833,6 +2841,11 @@ binder::Status CameraService::BasicClient::disconnect() {
}
mDisconnected = true;

sp<ICameraMotor> cameraMotor = ICameraMotor::getService();
if (cameraMotor != nullptr) {
cameraMotor->onDisconnect(mCameraIdStr.string());
}

sCameraService->removeByClient(this);
sCameraService->logDisconnected(mCameraIdStr, mClientPid, String8(mClientPackageName));
sCameraService->mCameraProviderManager->removeRef(CameraProviderManager::DeviceMode::CAMERA,
Expand Down