Merge "Camera: binderize camera hal"

This commit is contained in:
TreeHugger Robot
2017-01-20 22:42:01 +00:00
committed by Android (Google) Code Review
6 changed files with 108 additions and 2 deletions

View File

@@ -20,3 +20,27 @@ cc_library_shared {
],
export_include_dirs: ["."]
}
cc_library_shared {
name: "android.hardware.camera.device@3.2-impl-binderized",
srcs: ["CameraDevice.cpp",
"CameraDeviceSession.cpp",
"convert.cpp"],
cppflags: ["-DBINDERIZED"],
shared_libs: [
"libhidlbase",
"libhidltransport",
"libhwbinder",
"libutils",
"libcutils",
"android.hardware.camera.device@3.2",
"android.hardware.camera.provider@2.4",
"liblog",
"libhardware",
"libcamera_metadata"
],
static_libs: [
"android.hardware.camera.common@1.0-helper"
],
export_include_dirs: ["."]
}

View File

@@ -21,3 +21,29 @@ cc_library_shared {
"android.hardware.camera.common@1.0-helper"
]
}
cc_binary {
name: "android.hardware.camera.provider@2.4-service",
relative_install_path: "hw",
srcs: ["service.cpp", "CameraProvider.cpp"],
compile_multilib: "32",
init_rc: ["android.hardware.camera.provider@2.4-service.rc"],
shared_libs: [
"libhidlbase",
"libhidltransport",
"liblog",
"libhwbinder",
"libutils",
"libhardware",
"android.hardware.camera.device@1.0",
"android.hardware.camera.device@3.2",
"android.hardware.camera.provider@2.4",
"android.hardware.camera.common@1.0",
"libcutils",
"android.hardware.camera.device@3.2-impl-binderized",
"libcamera_metadata"
],
static_libs: [
"android.hardware.camera.common@1.0-helper"
]
}

View File

@@ -17,8 +17,6 @@
#define LOG_TAG "CamProvider@2.4-impl"
#include <android/log.h>
#include <regex>
#include "CameraProvider.h"
#include "CameraDevice.h"
#include <string.h>

View File

@@ -17,6 +17,7 @@
#ifndef ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
#define ANDROID_HARDWARE_CAMERA_PROVIDER_V2_4_CAMERAPROVIDER_H
#include <regex>
#include "hardware/camera_common.h"
#include "utils/Mutex.h"
#include "utils/SortedVector.h"

View File

@@ -0,0 +1,6 @@
service camera-provider-2-4 /system/bin/hw/android.hardware.camera.provider@2.4-service
class hal
user cameraserver
group audio camera input drmrpc
ioprio rt 4
writepid /dev/cpuset/camera-daemon/tasks /dev/stune/top-app/tasks

View File

@@ -0,0 +1,51 @@
/*
* Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.camera.provider@2.4-service"
#include <android/hardware/camera/provider/2.4/ICameraProvider.h>
#include <CameraProvider.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/StrongPointer.h>
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using android::sp;
using android::hardware::camera::provider::V2_4::ICameraProvider;
using android::hardware::camera::provider::V2_4::implementation::HIDL_FETCH_ICameraProvider;
int main()
{
const char instance[] = "legacy/0";
ALOGI("Camera provider Service is starting.");
configureRpcThreadpool(1, true /* callerWillJoin */);
// TODO (b/34510650): check the passthrough/binderized dev key
sp<ICameraProvider> service = HIDL_FETCH_ICameraProvider(instance);
if (service == nullptr) {
ALOGI("Camera provider getService returned NULL");
return -1;
}
LOG_FATAL_IF(service->isRemote(), "Camera provider service is REMOTE!");
service->registerAsService(instance);
joinRpcThreadpool();
return 0;
}