Skip to content

Commit

Permalink
**v2020.7.19 (202007190)**
Browse files Browse the repository at this point in the history
- accd stop timeout set to 15 seconds (more time for graceful termination).
- Do not remount /sbin/.
- Faster accd termination
- Fixed "--upgrade not recognizing the latest version is already installed".
- Fixed "max_temp_pause not honored".
- General optimizations
- Minor changes to default config, for convenience
- Note: config will be reset to fix the accd crash issue several users have been facing.
  • Loading branch information
VR-25 committed Jul 19, 2020
1 parent 8b31eb6 commit 4f27f42
Show file tree
Hide file tree
Showing 30 changed files with 141 additions and 176 deletions.
10 changes: 5 additions & 5 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/system/bin/sh
# ACC Installer/Upgrader
# Copyright (c) 2019-2020, VR25 (xda-developers)
# Copyright 2019-2020, VR25 (xda-developers)
# License: GPLv3+
#
# devs: triple hashtags (###) mark non-generic code
Expand Down Expand Up @@ -175,8 +175,8 @@ if $acca; then
echo "#!/system/bin/sh
# AccA post-uninstall cleanup script
until test -d /sdcard/?ndroid \\
-a .\$(getprop sys.boot_completed) == .1
until test -d /data/data \\
&& test .\$(getprop sys.boot_completed) = .1
do
sleep 60
done
Expand All @@ -192,7 +192,7 @@ if $acca; then
fi


[ $installDir == /data/adb/$id ] || ln -s $installDir /data/adb/
[ $installDir = /data/adb/$id ] || ln -s $installDir /data/adb/


# restore config backup
Expand Down Expand Up @@ -258,7 +258,7 @@ echo "
- Daemon started."


[ $installDir == /data/adb ] && echo "
[ $installDir = /data/adb ] && echo "
(i) Non-Magisk users can enable $id 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."


Expand Down
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ In interactive mode, it also asks the user whether they want to download and ins
```
#DC#
configVerCode=202006080
capacity=(-1 101 70 75 false)
temperature=(70 80 90)
configVerCode=202007170
capacity=(-1 60 70 75 false)
temperature=(40 60 90)
cooldownRatio=()
cooldownCustom=()
resetBattStats=(false false)
Expand All @@ -204,7 +204,6 @@ wakeUnlock=()
prioritizeBattIdleMode=true
forceChargingStatusFullAt100=
runCmdOnPause=()
dynPowerSaving=0
autoShutdownAlertCmd=(vibrate 5 0.1)
chargDisabledNotifCmd=(vibrate 3 0.1)
chargEnabledNotifCmd=(vibrate 4 0.1)
Expand Down Expand Up @@ -265,8 +264,6 @@ loopCmd=()
# runCmdOnPause=run_cmd_on_pause=(. script)
# dynPowerSaving=dyn_power_saving=seconds
# autoShutdownAlertCmd=auto_shutdown_alert_cmd=(. script)
# chargDisabledNotifCmd=charg_disabled_notif_cmd=(. script)
Expand Down Expand Up @@ -322,7 +319,6 @@ loopCmd=()
# pbim prioritize_batt_idle_mode
# ff force_charging_status_full_at_100
# rcp run_cmd_on_pause
# dps dyn_power_saving
# asac auto_shutdown_alert_cmd
# cdnc charg_disabled_notif_cmd
Expand All @@ -343,7 +339,7 @@ loopCmd=()
# acc --set pause_capacity=85 resume_capacity=80
# acc -s "s=battery/charging_enabled 1 0"
# acc --set "charging_switch=/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0" ("::" == " ")
# acc --set "charging_switch=/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0" ("::" = " ")
# acc -s sd=5
# acc -s switch_delay=5
Expand Down Expand Up @@ -457,7 +453,7 @@ loopCmd=()
# If this doesn't make sense to you, you probably don't need it.
# Essentially, this is a timeout (seconds) before rebooting - after pausing charging.
# This reboot is a workaround for a firmware issue that causes abnormally fast battery drain after charging is paused on certain devices.
# The issue has reportedly been fixed by the OEMs. This setting will eventually be removed.
# The issue has reportedly been fixed by the OEMs. This feature will eventually be removed.
# switch_delay (sd) #
# This is a delay (seconds) between charging status checks after toggling charging switches. It exists because some switches don't react immediately after being toggled.
Expand Down Expand Up @@ -489,11 +485,6 @@ loopCmd=()
# Run commands* after pausing charging.
# * Usually a script ("sh some_file" or ". some_file")
# dyn_power_saving (dps) #
# This is the maximum number of seconds accd will dynamically sleep* for (while unplugged) to save resources.
# If dyn_power_saving == 0, the feature is disabled.
# * On top of loop_delay_discharging
# auto_shutdown_alert_cmd (asac) #
# charg_disabled_notif_cmd (cdnc) #
# charg_enabled_notif_cmd (cenc) #
Expand Down Expand Up @@ -1153,6 +1144,16 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu
---
## LATEST CHANGES

**v2020.7.19 (202007190)**
- accd stop timeout set to 15 seconds (more time for graceful termination).
- Do not remount /sbin/.
- Faster accd termination
- Fixed "--upgrade not recognizing the latest version is already installed".
- Fixed "max_temp_pause not honored".
- General optimizations
- Minor changes to default config, for convenience
- Note: config will be reset to fix the accd crash issue several users have been facing.

**v2020.7.3 (202007030)**
- Blacklisted problematic MTK charging switch.
- Fixed "battery saver mode can't be turned off".
Expand All @@ -1163,7 +1164,3 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu

**v2020.6.16 (202006160)**
- Magisk related fixes

**v2020.6.15.2 (202006152)**
- Fixed Magisk related issues
- General fixes & optimizations
26 changes: 5 additions & 21 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
cooldown
cooldownTemp=(min_temp charge_seconds pause_seconds max_temp max_temp_pause)
cooldownCapacity=(capacity charge_seconds pause_seconds)

# getval index $var
getval() {
local index=$1
shift
eval "echo \$$index"
}

# setval index val var
setval() {
local val_=$1 val="$2" values="" var=$3
shift 3
values="$(eval "echo \$$var")"
val_="$(getval $val_ $values)"
eval $var=\""${values/$val_/$val}"\"
}

install.sh
upgrade acc_bundle.tar.gz and install-tarball.sh

remove "# legacy"

acc -u
review automatic switch setting
switch being reset for invalid reasons?

sometimes, battery % gets stuck if capacity_freeze2 is enabled
stuck in a wait_plug loop?
38 changes: 16 additions & 22 deletions acc/acc.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/system/bin/sh
# Advanced Charging Controller
# Copyright (c) 2017-2020, VR25 (xda-developers)
# Copyright 2017-2020, VR25 (xda-developers)
# License: GPLv3+


Expand Down Expand Up @@ -124,14 +124,15 @@ exxit() {
local exitCode=$?
set +eux
! ${noEcho:-false} && ${verbose:-true} && echo
[[ $exitCode == [05689] ]] || {
[[ $exitCode == [127] || $exitCode == 10 ]] && {
[[ $exitCode = [05689] ]] || {
[[ $exitCode = [127] || $exitCode = 10 ]] && {
logf --export
eval "${errorAlertCmd[@]-}"
}
echo
}
rm /dev/.acc-config 2>/dev/null
cd /
exit $exitCode
}

Expand Down Expand Up @@ -282,7 +283,7 @@ case "${1-}" in

dsys="$(dumpsys battery)"

{ if [[ "$dsys" == *reset* ]] > /dev/null; then
{ if [[ "$dsys" = *reset* ]] > /dev/null; then
status=$(echo "$dsys" | sed -n 's/^ status: //p')
level=$(echo "$dsys" | sed -n 's/^ level: //p')
powered=$(echo "$dsys" | grep ' powered: true' > /dev/null && echo true || echo false)
Expand Down Expand Up @@ -440,31 +441,24 @@ case "${1-}" in


-u|--upgrade)

shift
local reference=""
local reference=$(echo "$*" | sed -E 's/-c|--changelog|-f|--force|-k|--insecure|-n|--non-interactive| //g')

case "$@" in
*beta*|*dev*|*rc\ *|*\ rc*)
reference=dev
;;
*master*|*stable*)
reference=master
;;
*)
grep -Eq '^version=.*-(beta|rc)' $execDir/module.prop \
&& reference=dev \
|| reference=master
;;
esac
test -n "$reference" || {
grep -Eq '^version=.*-(beta|rc)' $execDir/module.prop \
&& reference=dev \
|| reference=master
}

case "$@" in
case "$*" in
*--insecure*|*-k*) insecure=--insecure;;
*) insecure=;;
esac

[ ! -f /data/adb/bin/curl ] || {
[ -x /data/adb/bin/curl ] || chmod -R 0700 /data/adb/bin
export curlPath=true PATH=/data/adb/bin:$PATH
! test -f /data/adb/bin/curl || {
test -x /data/adb/bin/curl \
|| chmod -R 0700 /data/adb/bin
}

curl $insecure -Lo $TMPDIR/install-online.sh https://raw.githubusercontent.com/VR-25/acc/$reference/install-online.sh
Expand Down
8 changes: 4 additions & 4 deletions acc/acca.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ case "$@" in
;;
esac

[ .${mcc-${max_charging_current-x}} == .x ] || {
[ .${mcc-${max_charging_current-x}} = .x ] || {
. ./set-ch-curr.sh
set_ch_curr ${mcc:-${max_charging_current:--}} || :
}

[ .${mcv-${max_charging_voltage-x}} == .x ] || {
[ .${mcv-${max_charging_voltage-x}} = .x ] || {
. ./set-ch-volt.sh
set_ch_volt ${mcv:-${max_charging_voltage:--}} || :
}
Expand All @@ -117,15 +117,15 @@ case "$@" in

# print default config
-s\ d*|-s\ --print-default*|--set\ d*|--set\ --print-default*|-sd*)
[ $1 == -sd ] && shift || shift 2
[ $1 = -sd ] && shift || shift 2
. $defaultConfig
. ./print-config.sh | grep -E "${1:-...}" || :
exit 0
;;

# print current config
-s\ p*|-s\ --print|-s\ --print\ *|--set\ p|--set\ --print|--set\ --print\ *|-sp*)
[ $1 == -sp ] && shift || shift 2
[ $1 = -sp ] && shift || shift 2
. $config
. ./print-config.sh | grep -E "${1:-...}" || :
exit 0
Expand Down
Loading

0 comments on commit 4f27f42

Please sign in to comment.