From 18e033d2cd3abbfeceaeae001b34c3d24c346f00 Mon Sep 17 00:00:00 2001 From: VR-25 <28943176+VR-25@users.noreply.github.com> Date: Sat, 8 Jan 2022 08:27:09 +0100 Subject: [PATCH] **v2022.1.8 (202201080)** - `acc -p` finds even more potential switches; - Enhanced charging status detection; - General fixes & optimizations; - Improved idle mode support; - New charging switches; - Optimize system performance and battery utilization, by forcing `bg-dexopt-job` on daemon [re]start, if charging; - Support for Qualcomm SnapDragon 8 Gen 1 devices, Nokia 2.2 and more; - Updated documentation. --- META-INF/com/google/android/update-binary | 8 +++-- README.html | 38 +++++++++++++++++------ README.md | 32 +++++++++++++------ acc/acc.sh | 10 +++--- acc/accd.sh | 13 +++++--- acc/batt-info.sh | 25 ++++++--------- acc/batt-interface.sh | 22 ++++++++----- acc/ctrl-files.sh | 6 ++++ acc/default-config.txt | 3 +- acc/misc-functions.sh | 38 +++++++++++++++++------ acc/oem-custom.sh | 8 +++++ acc/post-fs-data.sh | 12 ------- acc/read-ch-curr-ctrl-files-p2.sh | 5 +-- acc/strings.sh | 5 +-- acc/translations/id/strings.sh | 4 --- build.sh | 11 ++++--- customize.sh | 8 +++-- install.sh | 8 +++-- module.prop | 4 +-- 19 files changed, 160 insertions(+), 100 deletions(-) delete mode 100644 acc/post-fs-data.sh diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index 81587b4..919aa61 100644 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -1,6 +1,6 @@ #!/system/bin/sh # $id Installer/Upgrader -# Copyright 2019-2021, VR25 +# Copyright 2019-2022, VR25 # License: GPLv3+ # # devs: triple hashtags (###) mark non-generic code @@ -146,7 +146,7 @@ fi ### echo "$name $version ($versionCode) -Copyright 2017-2021, $author +Copyright 2017-2022, $author GPLv3+ (i) Installing in $installDir/$id/..." @@ -280,4 +280,8 @@ esac # initialize $id /data/adb/$domain/$id/service.sh --init +[ $(date +%m%d) -gt 110 ] || su -lp 2000 -c "/system/bin/cmd notification post -S bigtext -t 'ACC' 'Tag' \"Happy New Year!\"" < /dev/null > /dev/null 2>&1 + +rm $data_dir/curr $data_dir/warn 2>/dev/null ### + exit 0 diff --git a/README.html b/README.html index ce12860..41d4930 100644 --- a/README.html +++ b/README.html @@ -125,7 +125,7 @@

DESCRIPTION

The installation is always "systemless", whether or not the system is rooted with Magisk.


LICENSE

-

Copyright 2017-2021, VR25

+

Copyright 2017-2022, VR25

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or @@ -284,7 +284,7 @@

Notes

DEFAULT CONFIGURATION

#DC# -configVerCode=202111030 +configVerCode=202201010 capacity=(-1 60 70 75 false false) temperature=(40 60 90 65) cooldownRatio=() @@ -461,7 +461,6 @@

DEFAULT CONFIGURATION

# shutdown_capacity (sc) # # When the battery is discharging and its capacity/voltage_now_millivolts <= sc and phone has been running for 15 minutes or more, acc daemon turns the phone off to reduce the discharge rate and protect the battery from potential damage induced by voltage below the operating range. # sc=-1 disables it. -# [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc + 5% or sc + 100 mV. # cooldown_capacity (cc) # # Capacity/voltage_now_millivolts at which the cooldown cycle starts. @@ -770,6 +769,7 @@

Terminal Commands

acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " " - MTK only) -t|--test [file] Test charging switches from a file (default: /dev/.vr25/acc/ch-switches) + Control files that trigger reboots or kernel panics are automatically backlisted e.g., acc -t (test known switches) acc -t /sdcard/experimental_switches.txt (test custom/foreign switches) @@ -1016,7 +1016,19 @@

Diagnostics/Logs

The logs do not contain any personal information and are never automatically sent to the developer. Automatic exporting (local) happens under specific conditions (refer back to SETUP/USAGE > Terminal Commands > Exit Codes).

Finding Additional/Potential Charging Switches Quickly

-

Refer to (search for) the --parse option in the terminal commands section.

+
    +
  1. +

    Generate a list of potential charging switches: acc -p > /sdcard/acc-p.txt.

    +
  2. +
  3. +

    Remove from the list, all lines that you're SURE don't resemble a charging switch.

    +
  4. +
  5. +

    Test all: acc -t /sdcard/acc-p.txt.

    +
  6. +
+

Note that some control files may trigger reboots or kernel panics. +ACC automatically blacklists these, so that the user can continue testing (step 2) after each reboot.

Install, Upgrade, Stop and Restart Processes Seem to Take Too Long

The daemon stop process implies complete reversal of changes made to the charging management system. Sometimes, this requires the charger to be plugged. @@ -1161,6 +1173,7 @@

FREQUENTLY ASKED QUESTIONS (FAQ)

With modern battery management systems, that's generally unnecessary.

However, if your battery is underperforming, you may want to try the procedure described at https://batteryuniversity.com/article/bu-603-how-to-calibrate-a-smart-battery .

+

ACC automatically optimizes system performance and battery utilization, by forcing bg-dexopt-job on daemon [re]start, if charging.

I set voltage to 4080 mV and that corresponds to just about 75% charge. But is it typically safer to let charging keep running, or to have the circuits turn on and shut off between defined percentage levels repeatedly?

@@ -1243,12 +1256,6 @@

LATEST CHANGES

-

v2021.11.3 (202111030)

-
    -
  • Fixed installation issues
  • -
  • Improved support for the current Magisk canary.
  • -
  • Shutdown warning notifications (mV) are now posted at shutdown_capacity + 100mV (formerly 200).
  • -

v2021.12.14 (202112140)

  • Additional charging switches;
  • @@ -1269,6 +1276,17 @@

    LATEST CHANGES

  • [ctrl-files]: added battery/op_disable_charge 0 1 switch;
  • [README]: updated troubleshooting section;
  • General optimizations.
  • +
+

v2022.1.8 (202201080)

+
    +
  • acc -p finds even more potential switches;
  • +
  • Enhanced charging status detection;
  • +
  • General fixes & optimizations;
  • +
  • Improved idle mode support;
  • +
  • New charging switches;
  • +
  • Optimize system performance and battery utilization, by forcing bg-dexopt-job on daemon [re]start, if charging;
  • +
  • Support for Qualcomm SnapDragon 8 Gen 1 devices, Nokia 2.2 and more;
  • +
  • Updated documentation.
diff --git a/README.md b/README.md index 31162e3..63381bc 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ The installation is always "systemless", whether or not the system is rooted wit --- ## LICENSE -Copyright 2017-2021, VR25 +Copyright 2017-2022, VR25 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -241,7 +241,7 @@ In interactive mode, it also asks the user whether they want to download and ins ``` #DC# -configVerCode=202111030 +configVerCode=202201010 capacity=(-1 60 70 75 false false) temperature=(40 60 90 65) cooldownRatio=() @@ -418,7 +418,6 @@ currentWorkaround=false # shutdown_capacity (sc) # # When the battery is discharging and its capacity/voltage_now_millivolts <= sc and phone has been running for 15 minutes or more, acc daemon turns the phone off to reduce the discharge rate and protect the battery from potential damage induced by voltage below the operating range. # sc=-1 disables it. -# [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc + 5% or sc + 100 mV. # cooldown_capacity (cc) # # Capacity/voltage_now_millivolts at which the cooldown cycle starts. @@ -736,6 +735,7 @@ Options acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " " - MTK only) -t|--test [file] Test charging switches from a file (default: /dev/.vr25/acc/ch-switches) + Control files that trigger reboots or kernel panics are automatically backlisted e.g., acc -t (test known switches) acc -t /sdcard/experimental_switches.txt (test custom/foreign switches) @@ -1071,7 +1071,14 @@ Automatic exporting (local) happens under specific conditions (refer back to `SE ### Finding Additional/Potential Charging Switches Quickly -Refer to (search for) the `--parse` option in the [terminal commands](#terminal-commands) section. +1. Generate a list of potential charging switches: `acc -p > /sdcard/acc-p.txt`. + +2. Remove from the list, all lines that you're SURE don't resemble a charging switch. + +3. Test all: `acc -t /sdcard/acc-p.txt`. + +Note that some control files may trigger reboots or kernel panics. +ACC automatically blacklists these, so that the user can continue testing (step 2) after each reboot. ### Install, Upgrade, Stop and Restart Processes Seem to Take Too Long @@ -1279,6 +1286,8 @@ With modern battery management systems, that's generally unnecessary. However, if your battery is underperforming, you may want to try the procedure described at https://batteryuniversity.com/article/bu-603-how-to-calibrate-a-smart-battery . +ACC automatically optimizes system performance and battery utilization, by forcing `bg-dexopt-job` on daemon [re]start, if charging. + > I set voltage to 4080 mV and that corresponds to just about 75% charge. But is it typically safer to let charging keep running, or to have the circuits turn on and shut off between defined percentage levels repeatedly? @@ -1384,11 +1393,6 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu --- ## LATEST CHANGES -**v2021.11.3 (202111030)** -- Fixed installation issues -- Improved support for the current Magisk canary. -- Shutdown warning notifications (mV) are now posted at shutdown_capacity + 100mV (formerly 200). - **v2021.12.14 (202112140)** - Additional charging switches; - Auto-add current and voltage ctrl files to charging switches list for extended idle mode support; @@ -1407,3 +1411,13 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu - [ctrl-files]: added `battery/op_disable_charge 0 1` switch; - [README]: updated troubleshooting section; - General optimizations. + +**v2022.1.8 (202201080)** +- `acc -p` finds even more potential switches; +- Enhanced charging status detection; +- General fixes & optimizations; +- Improved idle mode support; +- New charging switches; +- Optimize system performance and battery utilization, by forcing `bg-dexopt-job` on daemon [re]start, if charging; +- Support for Qualcomm SnapDragon 8 Gen 1 devices, Nokia 2.2 and more; +- Updated documentation. diff --git a/acc/acc.sh b/acc/acc.sh index a1c2b83..8f95a5e 100644 --- a/acc/acc.sh +++ b/acc/acc.sh @@ -1,6 +1,6 @@ #!/system/bin/sh # Advanced Charging Controller -# Copyright 2017-2021, VR25 +# Copyright 2017-2022, VR25 # License: GPLv3+ @@ -135,9 +135,9 @@ test_charging_switch() { flip_sw off && sleep_sd not_charging || : ! not_charging && failed=true || { - not_charging not \ + [ $_status = Idle ] \ && battIdleMode=true \ - || battIdleMode=false + || { [ ${chargingSwitch[2]:-.} = voltage_now ] && battIdleMode=true || battIdleMode=false; } } flip_sw on 2>/dev/null @@ -181,7 +181,7 @@ parse_switches() { cat -v "$2" > $f - for i in $(grep -En '^ (1|0)$' $f | cut -d: -f1); do + for i in $(grep -Ein '^ ((1|0)$|.*able.*)' $f | cut -d: -f1); do n=$i i="$(sed -n "$(($n - 1))p" "$f")" @@ -311,7 +311,6 @@ case "${1-}" in -d|--disable) shift ${verbose:-true} || exec > /dev/null - print_m_mode ! daemon_ctrl stop > /dev/null || print_stopped . $execDir/acquire-lock.sh disable_charging "$@" @@ -324,7 +323,6 @@ case "${1-}" in -e|--enable) shift ${verbose:-true} || exec > /dev/null - print_m_mode ! daemon_ctrl stop > /dev/null || print_stopped . $execDir/acquire-lock.sh enable_charging "$@" diff --git a/acc/accd.sh b/acc/accd.sh index ccb43e2..8d4fcb1 100644 --- a/acc/accd.sh +++ b/acc/accd.sh @@ -1,6 +1,6 @@ #!/system/bin/sh # Advanced Charging Controller Daemon (accd) -# Copyright 2017-2021, VR25 +# Copyright 2017-2022, VR25 # License: GPLv3+ @@ -137,6 +137,9 @@ if ! $init; then && chgStatusCode=$(dumpsys battery 2>/dev/null | sed -n 's/^ status: //p') then setup_capacity_sync + set +e + cmd package bg-dexopt-job < /dev/null > /dev/null 2>&1 & + set -e fi # read charging current ctrl files (part 2) once @@ -278,18 +281,18 @@ if ! $init; then if ! $maxTempPause && [ $(cut -d '.' -f 1 /proc/uptime) -ge 900 ] && not_charging dis; then if [ ${capacity[0]} -ge 1 ]; then # warnings - if $shutdownWarnings && [ -f $data_dir/warn ]; then + ! $shutdownWarnings || { if t ${capacity[0]} -gt 3000; then ! t $(grep -o '^..' $voltage_now) -eq $(( ${capacity[0]%??} + 1 )) \ - || ! su -lp 2000 -c "cmd notification post -S bigtext -t 'ACC' 'Tag' \"WARNING: ~100mV to auto shutdown, plug the charger!\"" \ + || ! notif "WARNING: ~100mV to auto shutdown, plug the charger!" \ || sleep ${loopDelay[1]} else ! t $(cat $batt/capacity) -eq $(( ${capacity[0]} + 5 )) \ - || ! su -lp 2000 -c "cmd notification post -S bigtext -t 'ACC' 'Tag' \"WARNING: 5% to auto shutdown, plug the charger!\"" \ + || ! notif "WARNING: 5% to auto shutdown, plug the charger!" \ || sleep ${loopDelay[1]} fi shutdownWarnings=false - fi + } # action if _le_shutdown_cap; then sleep ${loopDelay[1]} diff --git a/acc/batt-info.sh b/acc/batt-info.sh index 1dce95c..baf8545 100644 --- a/acc/batt-info.sh +++ b/acc/batt-info.sh @@ -26,7 +26,6 @@ batt_info() { # raw battery info from the kernel's battery interface - info="$( cat $batt/uevent *bms*/uevent 2>/dev/null \ | sort -u \ @@ -39,15 +38,8 @@ batt_info() { # determine the correct charging status - case "$info" in - *STATUS=[Cc]harging*) - if not_charging dis; then - info="${info/STATUS=?harging/STATUS=Discharging}" - elif not_charging not; then - info="${info/STATUS=?harging/STATUS=Not charging}" - fi - ;; - esac + not_charging || : + info="$(echo "$info" | sed "/^STATUS=/s/=.*/=$_status/")" # because MediaTek is weird @@ -65,18 +57,19 @@ batt_info() { # add/remove negative sign case $currNow in - *.*) - if not_charging dis; then + 0.00) + : + ;; + *) + if [ $_status = Discharging ]; then currNow=-${currNow#-} - elif ! not_charging; then + elif [ $_status = Charging ]; then currNow=${currNow#-} fi ;; - *) - currNow=0 - ;; esac + # parse VOLTAGE_NOW & convert to Volts voltNow=$(echo "$info" | sed -n "s/^VOLTAGE_NOW=//p") dtr_conv_factor $voltNow ${voltFactor-} diff --git a/acc/batt-interface.sh b/acc/batt-interface.sh index dbbd81e..f062610 100644 --- a/acc/batt-interface.sh +++ b/acc/batt-interface.sh @@ -6,12 +6,20 @@ not_charging() { [ ! -f $file ] || break done + [ ${1:-.} = not ] && _status=Idle || _status=Discharging + grep -Eiq "${1-dis|not}" $file || { if [ -n "$currThreshold" ] && [ ! -f ${config_%/*}/curr ] \ && [ ! -f $TMPDIR/curr ] && [ $(sed s/-// $currFile) -le $currThreshold ] then return 0 else + if { [ -z "${1-}" ] || [ $1 = dis ]; } \ + && [ $(sed s/-// $currFile) -lt $curr ] + then + return 0 + fi + _status=Charging return 1 fi } @@ -48,7 +56,7 @@ if ${init:-false}; then done curr=$(sed s/-// $currFile) - currThreshold=50 # mA + currThreshold=95 # mA ampFactor_=1000 if [ $curr -le $currThreshold ]; then @@ -61,16 +69,16 @@ if ${init:-false}; then } fi - unset curr - echo "ampFactor_=$ampFactor_ - batt=$batt - currFile=$currFile - currThreshold=$currThreshold - temp=$temp" > $TMPDIR/.batt-interface.sh +batt=$batt +currFile=$currFile +currThreshold=$currThreshold +temp=$temp" > $TMPDIR/.batt-interface.sh init=false else . $TMPDIR/.batt-interface.sh fi + +curr=-1 diff --git a/acc/ctrl-files.sh b/acc/ctrl-files.sh index 754f128..2201674 100644 --- a/acc/ctrl-files.sh +++ b/acc/ctrl-files.sh @@ -16,6 +16,7 @@ battery/store_mode 0 1 idt/pin_enabled 1 0 battery/charging_enabled 0 0 battery/op_disable_charge 0 1 battery/charging_enabled 1 1 +battery/input_suspend 0 1 /proc/mtk_battery_cmd/en_power_path 1 1 /proc/*disable_chrg 0 1 /sys/class/battchg_ext/*charge_disable 0 1 @@ -31,6 +32,7 @@ battery/charging_enabled 0 0 battery/op_disable_charge 0 1 battery/charging_enab /sys/devices/platform/omap/omap_i2c.?/i2c-?/?-00??/charge_enable 1 0 /sys/devices/platform/soc/soc:google,charger/charge_disable 0 1 /sys/devices/platform/soc/soc:oplus,chg_intf/oplus_chg/battery/*charging_enable 1 0 +/sys/devices/platform/soc/soc:qcom,pmic_glink/soc:qcom,pmic_glink:qcom,battery_charger/force_charger_suspend 0 1 /sys/devices/soc/soc:lge,*/lge_power/lge_*/charging_enabled 1 0 /sys/devices/virtual/oplus_chg/battery/*charging_enable 1 0 /sys/kernel/debug/google_charger/chg_suspend 0 1 @@ -42,13 +44,17 @@ battery/charging_enabled 0 0 battery/op_disable_charge 0 1 battery/charging_enab /sys/module/lge_battery/parameters/charge_stop_level 100 5 battery/input_suspend 0 0 # experimental +/sys/class/qcom-battery/cool_mode 0 1 +/sys/class/qcom-battery/vbus_disable 0 1 /sys/devices/platform/battery_meter/FG_suspend_current_threshold 100 5 /sys/devices/platform/google,charger/charge_stop_level 100 5 battery/hmt_ta_charge 1 0 bbc/hiz_mode 0 1 CROS_USB_PD_CHARGER0/charge_control_limit_max 0 1 +main/cool_mode 0 1 usb/cc_toggle_enable 1 0 usb/otg_fastroleswap 0 1 +usb/vbus_disable 0 1 # troublesome /sys/devices/platform/battery/ChargerEnable 1 0 diff --git a/acc/default-config.txt b/acc/default-config.txt index 59853fc..540a314 100644 --- a/acc/default-config.txt +++ b/acc/default-config.txt @@ -1,4 +1,4 @@ -configVerCode=202111030 +configVerCode=202201010 capacity=(-1 60 70 75 false false) temperature=(40 60 90 65) cooldownRatio=() @@ -175,7 +175,6 @@ currentWorkaround=false # shutdown_capacity (sc) # # When the battery is discharging and its capacity/voltage_now_millivolts <= sc and phone has been running for 15 minutes or more, acc daemon turns the phone off to reduce the discharge rate and protect the battery from potential damage induced by voltage below the operating range. # sc=-1 disables it. -# [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc + 5% or sc + 100 mV. # cooldown_capacity (cc) # # Capacity/voltage_now_millivolts at which the cooldown cycle starts. diff --git a/acc/misc-functions.sh b/acc/misc-functions.sh index 0747690..9b0e5e4 100644 --- a/acc/misc-functions.sh +++ b/acc/misc-functions.sh @@ -248,6 +248,7 @@ flip_sw() { local on= local off= + local off_= local flip=$1 set -- ${chargingSwitch[@]-} @@ -255,7 +256,20 @@ flip_sw() { while [ -f ${1:-//} ]; do on="$(echo $2 | sed 's/::/ /g')" - off="$(echo $3 | sed 's/::/ /g')" + if [ $flip = off ]; then + ! tt "${chargingSwitch[*]:-.}" "battery/input_suspend?0?1?/proc/mtk_battery_cmd/en_power_path?1?1*" ] || sleep 6 # mtk idle mode workaround + if [ ${chargingSwitch[2]:-.} = voltage_now ]; then + off_="$off" + ! off=$(cat $batt/voltage_now 2>/dev/null) \ + && off="$off_" \ + || { [ $off -lt 10000 ] && off=$((off - 50)) || off=$((off - 50000)); } + else + off="$(echo $3 | sed 's/::/ /g')" + fi + curr=$(sed s/-// $currFile) + else + curr=-1 + fi chmod 0644 $1 && write \$$flip $1 || return 1 shift 3 2>/dev/null || return 0 done @@ -285,9 +299,14 @@ misc_stuff() { } +notif() { + su -lp 2000 -c "/system/bin/cmd notification post -S bigtext -t 'ACC' 'Tag' \"$*\"" < /dev/null > /dev/null 2>&1 +} + + print_header() { echo "Advanced Charging Controller $accVer ($accVerCode) -Copyright 2017-2021, VR25 +Copyright 2017-2022, VR25 GPLv3+" } @@ -300,8 +319,8 @@ print_wait_plug() { sleep_sd() { local i= - for i in $(seq 4); do - (set +eu; eval "$@") && return 0 || sleep $switchDelay + for i in $(seq $switchSeq); do + (set +eu; eval "$@") && return 0 || sleep 2 done return 1 } @@ -350,9 +369,9 @@ wait_plug() { write() { local i= - for i in 1 2; do + for i in 1 2 3; do eval echo "$1" > "$2" || return 1 - sleep 0.5 + sleep 0.33 done } @@ -361,8 +380,8 @@ write() { id=acc domain=vr25 -switchDelay=2 -loopDelay=(10 15) +switchSeq=4 +loopDelay=(5 10) execDir=/data/adb/$domain/acc export TMPDIR=/dev/.vr25/acc config=/data/adb/$domain/${id}-data/config.txt @@ -394,8 +413,7 @@ pgrep -f zygote > /dev/null || { dumpsys() { :; } } -# set switchDelay for mtk devices -! grep -q mtk_battery_cmd $TMPDIR/ch-switches || switchDelay=5 +! grep -q mtk_battery_cmd $TMPDIR/ch-switches || switchSeq=11 # load plugins mkdir -p ${execDir}-data/plugins $TMPDIR/plugins diff --git a/acc/oem-custom.sh b/acc/oem-custom.sh index 8fe41ff..b4d59d9 100644 --- a/acc/oem-custom.sh +++ b/acc/oem-custom.sh @@ -25,6 +25,14 @@ fi ! _grep '^chargingSwitch=./sys/module/lge_battery/parameters/charge_stop_level' \ || loopCmd_='[ $(cat battery/input_suspend) != 1 ] || echo 0 > battery/input_suspend' +# bttery idle mode for certain mtk devices +! _grep '^chargingSwitch=.battery/input_suspend 0 1 /proc/mtk_battery_cmd/en_power_path 1 1' \ + || loopCmd_=' + if [ $(cat /proc/mtk_battery_cmd/en_power_path) -eq 0 ] && [ $(cat battery/status) = Discharging ]; then + echo 0 > battery/input_suspend + fi + ' + # block "ghost charging on steroids" (Xiaomi Redmi 3 - ido) [ ! -f $TMPDIR/accd-ido.log ] || touch $TMPDIR/.ghost-charging diff --git a/acc/post-fs-data.sh b/acc/post-fs-data.sh deleted file mode 100644 index 0a0922a..0000000 --- a/acc/post-fs-data.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/system/bin/sh -# Workaround for EdXposed's service.sh bug - -id=acc -domain=vr25 -for f in /data/adb/modules/riru_edxposed_*/module.prop; do - [ -f "$f" ] && { - [ -f "${f%/*}/disable" ] && continue - [ -f /dev/.vr25/$id/accd ] || exec /data/adb/$domain/$id/service.sh - } -done -exit 0 diff --git a/acc/read-ch-curr-ctrl-files-p2.sh b/acc/read-ch-curr-ctrl-files-p2.sh index 0513ea3..ab1553e 100644 --- a/acc/read-ch-curr-ctrl-files-p2.sh +++ b/acc/read-ch-curr-ctrl-files-p2.sh @@ -32,7 +32,7 @@ then # add curr and volt ctrl files to charging switches list sed -e 's/::.*::/ /g' -e 's/$/ 0/' $TMPDIR/ch-curr-ctrl-files_ > $TMPDIR/.ctrl - sed -Ee 's/::.*::/ /g' -e 's/( [0-9]+)/\1RRRR\1/' -e 's/RRRR...../ 3920/' $TMPDIR/ch-volt-ctrl-files_ >> $TMPDIR/.ctrl + sed -Ee 's/::.*::/ /g' -e 's/([0-9])$/\1 voltage_now/' $TMPDIR/ch-volt-ctrl-files >> $TMPDIR/.ctrl grep / $TMPDIR/.ctrl >> $TMPDIR/ch-switches rm $TMPDIR/.ctrl @@ -42,7 +42,8 @@ then # exclude non-batt control files $currentWorkaround \ && grep -i batt $TMPDIR/ch-curr-ctrl-files_ > $TMPDIR/ch-curr-ctrl-files \ - || mv -f $TMPDIR/ch-curr-ctrl-files_ $TMPDIR/ch-curr-ctrl-files + || cat $TMPDIR/ch-curr-ctrl-files_ > $TMPDIR/ch-curr-ctrl-files fi +rm $TMPDIR/ch-curr-ctrl-files_ touch $TMPDIR/.ch-curr-read) || : diff --git a/acc/strings.sh b/acc/strings.sh index bc1037b..d629be1 100644 --- a/acc/strings.sh +++ b/acc/strings.sh @@ -254,6 +254,7 @@ Options acc -t /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " " - MTK only) -t|--test [file] Test charging switches from a file (default: /dev/.vr25/acc/ch-switches) + Control files that trigger reboots or kernel panics are automatically backlisted e.g., acc -t (test known switches) acc -t /sdcard/experimental_switches.txt (test custom/foreign switches) @@ -463,10 +464,6 @@ print_only() { echo "only" } -print_m_mode() { - echo "(i) Manual mode" -} - print_wait() { echo "(i) Alright, this may take a minute or so..." } diff --git a/acc/translations/id/strings.sh b/acc/translations/id/strings.sh index e7383a9..360c24f 100644 --- a/acc/translations/id/strings.sh +++ b/acc/translations/id/strings.sh @@ -222,10 +222,6 @@ print_only() { echo "hanya" } -print_m_mode() { - echo "(i) Manual mode" -} - print_wait() { echo "(i) Baik, ini mungkin perlu waktu beberapa menit..." } diff --git a/build.sh b/build.sh index 309e9a8..6ab1ce0 100644 --- a/build.sh +++ b/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh # Installation Archives Builder -# Copyright 2018-2021, VR25 +# Copyright 2018-2022, VR25 # License: GPLv3+ # # usage: $0 [any_random_arg] @@ -109,6 +109,7 @@ fi [ -z "$1" ] && { + archive=${id}_$(date +%Y-%m-%d_%H:%M:%S) basename=${id}_${version}_$versionCode # cleanup @@ -118,8 +119,8 @@ fi cp bin/${id}-uninstaller.zip _builds/${basename}/ # generate $id flashable zip - echo "=> _builds/${basename}/${basename}.zip" - zip -r9 _builds/${basename}/${basename}.zip \ + echo "=> _builds/${basename}/${archive}.zip" + zip -r9 _builds/${basename}/${archive}.zip \ * .gitattributes .gitignore \ -x _\*/\* | sed 's|.*adding: ||' | grep -iv 'zip warning:' echo @@ -132,8 +133,8 @@ fi # generate $id installable tarball cd _builds/${basename} - echo "=> _builds/${basename}/${basename}.tar.gz" - tar -cvf - ${basename} | gzip -9 > ${basename}.tar.gz + echo "=> _builds/${basename}/${archive}.tar.gz" + tar -cvf - ${basename} | gzip -9 > ${archive}.tar.gz rm -rf ${basename}/ echo diff --git a/customize.sh b/customize.sh index 81587b4..919aa61 100644 --- a/customize.sh +++ b/customize.sh @@ -1,6 +1,6 @@ #!/system/bin/sh # $id Installer/Upgrader -# Copyright 2019-2021, VR25 +# Copyright 2019-2022, VR25 # License: GPLv3+ # # devs: triple hashtags (###) mark non-generic code @@ -146,7 +146,7 @@ fi ### echo "$name $version ($versionCode) -Copyright 2017-2021, $author +Copyright 2017-2022, $author GPLv3+ (i) Installing in $installDir/$id/..." @@ -280,4 +280,8 @@ esac # initialize $id /data/adb/$domain/$id/service.sh --init +[ $(date +%m%d) -gt 110 ] || su -lp 2000 -c "/system/bin/cmd notification post -S bigtext -t 'ACC' 'Tag' \"Happy New Year!\"" < /dev/null > /dev/null 2>&1 + +rm $data_dir/curr $data_dir/warn 2>/dev/null ### + exit 0 diff --git a/install.sh b/install.sh index 81587b4..919aa61 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,6 @@ #!/system/bin/sh # $id Installer/Upgrader -# Copyright 2019-2021, VR25 +# Copyright 2019-2022, VR25 # License: GPLv3+ # # devs: triple hashtags (###) mark non-generic code @@ -146,7 +146,7 @@ fi ### echo "$name $version ($versionCode) -Copyright 2017-2021, $author +Copyright 2017-2022, $author GPLv3+ (i) Installing in $installDir/$id/..." @@ -280,4 +280,8 @@ esac # initialize $id /data/adb/$domain/$id/service.sh --init +[ $(date +%m%d) -gt 110 ] || su -lp 2000 -c "/system/bin/cmd notification post -S bigtext -t 'ACC' 'Tag' \"Happy New Year!\"" < /dev/null > /dev/null 2>&1 + +rm $data_dir/curr $data_dir/warn 2>/dev/null ### + exit 0 diff --git a/module.prop b/module.prop index 1d7f49b..5a5f7c3 100644 --- a/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=acc domain=vr25 name=Advanced Charging Controller (ACC) -version=v2021.12.20 -versionCode=202112200 +version=v2022.1.8 +versionCode=202201080 author=VR25 description=Mainly intended for extending battery service life on Android devices. In a nutshell, this is achieved through limiting charging current, temperature and voltage. Any root solution is supported. The installation is always "system-less", whether or not the system is rooted with Magisk.