diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary index be2ee31..6905175 100644 --- a/META-INF/com/google/android/update-binary +++ b/META-INF/com/google/android/update-binary @@ -53,8 +53,8 @@ trap exxit EXIT fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# @@ -186,8 +186,8 @@ if $acca; then [ -e /data/data/mattecarra.${id}app/files/$id ] \ || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null - exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-init.sh - chmod 0700 /data/adb/service.d/${id}-init.sh + exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh + chmod 0700 /data/adb/service.d/${id}-cleanup.sh } fi diff --git a/README.md b/README.md index e57d4d4..ca98604 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ Any root solution is supported. ACC sets 0700 permissions as needed. Precedence: /data/adb/bin/busybox > Magisk's busybox > system's busybox -\*\* Just like the above, a [static curl binary](https://github.com/search?o=desc&q=curl+android&s=updated&type=Repositories/) can be placed in /data/adb/bin/. -Alternatively, there's the Magisk module [Cross Compiled Binaries (ccbins)](https://github.com/Magisk-Modules-Repo/ccbins/) installs `curl`. +\*\* A [static curl binary](https://github.com/search?o=desc&q=curl+android&s=updated&type=Repositories/) can also be placed in `/data/adb/bin/` (with execute permission). +Alternatively, one may install the Magisk module [Cross Compiled Binaries (ccbins)](https://github.com/Magisk-Modules-Repo/ccbins/). @@ -823,11 +823,12 @@ Refer back to `DEFAULT CONFIGURATION (switch_delay)`. ### Battery Capacity (% Level) Doesn't Seem Right -The "smart" battery may require calibration. -Refer to the `FAQ` section below for details. +When Android's battery level differs from that of the kernel, ACC daemon automatically syncs it by stopping the battery service and feeding it the real value every few seconds. -If we're talking about a Pixel device, the issue goes beyond that. -Refer back to `DEFAULT CONFIGURATION > capacity_sync`. +Pixel devices are known for having battery level discrepancies for the longest time. + +If your device shuts down before the battery is actually empty, capacity_freeze2 may help. +Refer to the `default configuration` section above for details. ### Battery Idle Mode On OnePlus 7/8 Variants (Possibly 5 and 6 Too) @@ -835,7 +836,7 @@ Refer back to `DEFAULT CONFIGURATION > capacity_sync`. Recent/custom kernels (e.g., Kirisakura) support battery idle mode. However, at the time of this writing, the feature is not production quality. ACC has custom code to cover the pitfalls, though. -`battery/op_disable_charge 0 1` must be enforced manually (`acc -ss` or `acc -s s="battery/op_disable_charge 0 1"`) and acc daemon, restarted afterwards. +`battery/op_disable_charge 0 1` must be enforced manually (`acc -ss` or `acc -s s="battery/op_disable_charge 0 1"`). ### Bootloop @@ -1152,42 +1153,17 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu --- ## LATEST CHANGES +**v2020.7.3 (202007030)** +- Blacklisted problematic MTK charging switch. +- Fixed "battery saver mode can't be turned off". +- Fixed network issues. +- General optimizations +- Prepend /data/adb/bin to PATH (executables or links to these can be placed in that dir to override defaults). +- Updated documentation (prerequisites and troubleshooting sections). + **v2020.6.16 (202006160)** - Magisk related fixes **v2020.6.15.2 (202006152)** - Fixed Magisk related issues - General fixes & optimizations - -**v2020.6.14 (202006140)** -- `acca --set var="value"` runs asynchronously -- Android 11 support (absolute path required until system reboots (e.g., `/dev/acc`, `/dev/acca`)) -- capacity_freeze2 (cft): prevents Android from getting capacity readings below 2%; useful on systems that shutdown before battery level drops to 0 or 1% -- `ctrlFileWrites=(times interval)`, defaults are 3 and 0.3 -- Current and voltage limits can be set from AccA, but not restored; until AccA is updated, use `acc -s -` to revert changes -- Daemon stop actions run asynchronously to speed up the process -- Dynamically determine battery uevent path -- Enforce max switch_delay 20 for mtk devices; `acc --test` will use that (7 is default for other devices) -- Exclude parallel/ control files -- Fallback busybox (`/data/adb/bin/busybox`) is now used as primary -- `fg_full_voltage` ctrl file -- Fixed `acc -ss` "extra values" issue -- Fixed AccA log activity -- Fixed MediaTek specific bugs -- Idle mode for Pixel 2/XL and devices with similar hardware -- If AccA is installed, `install.sh` ensures `/data/data/mattecarra.accapp/files/` exists before installing/upgrading acc; this prevents unwanted acc downgrades -- Job control based on lock file -- Legacy support (Android 4.0+) -- loop_cmd: extends accd's functionality (advanced users, details in the readme) -- Non-Magisk users can enable acc auto-start by running /data/adb/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it -- Place temporary files in /dev, rather than /sbin (deprecated) -- Potential workaround for "graceful shutdown not working" -- Power supply logger: learn to skip reading troublesome /sys files (prevents kernel panic); [re]generate log file only on errors and when the log exporting command is executed -- Prevent future AccA versions from downgrading/reinstalling modules -- Removed capacitySync (already automatic) and capacityOffset controls -- Static binaries like busybox and curl can simply be placed in /data/adb/bin/; acc sets 0700 permissions as needed -- The first argument to acc -t can be switch_delay, e.g., `acc -t 15 /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0` -- Updated readme -- Workaround for "can't exit terminal after starting/restarting accd" -- Works in recovery mode (system must be mounted first) -> Release note: refer to the readme for a full list of changes and features diff --git a/TODO.txt b/TODO.txt index b417ac7..fa28497 100644 --- a/TODO.txt +++ b/TODO.txt @@ -22,3 +22,5 @@ install.sh upgrade acc_bundle.tar.gz and install-tarball.sh remove "# legacy" + +acc -u diff --git a/acc/accd.sh b/acc/accd.sh index bffab26..d9a0895 100644 --- a/acc/accd.sh +++ b/acc/accd.sh @@ -6,6 +6,17 @@ # devs: triple hashtags (###) mark non-generic code +# wait until the system is ready +pgrep -fl zygote > /dev/null && { + until test -d /sdcard/?ndroid -a -d /data/data/com.android.providers.media \ + -a .$(getprop sys.boot_completed) == .1 \ + && dumpsys battery > /dev/null 2>&1 +do + sleep 10 + done +} + + umask 0077 . $execDir/acquire-lock.sh @@ -58,7 +69,7 @@ if [ -f $TMPDIR/ch-switches ] && ! $init; then ### if $isCharging; then # reset auto-shutdown warning thresholds - lowPower=false + #lowPower=false warningThresholds=$_warningThresholds # read chgStatusCode once @@ -250,9 +261,9 @@ if [ -f $TMPDIR/ch-switches ] && ! $init; then ### [ $c -ne $i ] || { eval "${autoShutdownAlertCmd[@]-}" warningThresholds=${warningThresholds/$i} - $lowPower || { - ! settings put global low_power 1 || lowPower=true - } + # $lowPower || { + # ! settings put global low_power 1 || lowPower=true + # } } done unset i c @@ -281,7 +292,7 @@ if [ -f $TMPDIR/ch-switches ] && ! $init; then ### isAccd=true cooldown=false hibernate=true - lowPower=false + #lowPower=false readChCurr=true chgStatusCode="" capacitySync=false diff --git a/acc/charging-switches.txt b/acc/charging-switches.txt index 74582b6..779867c 100644 --- a/acc/charging-switches.txt +++ b/acc/charging-switches.txt @@ -4,7 +4,7 @@ # # "::" == " " # PWD=/sys/class/power_supply -# Last updated: Sat, Jun 6, 2020 +# Last updated: Thu, Jul 2, 2020 battery/charger_control 1 0 */charge_disable 0 1 @@ -96,6 +96,6 @@ battery/mmi_charging_enable 1 0 #/sys/devices/i2c*/*/battery_smbus 1 0 #battery/connect_disable 0 1 #usb/online 1 0 -/proc/mtk_battery_cmd/current_cmd 0::0 0::1 +#/proc/mtk_battery_cmd/current_cmd 0::0 0::1 battery/ChargerEnable 1 0 /sys/devices/platform/battery/ChargerEnable 1 0 diff --git a/acc/setup-busybox.sh b/acc/setup-busybox.sh index d87990f..213a691 100644 --- a/acc/setup-busybox.sh +++ b/acc/setup-busybox.sh @@ -23,6 +23,6 @@ } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac diff --git a/acc/uninstall.sh b/acc/uninstall.sh index 8b77ba8..c21470b 100644 --- a/acc/uninstall.sh +++ b/acc/uninstall.sh @@ -30,8 +30,8 @@ export TMPDIR=/dev/.$id fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# diff --git a/bin/acc-uninstaller.zip b/bin/acc-uninstaller.zip index 2ca4290..15c4f5b 100644 Binary files a/bin/acc-uninstaller.zip and b/bin/acc-uninstaller.zip differ diff --git a/customize.sh b/customize.sh index be2ee31..6905175 100644 --- a/customize.sh +++ b/customize.sh @@ -53,8 +53,8 @@ trap exxit EXIT fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# @@ -186,8 +186,8 @@ if $acca; then [ -e /data/data/mattecarra.${id}app/files/$id ] \ || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null - exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-init.sh - chmod 0700 /data/adb/service.d/${id}-init.sh + exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh + chmod 0700 /data/adb/service.d/${id}-cleanup.sh } fi diff --git a/install-online.sh b/install-online.sh index 8fa2ecd..08406c6 100644 --- a/install-online.sh +++ b/install-online.sh @@ -43,8 +43,8 @@ trap 'e=$?; echo; exit $e' EXIT fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# diff --git a/install-tarball.sh b/install-tarball.sh index 6055877..3875e7b 100644 --- a/install-tarball.sh +++ b/install-tarball.sh @@ -30,8 +30,8 @@ set -x fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# diff --git a/install.sh b/install.sh index be2ee31..6905175 100644 --- a/install.sh +++ b/install.sh @@ -53,8 +53,8 @@ trap exxit EXIT fi } case $PATH in - /dev/.busybox:*) : ;; - *) export PATH=/dev/.busybox:$PATH;; + /data/adb/bin:*) :;; + *) export PATH=/data/adb/bin:/dev/.busybox:$PATH;; esac #/BB# @@ -186,8 +186,8 @@ if $acca; then [ -e /data/data/mattecarra.${id}app/files/$id ] \ || rm \$0 /data/adb/$id /data/adb/modules/$id 2>/dev/null - exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-init.sh - chmod 0700 /data/adb/service.d/${id}-init.sh + exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh + chmod 0700 /data/adb/service.d/${id}-cleanup.sh } fi diff --git a/module.prop b/module.prop index 2b72310..f6b9bfc 100644 --- a/module.prop +++ b/module.prop @@ -1,6 +1,6 @@ id=acc name=Advanced Charging Controller (ACC) -version=v2020.6.16 -versionCode=202006160 +version=v2020.7.3 +versionCode=202007030 author=VR25 (patreon.com/vr25) description=ACC is an Android software. It's primarily intended for extending battery service life. In a nutshell, this is achieved through limiting charging current, temperature and voltage. Any root solution is supported. A recent stable Magisk version is recommended. If you're reading this from Magisk Manager > Downloads, tap here to open the documentation. Once there, if you're lazy, jump to the quick start section.