sdm710-common: Import stub camera motor HAL
This commit is contained in:
parent
6e3a415bd5
commit
fd9829737d
7 changed files with 195 additions and 0 deletions
32
camera_motor/Android.bp
Normal file
32
camera_motor/Android.bp
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// Copyright (C) 2019 The LineageOS 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.
|
||||||
|
|
||||||
|
cc_binary {
|
||||||
|
relative_install_path: "hw",
|
||||||
|
defaults: ["hidl_defaults"],
|
||||||
|
name: "vendor.lineage.camera.motor@1.0-service.realme_sdm710",
|
||||||
|
init_rc: ["vendor.lineage.camera.motor@1.0-service.realme_sdm710.rc"],
|
||||||
|
srcs: ["service.cpp", "CameraMotor.cpp"],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"libhardware",
|
||||||
|
"libhidlbase",
|
||||||
|
"libhidltransport",
|
||||||
|
"liblog",
|
||||||
|
"libhwbinder",
|
||||||
|
"libutils",
|
||||||
|
"vendor.lineage.camera.motor@1.0",
|
||||||
|
],
|
||||||
|
}
|
53
camera_motor/CameraMotor.cpp
Normal file
53
camera_motor/CameraMotor.cpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 The LineageOS 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 "CameraMotorService"
|
||||||
|
|
||||||
|
#include "CameraMotor.h"
|
||||||
|
#include <android-base/logging.h>
|
||||||
|
#include <hidl/HidlTransportSupport.h>
|
||||||
|
|
||||||
|
#define CAMERA_ID_FRONT "1"
|
||||||
|
|
||||||
|
namespace vendor {
|
||||||
|
namespace lineage {
|
||||||
|
namespace camera {
|
||||||
|
namespace motor {
|
||||||
|
namespace V1_0 {
|
||||||
|
namespace implementation {
|
||||||
|
|
||||||
|
Return<void> CameraMotor::onConnect(const hidl_string& cameraId) {
|
||||||
|
if (cameraId == CAMERA_ID_FRONT) {
|
||||||
|
LOG(INFO) << "Camera is uprising.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> CameraMotor::onDisconnect(const hidl_string& cameraId) {
|
||||||
|
if (cameraId == CAMERA_ID_FRONT) {
|
||||||
|
LOG(INFO) << "Camera is descending";
|
||||||
|
}
|
||||||
|
|
||||||
|
return Void();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace implementation
|
||||||
|
} // namespace V1_0
|
||||||
|
} // namespace motor
|
||||||
|
} // namespace camera
|
||||||
|
} // namespace lineage
|
||||||
|
} // namespace vendor
|
47
camera_motor/CameraMotor.h
Normal file
47
camera_motor/CameraMotor.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 The LineageOS 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.
|
||||||
|
*/
|
||||||
|
#ifndef VENDOR_LINEAGE_CAMERA_MOTOR_V1_0_H
|
||||||
|
#define VENDOR_LINEAGE_CAMERA_MOTOR_V1_0_H
|
||||||
|
|
||||||
|
#include <vendor/lineage/camera/motor/1.0/ICameraMotor.h>
|
||||||
|
|
||||||
|
namespace vendor {
|
||||||
|
namespace lineage {
|
||||||
|
namespace camera {
|
||||||
|
namespace motor {
|
||||||
|
namespace V1_0 {
|
||||||
|
namespace implementation {
|
||||||
|
|
||||||
|
using ::android::hardware::hidl_string;
|
||||||
|
using ::android::hardware::Return;
|
||||||
|
using ::android::hardware::Void;
|
||||||
|
|
||||||
|
class CameraMotor : public ICameraMotor {
|
||||||
|
public:
|
||||||
|
CameraMotor() = default;
|
||||||
|
|
||||||
|
Return<void> onConnect(const hidl_string& cameraId) override;
|
||||||
|
Return<void> onDisconnect(const hidl_string& cameraId) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace implementation
|
||||||
|
} // namespace V1_0
|
||||||
|
} // namespace motor
|
||||||
|
} // namespace camera
|
||||||
|
} // namespace lineage
|
||||||
|
} // namespace vendor
|
||||||
|
|
||||||
|
#endif // VENDOR_LINEAGE_CAMERA_MOTOR_V1_0_H
|
50
camera_motor/service.cpp
Normal file
50
camera_motor/service.cpp
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 The LineageOS 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 "vendor.lineage.camera.motor@1.0-service.realme_sdm710"
|
||||||
|
|
||||||
|
#include <android-base/logging.h>
|
||||||
|
#include <hidl/HidlTransportSupport.h>
|
||||||
|
|
||||||
|
#include "CameraMotor.h"
|
||||||
|
|
||||||
|
using android::hardware::configureRpcThreadpool;
|
||||||
|
using android::hardware::joinRpcThreadpool;
|
||||||
|
|
||||||
|
using vendor::lineage::camera::motor::V1_0::ICameraMotor;
|
||||||
|
using vendor::lineage::camera::motor::V1_0::implementation::CameraMotor;
|
||||||
|
|
||||||
|
using android::OK;
|
||||||
|
using android::status_t;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
android::sp<ICameraMotor> service = new CameraMotor();
|
||||||
|
|
||||||
|
configureRpcThreadpool(1, true);
|
||||||
|
|
||||||
|
status_t status = service->registerAsService();
|
||||||
|
if (status != OK) {
|
||||||
|
LOG(ERROR) << "Cannot register Camera Motor HAL service.";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(INFO) << "Camera Motor HAL service ready.";
|
||||||
|
|
||||||
|
joinRpcThreadpool();
|
||||||
|
|
||||||
|
LOG(ERROR) << "FOD HAL service failed to join thread pool.";
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
service vendor.camera-motor-1-0 /system/bin/hw/vendor.lineage.camera.motor@1.0-service.realme_sdm710
|
||||||
|
interface vendor.lineage.camera.motor@1.0::ICameraMotor default
|
||||||
|
class hal
|
||||||
|
user system
|
||||||
|
group system
|
||||||
|
shutdown critical
|
|
@ -1,5 +1,6 @@
|
||||||
# Custom HALs
|
# Custom HALs
|
||||||
/system/bin/hw/android\.hardware\.light@2\.0-service\.realme_sdm710 u:object_r:hal_light_sdm710_exec:s0
|
/system/bin/hw/android\.hardware\.light@2\.0-service\.realme_sdm710 u:object_r:hal_light_sdm710_exec:s0
|
||||||
|
/system/bin/hw/vendor\.lineage\.camera\.motor@1.0-service\.realme_sdm710 u:object_r:hal_lineage_camera_motor_realme_sdm710_exec:s0
|
||||||
|
|
||||||
# Files in rootfs
|
# Files in rootfs
|
||||||
/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
|
/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
|
||||||
|
@ -7,3 +8,4 @@
|
||||||
/firmware(/.*)? u:object_r:firmware_file:s0
|
/firmware(/.*)? u:object_r:firmware_file:s0
|
||||||
/persist(/.*)? u:object_r:persist_file:s0
|
/persist(/.*)? u:object_r:persist_file:s0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
type hal_lineage_camera_motor_realme_sdm710, domain, coredomain;
|
||||||
|
hal_server_domain(hal_lineage_camera_motor_realme_sdm710, hal_lineage_camera_motor)
|
||||||
|
|
||||||
|
type hal_lineage_camera_motor_realme_sdm710_exec, exec_type, file_type;
|
||||||
|
init_daemon_domain(hal_lineage_camera_motor_realme_sdm710)
|
Loading…
Reference in a new issue