Drop powershare HIDL

There is a default lineage service now which can be used instead

Change-Id: I75807614d0af63ff077cb02655dd482c5623c6f7
This commit is contained in:
Arian 2024-09-01 15:50:32 +02:00 committed by Bruno Martins
parent 40728c3a73
commit 7bc51fe4b0
6 changed files with 0 additions and 194 deletions

View File

@ -1,46 +0,0 @@
//
// Copyright (C) 2020 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
soong_config_module_type {
name: "xiaomi_powershare_hal_cc_defaults",
module_type: "cc_defaults",
config_namespace: "XIAOMI_POWERSHARE",
value_variables: ["WIRELESS_TX_ENABLE_PATH"],
properties: ["cppflags"],
}
xiaomi_powershare_hal_cc_defaults {
name: "xiaomi_powershare_hal_defaults",
soong_config_variables: {
WIRELESS_TX_ENABLE_PATH: {
cppflags: ["-DWIRELESS_TX_ENABLE_PATH=\"%s\""],
},
},
}
cc_binary {
name: "vendor.lineage.powershare@1.0-service.xiaomi",
defaults: [
"hidl_defaults",
"xiaomi_powershare_hal_defaults",
],
relative_install_path: "hw",
init_rc: ["vendor.lineage.powershare@1.0-service.xiaomi.rc"],
vintf_fragments: ["vendor.lineage.powershare@1.0-service.xiaomi.xml"],
srcs: [
"service.cpp",
"PowerShare.cpp",
],
shared_libs: [
"libbase",
"libhardware",
"libhidlbase",
"liblog",
"libutils",
"vendor.lineage.powershare@1.0",
],
proprietary: true,
}

View File

@ -1,60 +0,0 @@
/*
* Copyright (C) 2020 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "PowerShareService"
#include "PowerShare.h"
#include <hidl/HidlTransportSupport.h>
#include <fstream>
namespace vendor {
namespace lineage {
namespace powershare {
namespace V1_0 {
namespace implementation {
/*
* Write value to path and close file.
*/
template <typename T>
static void set(const std::string& path, const T& value) {
std::ofstream file(path);
file << value;
}
template <typename T>
static T get(const std::string& path, const T& def) {
std::ifstream file(path);
T result;
file >> result;
return file.fail() ? def : result;
}
Return<bool> PowerShare::isEnabled() {
const auto value = get<std::string>(WIRELESS_TX_ENABLE_PATH, "0");
return !(value == "disable" || value == "0");
}
Return<bool> PowerShare::setEnabled(bool enable) {
set(WIRELESS_TX_ENABLE_PATH, enable ? 1 : 0);
return isEnabled();
}
Return<uint32_t> PowerShare::getMinBattery() {
return 0;
}
Return<uint32_t> PowerShare::setMinBattery(uint32_t) {
return getMinBattery();
}
} // namespace implementation
} // namespace V1_0
} // namespace powershare
} // namespace lineage
} // namespace vendor

View File

@ -1,33 +0,0 @@
/*
* Copyright (C) 2020-2022 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <vendor/lineage/powershare/1.0/IPowerShare.h>
namespace vendor {
namespace lineage {
namespace powershare {
namespace V1_0 {
namespace implementation {
using ::android::sp;
using ::android::hardware::Return;
using ::android::hardware::Void;
class PowerShare : public IPowerShare {
public:
Return<bool> isEnabled() override;
Return<bool> setEnabled(bool enable) override;
Return<uint32_t> getMinBattery() override;
Return<uint32_t> setMinBattery(uint32_t minBattery) override;
};
} // namespace implementation
} // namespace V1_0
} // namespace powershare
} // namespace lineage
} // namespace vendor

View File

@ -1,40 +0,0 @@
/*
* Copyright (C) 2020 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.powershare@1.0-service.xiaomi"
#include <android-base/logging.h>
#include <hidl/HidlTransportSupport.h>
#include "PowerShare.h"
using android::hardware::configureRpcThreadpool;
using android::hardware::joinRpcThreadpool;
using vendor::lineage::powershare::V1_0::IPowerShare;
using vendor::lineage::powershare::V1_0::implementation::PowerShare;
using android::OK;
using android::status_t;
int main() {
android::sp<IPowerShare> service = new PowerShare();
configureRpcThreadpool(1, true);
status_t status = service->registerAsService();
if (status != OK) {
LOG(ERROR) << "Cannot register PowerShare HAL service.";
return 1;
}
LOG(INFO) << "PowerShare HAL service ready.";
joinRpcThreadpool();
LOG(ERROR) << "PowerShare HAL service failed to join thread pool.";
return 1;
}

View File

@ -1,4 +0,0 @@
service vendor.powershare-hal-1-0 /vendor/bin/hw/vendor.lineage.powershare@1.0-service.xiaomi
class hal
user system
group system

View File

@ -1,11 +0,0 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.powershare</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IPowerShare</name>
<instance>default</instance>
</interface>
</hal>
</manifest>