1
0
Fork 0

Add device tree for Orange Pi 5 Ultra LineageOS ATV

This commit is contained in:
Brendan Szymanski 2026-07-10 17:56:31 -04:00
parent ff9874b632
commit ae84f8e65e
147 changed files with 7890 additions and 1 deletions

59
health/Android.bp Normal file
View file

@ -0,0 +1,59 @@
// Copyright (C) 2018 The Android Open Source Project
// Copyright (C) 2023 KonstaKANG
// Copyright (C) 2025 Venkata Atchuta Bheemeswara Sarma Darbha
//
// SPDX-License-Identifier: Apache-2.0
cc_binary {
name: "android.hardware.health-service.opi",
relative_install_path: "hw",
vendor: true,
srcs: [
"HealthImpl.cpp",
"main.cpp",
],
static_libs: [
"libbatterymonitor",
"libhealth_aidl_impl",
"libhealthloop",
],
shared_libs: [
"android.hardware.health-V4-ndk",
"libbase",
"libbinder_ndk",
"libcutils",
"liblog",
"libutils",
],
overrides: ["charger"],
installable: false,
}
prebuilt_etc {
name: "android.hardware.health-service.opi.rc",
src: "android.hardware.health-service.opi.rc",
installable: false,
}
prebuilt_etc {
name: "android.hardware.health-service.opi.xml",
src: "android.hardware.health-service.opi.xml",
sub_dir: "vintf",
installable: false,
}
apex {
name: "com.android.hardware.health.opi5",
manifest: "apex_manifest.json",
file_contexts: "apex_file_contexts",
key: "com.android.hardware.key",
certificate: ":com.android.hardware.certificate",
updatable: false,
vendor: true,
binaries: ["android.hardware.health-service.opi"],
prebuilts: [
"android.hardware.health-service.opi.rc",
"android.hardware.health-service.opi.xml",
],
}

82
health/HealthImpl.cpp Normal file
View file

@ -0,0 +1,82 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* 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.
*/
#include "HealthImpl.h"
using ::aidl::android::hardware::health::BatteryHealth;
using ::aidl::android::hardware::health::BatteryStatus;
using ::aidl::android::hardware::health::HealthInfo;
namespace aidl::android::hardware::health {
void HealthImpl::UpdateHealthInfo(HealthInfo* health_info) {
health_info->chargerAcOnline = true;
health_info->chargerUsbOnline = true;
health_info->chargerWirelessOnline = false;
health_info->chargerDockOnline = false;
health_info->maxChargingCurrentMicroamps = 500000;
health_info->maxChargingVoltageMicrovolts = 5000000;
health_info->batteryStatus = BatteryStatus::FULL;
health_info->batteryHealth = BatteryHealth::GOOD;
health_info->batteryPresent = true;
health_info->batteryLevel = 100;
health_info->batteryVoltageMillivolts = 5000;
health_info->batteryTemperatureTenthsCelsius = 250;
health_info->batteryCurrentMicroamps = 500000;
health_info->batteryCycleCount = 25;
health_info->batteryFullChargeUah = 5000000;
health_info->batteryChargeCounterUah = 5000000;
health_info->batteryTechnology = "Li-ion";
health_info->batteryCapacityLevel = BatteryCapacityLevel::FULL;
health_info->batteryFullChargeDesignCapacityUah = 5000000;
}
ndk::ScopedAStatus HealthImpl::getChargeCounterUah(int32_t* out) {
*out = 5000000;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus HealthImpl::getCurrentNowMicroamps(int32_t* out) {
*out = 500000;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus HealthImpl::getCurrentAverageMicroamps(int32_t*) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
ndk::ScopedAStatus HealthImpl::getCapacity(int32_t* out) {
*out = 100;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus HealthImpl::getChargeStatus(BatteryStatus* out) {
*out = BatteryStatus::FULL;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus HealthImpl::getBatteryHealthData(BatteryHealthData* out) {
out->batteryManufacturingDateSeconds = 1231006505;
out->batteryFirstUsageSeconds = 1231469665;
out->batteryStateOfHealth = 99;
out->batterySerialNumber =
"000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
out->batteryPartStatus = BatteryPartStatus::ORIGINAL;
return ndk::ScopedAStatus::ok();
}
} // namespace aidl::android::hardware::health

42
health/HealthImpl.h Normal file
View file

@ -0,0 +1,42 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* 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.
*/
#pragma once
#include <health-impl/Health.h>
using ::aidl::android::hardware::health::Health;
namespace aidl::android::hardware::health {
class HealthImpl : public Health {
public:
using Health::Health;
virtual ~HealthImpl() {}
ndk::ScopedAStatus getChargeCounterUah(int32_t* out) override;
ndk::ScopedAStatus getCurrentNowMicroamps(int32_t* out) override;
ndk::ScopedAStatus getCurrentAverageMicroamps(int32_t* out) override;
ndk::ScopedAStatus getCapacity(int32_t* out) override;
ndk::ScopedAStatus getChargeStatus(BatteryStatus* out) override;
ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* out) override;
protected:
void UpdateHealthInfo(HealthInfo* health_info) override;
};
} // namespace aidl::android::hardware::health

View file

@ -0,0 +1,6 @@
service vendor.health-opi /apex/com.android.hardware.health.opi5/bin/hw/android.hardware.health-service.opi
class hal
user system
group system
capabilities WAKE_ALARM BLOCK_SUSPEND
file /dev/kmsg w

View file

@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
<version>4</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>

View file

@ -0,0 +1,3 @@
(/.*)? u:object_r:vendor_file:s0
/etc(/.*)? u:object_r:vendor_configs_file:s0
/bin/hw/android\.hardware\.health-service\.opi u:object_r:hal_health_default_exec:s0

View file

@ -0,0 +1,4 @@
{
"name": "com.android.hardware.health.opi5",
"version": 1
}

32
health/main.cpp Normal file
View file

@ -0,0 +1,32 @@
/*
* Copyright (C) 2021 The Android Open Source Project
* Copyright (C) 2023 KonstaKANG
*
* 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.
*/
#include "HealthImpl.h"
#include <android/binder_interface_utils.h>
#include <health/utils.h>
using ::aidl::android::hardware::health::HalHealthLoop;
using ::aidl::android::hardware::health::HealthImpl;
int main() {
auto config = std::make_unique<healthd_config>();
android::hardware::health::InitHealthdConfig(config.get());
auto binder = ndk::SharedRefBase::make<HealthImpl>("default", std::move(config));
auto hal_health_loop = std::make_shared<HalHealthLoop>(binder, binder);
return hal_health_loop->StartLoop();
}