summaryrefslogtreecommitdiffstats
path: root/camera/provider
diff options
context:
space:
mode:
authorPeter Kalauskas <peskal@google.com>2018-10-05 09:03:05 -0700
committerPeter Kalauskas <peskal@google.com>2018-12-07 15:43:11 -0800
commit0b35cb259107a0c9d6d5bee61028867f3d5639c7 (patch)
tree2e8f07d1e5848fbaec273dfd515b8638e2590676 /camera/provider
parentfad169eb33c959e65dbcf08e1f5156d5f7eaf31a (diff)
downloadandroid_hardware_interfaces-0b35cb259107a0c9d6d5bee61028867f3d5639c7.tar.gz
android_hardware_interfaces-0b35cb259107a0c9d6d5bee61028867f3d5639c7.tar.bz2
android_hardware_interfaces-0b35cb259107a0c9d6d5bee61028867f3d5639c7.zip
Add new lazy service target to default camera HAL
Test: On walleye_svelte, reboot device and check that camera HAL is not running until camera app is opened Bug: 79374634 Change-Id: Ib9968c899ce8be5a68a28b4decf0a52f96b20ec5
Diffstat (limited to 'camera/provider')
-rw-r--r--camera/provider/2.4/default/Android.bp49
-rw-r--r--camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc1
-rw-r--r--camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc10
-rw-r--r--camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc10
-rw-r--r--camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc1
-rw-r--r--camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc1
-rw-r--r--camera/provider/2.4/default/service.cpp24
7 files changed, 72 insertions, 24 deletions
diff --git a/camera/provider/2.4/default/Android.bp b/camera/provider/2.4/default/Android.bp
index 167954cc0..81e5738ce 100644
--- a/camera/provider/2.4/default/Android.bp
+++ b/camera/provider/2.4/default/Android.bp
@@ -43,14 +43,12 @@ cc_library_shared {
],
}
-cc_binary {
- name: "android.hardware.camera.provider@2.4-service",
+cc_defaults {
+ name: "camera_service_defaults",
defaults: ["hidl_defaults"],
proprietary: true,
relative_install_path: "hw",
srcs: ["service.cpp"],
- compile_multilib: "32",
- init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
shared_libs: [
"libhidlbase",
"libhidltransport",
@@ -67,29 +65,36 @@ cc_binary {
],
}
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service",
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "32",
+ init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
+}
cc_binary {
name: "android.hardware.camera.provider@2.4-service_64",
- defaults: ["hidl_defaults"],
- proprietary: true,
- relative_install_path: "hw",
- srcs: ["service.cpp"],
+ defaults: ["camera_service_defaults"],
compile_multilib: "64",
init_rc: ["android.hardware.camera.provider@2.4-service_64.rc"],
- shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libbinder",
- "liblog",
- "libutils",
- "android.hardware.camera.device@1.0",
- "android.hardware.camera.device@3.2",
- "android.hardware.camera.device@3.3",
- "android.hardware.camera.device@3.4",
- "android.hardware.camera.device@3.5",
- "android.hardware.camera.provider@2.4",
- "android.hardware.camera.common@1.0",
- ],
+}
+
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service-lazy",
+ overrides: ["android.hardware.camera.provider@2.4-service"],
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "32",
+ init_rc: ["android.hardware.camera.provider@2.4-service-lazy.rc"],
+ cflags: ["-DLAZY_SERVICE"],
+}
+
+cc_binary {
+ name: "android.hardware.camera.provider@2.4-service-lazy_64",
+ overrides: ["android.hardware.camera.provider@2.4-service_64"],
+ defaults: ["camera_service_defaults"],
+ compile_multilib: "64",
+ init_rc: ["android.hardware.camera.provider@2.4-service-lazy_64.rc"],
+ cflags: ["-DLAZY_SERVICE"],
}
cc_binary {
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
index acdb2007a..64cf321d8 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-external-service.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4-ext /vendor/bin/hw/android.hardware.camera.provider@2.4-external-service
+ interface android.hardware.camera.provider@2.4::ICameraProvider external/0
class hal
user cameraserver
group audio camera input drmrpc usb
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
new file mode 100644
index 000000000..e8549ed82
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+ oneshot
+ disabled
+ class hal
+ user cameraserver
+ group audio camera input drmrpc
+ ioprio rt 4
+ capabilities SYS_NICE
+ writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
new file mode 100644
index 000000000..2dfac764e
--- /dev/null
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service-lazy_64.rc
@@ -0,0 +1,10 @@
+service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service-lazy_64
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
+ oneshot
+ disabled
+ class hal
+ user cameraserver
+ group audio camera input drmrpc
+ ioprio rt 4
+ capabilities SYS_NICE
+ writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
index c9196284e..913561b1f 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
class hal
user cameraserver
group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
index 4c721ecb8..fd4826ec2 100644
--- a/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
+++ b/camera/provider/2.4/default/android.hardware.camera.provider@2.4-service_64.rc
@@ -1,4 +1,5 @@
service vendor.camera-provider-2-4 /vendor/bin/hw/android.hardware.camera.provider@2.4-service_64
+ interface android.hardware.camera.provider@2.4::ICameraProvider legacy/0
class hal
user cameraserver
group audio camera input drmrpc
diff --git a/camera/provider/2.4/default/service.cpp b/camera/provider/2.4/default/service.cpp
index 7eeb6379c..15d0ea637 100644
--- a/camera/provider/2.4/default/service.cpp
+++ b/camera/provider/2.4/default/service.cpp
@@ -14,15 +14,27 @@
* limitations under the License.
*/
+#ifdef LAZY_SERVICE
+#define LOG_TAG "android.hardware.camera.provider@2.4-service-lazy"
+#else
#define LOG_TAG "android.hardware.camera.provider@2.4-service"
+#endif
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <hidl/LegacySupport.h>
#include <binder/ProcessState.h>
-using android::hardware::camera::provider::V2_4::ICameraProvider;
+using android::status_t;
+using android::hardware::defaultLazyPassthroughServiceImplementation;
using android::hardware::defaultPassthroughServiceImplementation;
+using android::hardware::camera::provider::V2_4::ICameraProvider;
+
+#ifdef LAZY_SERVICE
+const bool kLazyService = true;
+#else
+const bool kLazyService = false;
+#endif
int main()
{
@@ -30,5 +42,13 @@ int main()
// The camera HAL may communicate to other vendor components via
// /dev/vndbinder
android::ProcessState::initWithDriver("/dev/vndbinder");
- return defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0", /*maxThreads*/ 6);
+ status_t status;
+ if (kLazyService) {
+ status = defaultLazyPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+ /*maxThreads*/ 6);
+ } else {
+ status = defaultPassthroughServiceImplementation<ICameraProvider>("legacy/0",
+ /*maxThreads*/ 6);
+ }
+ return status;
}