aospa: interfaces: Add Lineage Health Service
config: device_framework_matrix: Add vendor.lineage.health Change-Id: I91ee2a15ee2f68947f220ab6e885b9049936acb2 Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com> health: Initial Lineage Health AIDL interface Change-Id: Ieea3568aba55b195d1712c439dec83c0b7da2831 health: Add default implementation Change-Id: I331689824877c30150c8b8fc2462ab41ab291333 health: Check access() return value access() returns 0 when it succeeds. Change-Id: I794457f4b0bb6de889c79a2b353549830b87c493 health: Wait for required paths indefinitely It might take a while until paths become available, thus let's just wait for them. Change-Id: I9d66f402ec5c062d42dde512b269c5402935a973 health: Only select node with RW permission Change-Id: Ic963decdc4fa6baa2defe5c31610d61d8e758164 fixup! health: Wait for required paths indefinitely Change-Id: I2c5b3bb343d4b6270aceaf83b60a576771e00a53 health: Only dump charging enabled status if toggle is supported Change-Id: Ib0aeb3391407ceb6fc0a41efaf98939b5bd428fd health: Add battery_charging_enabled node to ChargingControl node list Compared to charging_enabled node, this one is intended to disable only charging to the battery, even though power input to the board still remains (verified by measuring USB current). This node is commonly found on devices that uses QPNP SMBCHG or QPNP SMB5 charger, for example. Change-Id: I7aecc713028293253d3efaa8e5b7bf8a665bc5af soong: Add TARGET_HEALTH_CHARGING_CONTROL related configs Change-Id: I837d7b66ddc705aef3642cbc460f5636feb2b26a Co-authored-by: Fazil Sheik <fazil.sheik96@gmail.com> Change-Id: Ied7e1653ae18a0bd81c02ef24fc2aa33f9ac58f1
This commit is contained in:
parent
de3eff293a
commit
4c761a8ef0
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
aidl_interface {
|
||||
name: "vendor.lineage.health",
|
||||
vendor_available: true,
|
||||
srcs: ["vendor/lineage/health/*.aidl"],
|
||||
stability: "vintf",
|
||||
owner: "lineage",
|
||||
|
||||
backend: {
|
||||
cpp: {
|
||||
enabled: false,
|
||||
},
|
||||
java: {
|
||||
sdk_version: "module_current",
|
||||
},
|
||||
},
|
||||
versions_with_info: [
|
||||
{
|
||||
version: "1",
|
||||
imports: [],
|
||||
},
|
||||
],
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
33fe8d162b07b2c4b66feccb70a5e45628e9e241
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package vendor.lineage.health;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum ChargingControlSupportedMode {
|
||||
TOGGLE = 1,
|
||||
BYPASS = 2,
|
||||
DEADLINE = 4,
|
||||
}
|
31
interfaces/health/aidl_api/vendor.lineage.health/1/vendor/lineage/health/IChargingControl.aidl
vendored
Normal file
31
interfaces/health/aidl_api/vendor.lineage.health/1/vendor/lineage/health/IChargingControl.aidl
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package vendor.lineage.health;
|
||||
@VintfStability
|
||||
interface IChargingControl {
|
||||
boolean getChargingEnabled();
|
||||
void setChargingEnabled(in boolean enabled);
|
||||
void setChargingDeadline(in long deadline);
|
||||
int getSupportedMode();
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package vendor.lineage.health;
|
||||
@Backing(type="int") @VintfStability
|
||||
enum ChargingControlSupportedMode {
|
||||
TOGGLE = 1,
|
||||
BYPASS = 2,
|
||||
DEADLINE = 4,
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package vendor.lineage.health;
|
||||
@VintfStability
|
||||
interface IChargingControl {
|
||||
boolean getChargingEnabled();
|
||||
void setChargingEnabled(in boolean enabled);
|
||||
void setChargingDeadline(in long deadline);
|
||||
int getSupportedMode();
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
../../../../../../build/soong/scripts/system-clang-format
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
cc_binary {
|
||||
name: "vendor.lineage.health-service.default",
|
||||
defaults: ["health_charging_control_defaults"],
|
||||
vendor: true,
|
||||
relative_install_path: "hw",
|
||||
init_rc: ["vendor.lineage.health-service.default.rc"],
|
||||
vintf_fragments: ["vendor.lineage.health-service.default.xml"],
|
||||
srcs: [
|
||||
"service.cpp",
|
||||
"ChargingControl.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"vendor.lineage.health-V1-ndk",
|
||||
],
|
||||
}
|
|
@ -0,0 +1,164 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "ChargingControl.h"
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/logging.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <android/binder_status.h>
|
||||
#include <fstream>
|
||||
#include "android/binder_auto_utils.h"
|
||||
|
||||
#define LOG_TAG "vendor.lineage.health-service.default"
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace health {
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE
|
||||
static const std::vector<ChargingEnabledNode> kChargingEnabledNodes = {
|
||||
{HEALTH_CHARGING_CONTROL_CHARGING_PATH, HEALTH_CHARGING_CONTROL_CHARGING_ENABLED,
|
||||
HEALTH_CHARGING_CONTROL_CHARGING_DISABLED},
|
||||
{"/sys/class/power_supply/battery/battery_charging_enabled", "1", "0"},
|
||||
{"/sys/class/power_supply/battery/charging_enabled", "1", "0"},
|
||||
{"/sys/class/power_supply/battery/input_suspend", "0", "1"},
|
||||
{"/sys/class/qcom-battery/input_suspend", "0", "1"},
|
||||
};
|
||||
|
||||
ChargingControl::ChargingControl() : mChargingEnabledNode(nullptr) {
|
||||
while (!mChargingEnabledNode) {
|
||||
for (const auto& node : kChargingEnabledNodes) {
|
||||
if (access(node.path.c_str(), R_OK | W_OK) == 0) {
|
||||
mChargingEnabledNode = &node;
|
||||
break;
|
||||
}
|
||||
PLOG(WARNING) << "Failed to access() file " << node.path;
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ChargingControl::getChargingEnabled(bool* _aidl_return) {
|
||||
std::string content;
|
||||
if (!android::base::ReadFileToString(mChargingEnabledNode->path, &content, true)) {
|
||||
LOG(ERROR) << "Failed to read current charging enabled value";
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
content = android::base::Trim(content);
|
||||
|
||||
if (content == mChargingEnabledNode->value_true) {
|
||||
*_aidl_return = true;
|
||||
} else if (content == mChargingEnabledNode->value_false) {
|
||||
*_aidl_return = false;
|
||||
} else {
|
||||
LOG(ERROR) << "Unknown value " << content;
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ChargingControl::setChargingEnabled(bool enabled) {
|
||||
const auto& value =
|
||||
enabled ? mChargingEnabledNode->value_true : mChargingEnabledNode->value_false;
|
||||
if (!android::base::WriteStringToFile(value, mChargingEnabledNode->path, true)) {
|
||||
LOG(ERROR) << "Failed to write to charging enable node: " << strerror(errno);
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
#else
|
||||
ndk::ScopedAStatus ChargingControl::getChargingEnabled(bool* /* _aidl_return */) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ChargingControl::setChargingEnabled(bool /* enabled */) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE
|
||||
static const std::vector<std::string> kChargingDeadlineNodes = {
|
||||
HEALTH_CHARGING_CONTROL_DEADLINE_PATH,
|
||||
"/sys/class/power_supply/battery/charge_deadline",
|
||||
};
|
||||
|
||||
ChargingControl::ChargingControl() : mChargingDeadlineNode(nullptr) {
|
||||
while (!mChargingDeadlineNode) {
|
||||
for (const auto& node : kChargingDeadlineNodes) {
|
||||
if (access(node.c_str(), R_OK | W_OK) == 0) {
|
||||
mChargingDeadlineNode = &node;
|
||||
break;
|
||||
}
|
||||
PLOG(WARNING) << "Failed to access() file " << node;
|
||||
usleep(100000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ndk::ScopedAStatus ChargingControl::setChargingDeadline(int64_t deadline) {
|
||||
std::string content = std::to_string(deadline);
|
||||
if (!android::base::WriteStringToFile(content, *mChargingDeadlineNode, true)) {
|
||||
LOG(ERROR) << "Failed to write to charging deadline node: " << strerror(errno);
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
|
||||
}
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
#else
|
||||
ndk::ScopedAStatus ChargingControl::setChargingDeadline(int64_t /* deadline */) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
|
||||
}
|
||||
#endif
|
||||
|
||||
ndk::ScopedAStatus ChargingControl::getSupportedMode(int* _aidl_return) {
|
||||
int mode = 0;
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE
|
||||
mode |= static_cast<int>(ChargingControlSupportedMode::TOGGLE);
|
||||
#endif
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS
|
||||
mode |= static_cast<int>(ChargingControlSupportedMode::BYPASS);
|
||||
#endif
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE
|
||||
mode |= static_cast<int>(ChargingControlSupportedMode::DEADLINE);
|
||||
#endif
|
||||
|
||||
*_aidl_return = mode;
|
||||
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
binder_status_t ChargingControl::dump(int fd, const char** /* args */, uint32_t /* numArgs */) {
|
||||
bool isChargingEnabled;
|
||||
int supportedMode;
|
||||
getChargingEnabled(&isChargingEnabled);
|
||||
getSupportedMode(&supportedMode);
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE
|
||||
dprintf(fd, "Charging control node selected: %s\n", mChargingEnabledNode->path.c_str());
|
||||
dprintf(fd, "Charging enabled: %s\n", isChargingEnabled ? "true" : "false");
|
||||
#endif
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE
|
||||
dprintf(fd, "Charging deadline node selected: %s\n", mChargingDeadlineNode->c_str());
|
||||
#endif
|
||||
|
||||
dprintf(fd, "Charging control supported mode: %d\n", supportedMode);
|
||||
|
||||
return STATUS_OK;
|
||||
}
|
||||
|
||||
} // namespace health
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/vendor/lineage/health/BnChargingControl.h>
|
||||
#include <aidl/vendor/lineage/health/ChargingControlSupportedMode.h>
|
||||
#include <android/binder_status.h>
|
||||
#include <string>
|
||||
#include "android/binder_auto_utils.h"
|
||||
|
||||
namespace aidl {
|
||||
namespace vendor {
|
||||
namespace lineage {
|
||||
namespace health {
|
||||
|
||||
struct ChargingEnabledNode {
|
||||
const std::string path;
|
||||
const std::string value_true;
|
||||
const std::string value_false;
|
||||
};
|
||||
|
||||
struct ChargingControl : public BnChargingControl {
|
||||
ChargingControl();
|
||||
|
||||
ndk::ScopedAStatus getChargingEnabled(bool* _aidl_return) override;
|
||||
ndk::ScopedAStatus setChargingEnabled(bool enabled) override;
|
||||
ndk::ScopedAStatus setChargingDeadline(int64_t deadline) override;
|
||||
ndk::ScopedAStatus getSupportedMode(int* _aidl_return) override;
|
||||
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
|
||||
|
||||
private:
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE
|
||||
const ChargingEnabledNode* mChargingEnabledNode;
|
||||
#endif
|
||||
|
||||
#ifdef HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE
|
||||
const std::string* mChargingDeadlineNode;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace health
|
||||
} // namespace lineage
|
||||
} // namespace vendor
|
||||
} // namespace aidl
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "ChargingControl.h"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/binder_manager.h>
|
||||
#include <android/binder_process.h>
|
||||
|
||||
using ::aidl::vendor::lineage::health::ChargingControl;
|
||||
|
||||
int main() {
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
||||
std::shared_ptr<ChargingControl> lh = ndk::SharedRefBase::make<ChargingControl>();
|
||||
|
||||
const std::string instance = std::string() + ChargingControl::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(lh->asBinder().get(), instance.c_str());
|
||||
CHECK_EQ(status, STATUS_OK);
|
||||
|
||||
ABinderProcess_joinThreadPool();
|
||||
return EXIT_FAILURE; // should not reach
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
service vendor.lineage_health /vendor/bin/hw/vendor.lineage.health-service.default
|
||||
class hal
|
||||
user system
|
||||
group system
|
|
@ -0,0 +1,6 @@
|
|||
<manifest version="1.0" type="device">
|
||||
<hal format="aidl">
|
||||
<name>vendor.lineage.health</name>
|
||||
<fqname>IChargingControl/default</fqname>
|
||||
</hal>
|
||||
</manifest>
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package vendor.lineage.health;
|
||||
|
||||
@Backing(type="int") @VintfStability
|
||||
enum ChargingControlSupportedMode {
|
||||
/**
|
||||
* The device supports control charging through an on/off toggle.
|
||||
*/
|
||||
TOGGLE = 1 << 0,
|
||||
|
||||
/**
|
||||
* The device allows battery bypass when charging stops.
|
||||
*/
|
||||
BYPASS = 1 << 1,
|
||||
|
||||
/**
|
||||
* The device supports control charging by specifying the deadline
|
||||
*/
|
||||
DEADLINE = 1 << 2,
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2023 The LineageOS Project
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package vendor.lineage.health;
|
||||
|
||||
@VintfStability
|
||||
interface IChargingControl {
|
||||
/**
|
||||
* Get battery charging enablement status.
|
||||
* Note that this only returns whether charging should be enabled or not when a charger
|
||||
* is plugged, not if the battery is actually charging.
|
||||
*
|
||||
* @return whether if battery charging is enabled.
|
||||
* If error:
|
||||
* - Return exception with code EX_ILLEGAL_STATE
|
||||
* if the value can't be determined from the driver.
|
||||
* - Return service specific error with code STATUS_UNKNOWN
|
||||
* for other errors.
|
||||
*/
|
||||
boolean getChargingEnabled();
|
||||
|
||||
/**
|
||||
* Set battery charging enabled.
|
||||
*
|
||||
* @return nothing if successful.
|
||||
* If error:
|
||||
* - Return service specific error with code STATUS_UNKNOWN
|
||||
* for other errors.
|
||||
*/
|
||||
void setChargingEnabled(in boolean enabled);
|
||||
|
||||
/**
|
||||
* Sets the charging control deadline, if deadline mode is supported.
|
||||
*
|
||||
* @return nothing if successful.
|
||||
* If error:
|
||||
* - Return service specific error with code STATUS_UNKNOWN
|
||||
* for other errors.
|
||||
*/
|
||||
void setChargingDeadline(in long deadline);
|
||||
|
||||
/**
|
||||
* Get the device's supported charging control mode.
|
||||
*
|
||||
* @return a bitmask of ChargingControlSupportedMode.
|
||||
*/
|
||||
int getSupportedMode();
|
||||
}
|
|
@ -2,3 +2,6 @@ binder_use(platform_app)
|
|||
|
||||
# Allow PowerShare HAL service to be found
|
||||
hal_client_domain(platform_app, hal_aospa_powershare)
|
||||
|
||||
# Allow LineageHealth HAL service to be found
|
||||
hal_client_domain(platform_app, hal_lineage_health)
|
||||
|
|
|
@ -3,3 +3,6 @@ type dc_dimming_service, system_api_service, system_server_service, service_mana
|
|||
|
||||
# Pocket Judge
|
||||
type pocket_service, system_api_service, system_server_service, service_manager_type;
|
||||
|
||||
# Lineage
|
||||
type lineage_health_interface_service, system_api_service, system_server_service, service_manager_type;
|
||||
|
|
|
@ -6,3 +6,6 @@ dc_dim u:object_r:dc_dimming_service:s0
|
|||
|
||||
# Pocket Judge
|
||||
pocket u:object_r:pocket_service:s0
|
||||
|
||||
# Lineage
|
||||
lineagehealth u:object_r:lineage_health_interface_service:s0
|
||||
|
|
|
@ -12,3 +12,6 @@ set_prop(system_server, device_config_tethering_prop)
|
|||
|
||||
# Powershare
|
||||
hal_client_domain(system_server, hal_aospa_powershare)
|
||||
|
||||
# Lineage
|
||||
hal_client_domain(system_server, hal_lineage_health)
|
||||
|
|
|
@ -5,3 +5,10 @@ attribute hal_aospa_powershare_client;
|
|||
expandattribute hal_aospa_powershare_client true;
|
||||
attribute hal_aospa_powershare_server;
|
||||
expandattribute hal_aospa_powershare_server false;
|
||||
attribute hal_lineage_health;
|
||||
expandattribute hal_lineage_health true;
|
||||
attribute hal_lineage_health_client;
|
||||
expandattribute hal_lineage_health_client true;
|
||||
attribute hal_lineage_health_server;
|
||||
expandattribute hal_lineage_health_server false;
|
||||
|
||||
|
|
|
@ -6,3 +6,6 @@
|
|||
|
||||
# Usb
|
||||
/(vendor|system/vendor)/bin/hw/android\.hardware\.usb@1\.0-service\.basic u:object_r:hal_usb_default_exec:s0
|
||||
|
||||
# Health HAL
|
||||
/(vendor|system/vendor)/bin/hw/vendor\.lineage\.health-service\.default u:object_r:hal_lineage_health_default_exec:s0
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# HwBinder IPC from client to server
|
||||
binder_call(hal_lineage_health_client, hal_lineage_health_server)
|
||||
|
||||
hal_attribute_service(hal_lineage_health, hal_lineage_health_service)
|
||||
binder_call(hal_lineage_health_server, servicemanager)
|
||||
allow hal_lineage_health_client hal_lineage_health_service:service_manager find;
|
||||
|
||||
# Allow binder communication with platform_app
|
||||
binder_call(hal_lineage_health, platform_app)
|
|
@ -0,0 +1,13 @@
|
|||
type hal_lineage_health_default, domain;
|
||||
hal_server_domain(hal_lineage_health_default, hal_lineage_health)
|
||||
|
||||
type hal_lineage_health_default_exec, exec_type, vendor_file_type, file_type;
|
||||
init_daemon_domain(hal_lineage_health_default)
|
||||
|
||||
binder_call(hal_lineage_health_default, servicemanager);
|
||||
|
||||
# Allow LineageHealth HAL to write to battery and usb sysfs node
|
||||
allow hal_lineage_health_default vendor_sysfs_battery_supply:dir search;
|
||||
allow hal_lineage_health_default vendor_sysfs_battery_supply:file rw_file_perms;
|
||||
allow hal_lineage_health_default vendor_sysfs_usb_supply:dir search;
|
||||
allow hal_lineage_health_default vendor_sysfs_usb_supply:file rw_file_perms;
|
|
@ -1 +1,2 @@
|
|||
type hal_aospa_powershare_service, service_manager_type, hal_service_type;
|
||||
type hal_lineage_health_service, service_manager_type, hal_service_type;
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
vendor.aospa.powershare.IPowerShare/default u:object_r:hal_aospa_powershare_service:s0
|
||||
vendor.lineage.health.IChargingControl/default u:object_r:hal_lineage_health_service:s0
|
||||
|
|
|
@ -25,6 +25,51 @@ soong_config_module_type {
|
|||
properties: ["cppflags"],
|
||||
}
|
||||
|
||||
soong_config_module_type {
|
||||
name: "health_charging_control",
|
||||
module_type: "cc_defaults",
|
||||
config_namespace: "aospaGlobalVars",
|
||||
bool_variables: [
|
||||
"target_health_charging_control_supports_toggle",
|
||||
"target_health_charging_control_supports_bypass",
|
||||
"target_health_charging_control_supports_deadline",
|
||||
],
|
||||
value_variables: [
|
||||
"target_health_charging_control_charging_path",
|
||||
"target_health_charging_control_charging_enabled",
|
||||
"target_health_charging_control_charging_disabled",
|
||||
"target_health_charging_control_deadline_path",
|
||||
],
|
||||
properties: ["cppflags"],
|
||||
}
|
||||
|
||||
health_charging_control {
|
||||
name: "health_charging_control_defaults",
|
||||
soong_config_variables: {
|
||||
target_health_charging_control_supports_toggle: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE"],
|
||||
},
|
||||
target_health_charging_control_supports_bypass: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS"],
|
||||
},
|
||||
target_health_charging_control_supports_deadline: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE"],
|
||||
},
|
||||
target_health_charging_control_charging_path: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_PATH=\"%s\""],
|
||||
},
|
||||
target_health_charging_control_charging_enabled: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_ENABLED=\"%s\""],
|
||||
},
|
||||
target_health_charging_control_charging_disabled: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_CHARGING_DISABLED=\"%s\""],
|
||||
},
|
||||
target_health_charging_control_deadline_path: {
|
||||
cppflags: ["-DHEALTH_CHARGING_CONTROL_DEADLINE_PATH=\"%s\""],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
powershare_node {
|
||||
name: "powershare_node_defaults",
|
||||
soong_config_variables: {
|
||||
|
|
|
@ -20,12 +20,24 @@ SOONG_CONFIG_aospaGlobalVars += \
|
|||
needs_camera_boottime \
|
||||
powershare_node \
|
||||
target_camera_package_name \
|
||||
target_health_charging_control_charging_path \
|
||||
target_health_charging_control_charging_enabled \
|
||||
target_health_charging_control_charging_disabled \
|
||||
target_health_charging_control_deadline_path \
|
||||
target_health_charging_control_supports_bypass \
|
||||
target_health_charging_control_supports_deadline \
|
||||
target_health_charging_control_supports_toggle \
|
||||
target_init_vendor_lib \
|
||||
target_ld_shim_libs \
|
||||
target_process_sdk_version_override \
|
||||
target_surfaceflinger_udfps_lib
|
||||
|
||||
# Set default values
|
||||
TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED ?= 1
|
||||
TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED ?= 0
|
||||
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS ?= true
|
||||
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE ?= false
|
||||
TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE ?= true
|
||||
TARGET_INIT_VENDOR_LIB ?= vendor_init
|
||||
TARGET_SURFACEFLINGER_UDFPS_LIB ?= surfaceflinger_udfps_lib
|
||||
|
||||
|
@ -37,6 +49,13 @@ SOONG_CONFIG_aospaGlobalVars_target_init_vendor_lib := $(TARGET_INIT_VENDOR_LIB)
|
|||
SOONG_CONFIG_aospaGlobalVars_target_ld_shim_libs := $(subst $(space),:,$(TARGET_LD_SHIM_LIBS))
|
||||
SOONG_CONFIG_aospaGlobalVars_target_process_sdk_version_override := $(TARGET_PROCESS_SDK_VERSION_OVERRIDE)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_surfaceflinger_udfps_lib := $(TARGET_SURFACEFLINGER_UDFPS_LIB)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_charging_path := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_PATH)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_charging_enabled := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_ENABLED)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_charging_disabled := $(TARGET_HEALTH_CHARGING_CONTROL_CHARGING_DISABLED)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_deadline_path := $(TARGET_HEALTH_CHARGING_CONTROL_DEADLINE_PATH)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_supports_bypass := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_BYPASS)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_supports_deadline := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_DEADLINE)
|
||||
SOONG_CONFIG_aospaGlobalVars_target_health_charging_control_supports_toggle := $(TARGET_HEALTH_CHARGING_CONTROL_SUPPORTS_TOGGLE)
|
||||
|
||||
# Gestures
|
||||
define add-gesturevar-if-exist
|
||||
|
|
|
@ -29,4 +29,11 @@
|
|||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.lineage.health</name>
|
||||
<interface>
|
||||
<name>IChargingControl</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2023 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.
|
||||
-->
|
||||
|
||||
<permissions>
|
||||
<!-- The feature listed here coincides with the HealthInterfaceService declared as
|
||||
part of the external lineage service init in SystemServer. If this xml isn't present
|
||||
on the device, the service will not be published as a binder service!
|
||||
-->
|
||||
<feature name="org.lineageos.health" />
|
||||
</permissions>
|
|
@ -167,7 +167,8 @@ PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
|||
# Permissions
|
||||
PRODUCT_COPY_FILES += \
|
||||
vendor/aospa/target/config/permissions/default_permissions_com.google.android.deskclock.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/default-permissions/default_permissions_com.google.android.deskclock.xml \
|
||||
vendor/aospa/target/config/permissions/privapp-permissions-hotword.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-hotword.xml
|
||||
vendor/aospa/target/config/permissions/privapp-permissions-hotword.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/privapp-permissions-hotword.xml \
|
||||
vendor/aospa/target/config/permissions/org.lineageos.health.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/permissions/org.lineageos.health.xml
|
||||
|
||||
# Privapp-permissions
|
||||
PRODUCT_SYSTEM_EXT_PROPERTIES += \
|
||||
|
|
Loading…
Reference in New Issue