Skip to content

Commit

Permalink
fw_av: libcameraservice: add TARGET_CAMERA_NEEDS_CLIENT_INFO_LIB
Browse files Browse the repository at this point in the history
Directly set camera package name by using OnePlusCameraProvider service.

Signed-off-by: Semavi Ulusoy <[email protected]>
Change-Id: I2dbefb5fa290da13160f94102e96850125feeb8a
  • Loading branch information
Hikari-no-Tenshi authored and semdoc committed Mar 25, 2022
1 parent 8944c76 commit 8443e6a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions services/camera/libcameraservice/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ cc_library_shared {
name: "libcameraservice",
defaults: [
"no_cameraserver_defaults",
"camera_needs_client_info_lib_defaults",
],

// Camera service source
Expand Down
15 changes: 13 additions & 2 deletions services/camera/libcameraservice/CameraService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
#include "utils/CameraThreadState.h"
#include "utils/CameraServiceProxyWrapper.h"

#ifdef CAMERA_NEEDS_CLIENT_INFO_LIB
#include <vendor/oneplus/hardware/camera/1.0/IOnePlusCameraProvider.h>
#endif

namespace {
const char* kPermissionServiceName = "permission";
}; // namespace anonymous
Expand All @@ -97,6 +101,9 @@ using hardware::camera2::ICameraInjectionCallback;
using hardware::camera2::ICameraInjectionSession;
using hardware::camera2::utils::CameraIdAndSessionConfiguration;
using hardware::camera2::utils::ConcurrentCameraIdCombination;
#ifdef CAMERA_NEEDS_CLIENT_INFO_LIB
using ::vendor::oneplus::hardware::camera::V1_0::IOnePlusCameraProvider;
#endif

// ----------------------------------------------------------------------------
// Logging support -- this is for debugging only
Expand Down Expand Up @@ -134,6 +141,9 @@ static const String16 sCameraOpenCloseListenerPermission(
static const String16
sCameraInjectExternalCameraPermission("android.permission.CAMERA_INJECT_EXTERNAL_CAMERA");
const char *sFileName = "lastOpenSessionDumpFile";
#ifdef CAMERA_NEEDS_CLIENT_INFO_LIB
static const sp<IOnePlusCameraProvider> gVendorCameraProviderService = IOnePlusCameraProvider::getService();
#endif
static constexpr int32_t kVendorClientScore = resource_policy::PERCEPTIBLE_APP_ADJ;
static constexpr int32_t kVendorClientState = ActivityManager::PROCESS_STATE_PERSISTENT_UI;

Expand Down Expand Up @@ -3254,7 +3264,9 @@ status_t CameraService::BasicClient::startCameraOps() {

// Notify listeners of camera open/close status
sCameraService->updateOpenCloseStatus(mCameraIdStr, true/*open*/, mClientPackageName);

#ifdef CAMERA_NEEDS_CLIENT_INFO_LIB
gVendorCameraProviderService->setPackageName(String8(mClientPackageName).string());
#endif
return OK;
}

Expand Down Expand Up @@ -3326,7 +3338,6 @@ status_t CameraService::BasicClient::finishCameraStreamingOps() {
mClientPackageName, mClientFeatureId);
mOpsStreaming = false;
}

return OK;
}

Expand Down

0 comments on commit 8443e6a

Please sign in to comment.