Skip to content

Commit

Permalink
sdm660-common: Enable smart charging
Browse files Browse the repository at this point in the history
* CrDroid feature
Signed-off-by: Pranav Vashi <[email protected]>
  • Loading branch information
neobuddy89 authored and Sensei-Developer committed Feb 11, 2023
1 parent e152070 commit 35a53a5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions overlay/frameworks/base/core/res/res/values/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,10 @@
user-set value if toggled by settings so the "Transition animation scale" setting
should also be hidden if intended to be permanent. -->
<item name="config_appTransitionAnimationDurationScaleDefault" format="float" type="dimen">0.5</item>

<!-- Smart charging -->
<bool name="config_smartChargingAvailable">true</bool>
<string name="config_smartChargingSysfsNode" translatable="false">/sys/class/power_supply/battery/input_suspend</string>
<string name="config_smartChargingSuspendValue" translatable="false">1</string>
<string name="config_smartChargingResumeValue" translatable="false">0</string>
</resources>
8 changes: 8 additions & 0 deletions rootdir/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,11 @@ LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.target.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := init.smartcharging.rc
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_CLASS := ETC
LOCAL_SRC_FILES := etc/init.smartcharging.rc
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/init/hw
include $(BUILD_PREBUILT)
3 changes: 3 additions & 0 deletions rootdir/etc/init.smartcharging.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
on boot
chown system system /sys/class/power_supply/battery/input_suspend
chmod 0666 /sys/class/power_supply/battery/input_suspend
3 changes: 2 additions & 1 deletion sdm660.mk
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ PRODUCT_PACKAGES += \
init.qcom.usb.sh \
init.recovery.qcom.rc \
init.target.rc \
ueventd.qcom.rc
ueventd.qcom.rc \
init.smartcharging.rc

# IRQ
PRODUCT_COPY_FILES += \
Expand Down
4 changes: 4 additions & 0 deletions sepolicy/vendor/system_server.te
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
allow system_server app_zygote:process { getpgid };
dontaudit system_server sysfs:file { read open getattr };

#smart charger
r_dir_file(system_server, sysfs_battery_supply)
allow system_server sysfs_battery_supply:file { getattr open read write };

0 comments on commit 35a53a5

Please sign in to comment.