diff --git a/powershare/PowerShare.cpp b/powershare/PowerShare.cpp index 271a900..9eadc77 100644 --- a/powershare/PowerShare.cpp +++ b/powershare/PowerShare.cpp @@ -26,7 +26,7 @@ namespace powershare { namespace V1_0 { namespace implementation { -#define WIRELESS_TX_ENABLE_PATH "/proc/wireless/enable_tx" +#define WIRELESS_TX_ENABLE_PATH "/sys/class/oplus_chg/wireless/trx_online" /* * Write value to path and close file. @@ -47,7 +47,7 @@ static T get(const std::string& path, const T& def) { } Return PowerShare::isEnabled() { - return get(WIRELESS_TX_ENABLE_PATH, "disable") != "disable"; + return get(WIRELESS_TX_ENABLE_PATH, 0) >= 1; } Return PowerShare::setEnabled(bool enable) { diff --git a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc b/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc index 5dc2fe4..ede2f21 100644 --- a/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc +++ b/powershare/vendor.lineage.powershare@1.0-service.oneplus_lahaina.rc @@ -1,3 +1,7 @@ +on init + chown system system /sys/class/oplus_chg/wireless/trx_online + chmod 0644 /sys/class/oplus_chg/wireless/trx_online + service vendor.powershare-hal-1-0 /vendor/bin/hw/vendor.lineage.powershare@1.0-service.oneplus_lahaina class hal user system diff --git a/sepolicy/vendor/hal_lineage_powershare_default.te b/sepolicy/vendor/hal_lineage_powershare_default.te new file mode 100644 index 0000000..e591663 --- /dev/null +++ b/sepolicy/vendor/hal_lineage_powershare_default.te @@ -0,0 +1,2 @@ +allow hal_lineage_powershare_default vendor_sysfs_battery_supply:dir search; +allow hal_lineage_powershare_default vendor_sysfs_battery_supply:file rw_file_perms;