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
This commit is contained in:
Peter Kalauskas
2018-10-05 09:03:05 -07:00
parent fad169eb33
commit 0b35cb2591
7 changed files with 72 additions and 24 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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;
}