summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuriy Romanenko <yromanenko@google.com>2021-07-12 18:31:03 -0700
committerYuriy Romanenko <yromanenko@google.com>2021-07-21 05:30:06 +0000
commit66dd5b48c7ca454ddf408cca60b276bb27f431be (patch)
tree362e5d322b7edd6380f6ddbbce925b9cc9a151f0
parent04f0c54ea415961eb60cdc5b35a5e1e9aad07d19 (diff)
downloadcamera-66dd5b48c7ca454ddf408cca60b276bb27f431be.tar.gz
Add camera HAL ready property when running from APEX
Allows GCA to poll a property instead of using framework event listener to determine approximately when the HAL cameras become ready Bug: 189110511 Test: adb shell getprop Change-Id: Iff958d71c4c1471d0d9974c6ce7636fdddf65655
-rw-r--r--common/hal/hidl_service/Android.bp1
-rw-r--r--common/hal/hidl_service/hidl_camera_provider.cc15
2 files changed, 13 insertions, 3 deletions
diff --git a/common/hal/hidl_service/Android.bp b/common/hal/hidl_service/Android.bp
index 97e78d7..29f7203 100644
--- a/common/hal/hidl_service/Android.bp
+++ b/common/hal/hidl_service/Android.bp
@@ -101,6 +101,7 @@ cc_defaults {
"android.hardware.graphics.mapper@4.0",
"android.hardware.thermal@2.0",
"libbinder",
+ "libbase",
"libcamera_metadata",
"libcutils",
"libfmq",
diff --git a/common/hal/hidl_service/hidl_camera_provider.cc b/common/hal/hidl_service/hidl_camera_provider.cc
index c2f63a4..1c572e3 100644
--- a/common/hal/hidl_service/hidl_camera_provider.cc
+++ b/common/hal/hidl_service/hidl_camera_provider.cc
@@ -164,13 +164,23 @@ status_t HidlCameraProvider::Initialize() {
Return<Status> HidlCameraProvider::setCallback(
const sp<ICameraProviderCallback>& callback) {
+ bool first_time = false;
{
std::unique_lock<std::mutex> lock(callbacks_lock_);
+ first_time = callbacks_ == nullptr;
callbacks_ = callback;
}
-
google_camera_provider_->TriggerDeferredCallbacks();
-
+#ifdef __ANDROID_APEX__
+ if (first_time) {
+ std::string ready_property_name = "vendor.camera.hal.ready.count";
+ int ready_count = property_get_int32(ready_property_name.c_str(), 0);
+ property_set(ready_property_name.c_str(),
+ std::to_string(++ready_count).c_str());
+ ALOGI("HidlCameraProvider::setCallback() first time ready count: %d ",
+ ready_count);
+ }
+#endif
return Status::OK;
}
@@ -203,7 +213,6 @@ Return<void> HidlCameraProvider::getVendorTags(getVendorTags_cb _hidl_cb) {
Return<void> HidlCameraProvider::getCameraIdList(getCameraIdList_cb _hidl_cb) {
std::vector<uint32_t> camera_ids;
hidl_vec<hidl_string> hidl_camera_ids;
-
status_t res = google_camera_provider_->GetCameraIdList(&camera_ids);
if (res != OK) {
ALOGE("%s: Getting camera ID list failed: %s(%d)", __FUNCTION__,