Skip to content

Commit

Permalink
**v2020.7.3 (202007030)**
Browse files Browse the repository at this point in the history
- 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).
  • Loading branch information
VR-25 committed Jul 3, 2020
1 parent ed01e84 commit 8b31eb6
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 69 deletions.
8 changes: 4 additions & 4 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down Expand Up @@ -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

Expand Down
56 changes: 16 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).



Expand Down Expand Up @@ -823,19 +823,20 @@ 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)

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
Expand Down Expand Up @@ -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<c|v> -` 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
2 changes: 2 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ install.sh
upgrade acc_bundle.tar.gz and install-tarball.sh

remove "# legacy"

acc -u
21 changes: 16 additions & 5 deletions acc/accd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions acc/charging-switches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions acc/setup-busybox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions acc/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down
Binary file modified bin/acc-uninstaller.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions install-online.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down
4 changes: 2 additions & 2 deletions install-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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#

Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions module.prop
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 8b31eb6

Please sign in to comment.