Skip to content

Commit

Permalink
**v2020.7.26 (202007260)**
Browse files Browse the repository at this point in the history
- General cleanup and optimizations
- Moved acc files in /sdcard/ to /sdcard/Download/acc/.
- Removed acc-init.sh in favor of service.sh.
  • Loading branch information
VR-25 committed Jul 27, 2020
1 parent d287c3f commit 9a841b2
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 71 deletions.
15 changes: 4 additions & 11 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ srcDir=${srcDir/#"${0##*/}"/"."}
name=$(get_prop name)
author=$(get_prop author)
version=$(get_prop version)
userDir=/sdcard/Download/$id
magiskModDir=/data/adb/modules
versionCode=$(get_prop versionCode)
: ${installDir:=/data/data/mattecarra.${id}app/files} ###
Expand Down Expand Up @@ -142,7 +143,7 @@ GPLv3+
cp -R $srcDir/$id/ $installDir/
installDir=$(readlink -f $installDir/$id)
cp $srcDir/module.prop $installDir/
mkdir -p ${config%/*}/info
mkdir -p ${config%/*}/info $userDir
cp -f $srcDir/*.md ${config%/*}/info


Expand All @@ -161,12 +162,6 @@ cp -f $srcDir/*.md ${config%/*}/info
###
if $acca; then

(cd $installDir && ln -s service.sh ${id}-init.sh) # legacy

# upgrade bundled version
#cp -f $srcDir/install-tarball.sh ${installDir%/*}/
#tar -cvf - . -C $srcDir --exclude .git | gzip -9 > ${installDir%/*}/acc_bundle.tar.gz

! $magisk || {

ln -fs $installDir /data/data/mattecarra.${id}app/files/
Expand Down Expand Up @@ -200,12 +195,11 @@ fi


# restore config backup
[ -d /data/media/0 ] || ln -s /sdcard /data/media/0 # legacy
[ -f $config ] || cp /data/media/0/.${id}-config-backup.txt $config 2>/dev/null || :
[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || :


# flashable uninstaller
cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/
cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/


# Termux, fix sha-bang
Expand All @@ -220,7 +214,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/

# set perms
set_perms_recursive ${config%/*}
chmod 0666 /data/media/0/${id}-uninstaller.zip
case $installDir in
/data/*/files/*$id)
pkg=${installDir%/files/*$id}
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Users are encouraged to try step `2` - to familiarize themselves with the availa
The default configuration has you covered.
Don't ever feel like you have to configure everything. You probably shouldn't anyway - unless you really know what you're doing.

- Uninstall: run `acc --uninstall` or flash\* `/sdcard/acc-uninstaller.zip`.
- Uninstall: run `acc --uninstall` or flash\* `/sdcard/Download/acc/acc-uninstaller.zip`.

\* If you're going to flash from recovery, mount system first.
Otherwise, recovery will throw error 255.
Expand Down Expand Up @@ -615,7 +615,7 @@ Options
-la Same as -l -a
-l|--log -e|--export Export all logs to /sdcard/acc-logs-$deviceName.tar.bz2
-l|--log -e|--export Export all logs to /sdcard/Download/acc/acc-logs-$deviceName.tar.bz2
e.g., acc -l -e
-le Same as -l -e
Expand Down Expand Up @@ -693,7 +693,7 @@ Options
acc -t battery/charging_enabled 1 0
acc -t 15 /proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0 ("::" is a placeholder for " "; the default switch_delay is 7)
-t|--test [switch_delay] [file] Test charging switches from a file (default: /data/data/com.termux/files/usr/tmp/ch-switches)
-t|--test [switch_delay] [file] Test charging switches from a file (default: /ch-switches)
This will also report whether "battery idle" mode is supported
e.g.,
acc -t (test known switches)
Expand Down Expand Up @@ -741,7 +741,7 @@ Exit Codes
10. "--test" failed
11. Current (mA) out of range
12. Initialization failed
13. Failed to lock /data/data/com.termux/files/usr/tmp/acc.lock
13. Failed to lock /dev/.acc/acc.lock
Logs are exported automatically ("--log --export") on exit codes 1, 2, 7 and 10.
Expand Down Expand Up @@ -842,7 +842,7 @@ Most of the time, though, it's just a matter of plugging the phone before turnin
Battery level must be below pause_capacity.
Once booted, one can run `acc --uninstall` (or `acc -U`) to remove ACC.

From recovery, you can mount system and flash `/sdcard/acc-uninstaller.zip` or run `mount /system; /data/adb/acc/uninstall.sh`.
From recovery, you can mount system and flash `/sdcard/Download/acc/acc-uninstaller.zip` or run `mount /system; /data/adb/acc/uninstall.sh`.


### Charging Switch
Expand Down Expand Up @@ -1023,7 +1023,7 @@ You only have to go through these steps once.
Open issues on GitHub or contact the developer on Facebook, Telegram (preferred) or XDA (links below).
Always provide as much information as possible.
Attach `/sdcard/acc-logs-*tar.gz` - generated by `acc -le` _right after_ the problem occurs.
Attach `/sdcard/Download/acc/acc-logs-*tar.bz2` - generated by `acc -le` _right after_ the problem occurs.
Refer back to `TROUBLESHOOTING > Diagnostics/Logs` for additional details.


Expand Down Expand Up @@ -1146,6 +1146,11 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu
---
## LATEST CHANGES

**v2020.7.26 (202007260)**
- General cleanup and optimizations
- Moved acc files in /sdcard/ to /sdcard/Download/acc/.
- Removed acc-init.sh in favor of service.sh.

**v2020.7.25 (202007250)**
- Updated documentation
- Workaround for network issues
Expand All @@ -1155,9 +1160,3 @@ A common workaround is having `resume_capacity = pause_capacity - 1`. e.g., resu
- Fixed "chargingSwitch[*]: parameter not set".
- Updated framework-details.txt.
- Workaround for /data/adb/service.d/ not found

**v2020.7.22 (202007220)**
- Appending `--` to `charging_switch=...` disables automatic switch checks. This prevents accd from changing the set charging switches and from exiting if these fail to disable charging.
- dmesg is included in log archive.
- Fixed install-tarball.sh.
- General fixes & optimizations
5 changes: 1 addition & 4 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
install.sh
upgrade acc_bundle.tar.gz and install-tarball.sh

remove "# legacy"
remove #legacy
4 changes: 2 additions & 2 deletions acc/acc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ case "${1-}" in
echo
;;
*)
[ "${1-}" != -- ] || shift ### legacy
[ "${1-}" != -- ] || shift #legacy
exitCode=10
while read chargingSwitch; do
[ -f "$(echo "$chargingSwitch" | cut -d ' ' -f 1)" ] && {
Expand All @@ -431,7 +431,7 @@ case "${1-}" in
;;


-T|--logtail|-L) # legacy
-T|--logtail|-L) #legacy
if ${verbose:-true} && [ $1 != -L ]; then
print_quit CTRL-C
sleep 1.5
Expand Down
7 changes: 4 additions & 3 deletions acc/acca.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ cd /data/adb/acc/
export TMPDIR=/dev/.acc verbose=false
. ./setup-busybox.sh

userDir=/sdcard/Download/acc
config=/data/adb/acc-data/config.txt
defaultConfig=$PWD/default-config.txt

mkdir -p ${config%/*}
mkdir -p ${config%/*} $userDir
[ -f $config ] || cp $defaultConfig $config

# config backup
! [ -d /data/media/0/?ndroid -a $config -nt /data/media/0/.acc-config-backup.txt ] \
|| cp -f $config /data/media/0/.acc-config-backup.txt
! test $config -nt $userDir/.acc-config-backup.txt \
|| cp -f $config $userDir/.acc-config-backup.txt

# custom config path
case "${1-}" in
Expand Down
2 changes: 1 addition & 1 deletion acc/accd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# wait until the system is ready
pgrep -fl zygote > /dev/null && {
pgrep zygote > /dev/null && {
until test -d /data/data \
&& test .$(getprop sys.boot_completed) = .1 \
&& dumpsys battery > /dev/null 2>&1
Expand Down
7 changes: 4 additions & 3 deletions acc/logf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ logf() {
batt_info > $TMPDIR/acc-i.txt)
dumpsys battery > dumpsys-battery.txt

tar -c *.log *.txt | bzip2 -9 > /data/media/0/acc-logs-$device.tar.bz2
userDir=/sdcard/Download/acc
mkdir -p $userDir
tar -c *.log *.txt | bzip2 -9 > $userDir/acc-logs-$device.tar.bz2

chmod 0666 /data/media/0/acc-logs-$device.tar.gz
rm *.txt magisk.log in*.log power*.log m*accapp.log 2>/dev/null
echo "(i) /sdcard/acc-logs-$device.tar.bz2"
echo "(i) $userDir/acc-logs-$device.tar.bz2"

else
if [[ "${1:-x}" = -*a* ]]; then
Expand Down
7 changes: 4 additions & 3 deletions acc/misc-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ enable_charging() {

misc_stuff() {
set -eu
mkdir -p ${config%/*}
mkdir -p ${config%/*} $userDir
[ -f $config ] || cp $execDir/default-config.txt $config

# config backup
! [ -d /data/media/0/?ndroid -a $config -nt /data/media/0/.acc-config-backup.txt ] \
|| cp -f $config /data/media/0/.acc-config-backup.txt
! test $config -nt $userDir/.acc-config-backup.txt \
|| cp -f $config $userDir/.acc-config-backup.txt

# custom config path
case "${1-}" in
Expand Down Expand Up @@ -323,6 +323,7 @@ id=acc
umask 0077
execDir=/data/adb/acc
export TMPDIR=/dev/.acc
userDir=/sdcard/Download/$id
config=/data/adb/acc-data/config.txt
config_=$config

Expand Down
4 changes: 2 additions & 2 deletions acc/strings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Options
-la Same as -l -a
-l|--log -e|--export Export all logs to /sdcard/acc-logs-\$deviceName.tar.gz
-l|--log -e|--export Export all logs to /sdcard/Download/acc/acc-logs-\$deviceName.tar.bz2
e.g., acc -l -e
-le Same as -l -e
Expand Down Expand Up @@ -291,7 +291,7 @@ Exit Codes
10. "--test" failed
11. Current (mA) out of range
12. Initialization failed
13. Failed to lock $TMPDIR/${id}.lock
13. Failed to lock /dev/.$id/${id}.lock
Logs are exported automatically ("--log --export") on exit codes 1, 2, 7 and 10.
Expand Down
11 changes: 6 additions & 5 deletions acc/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ pgrep -f "/($id|${id}a) (-|--)[det]|/${id}d" > /dev/null && { # legacy

# uninstall $id ###
rm -rf $(readlink -f /data/adb/$id) \
$(readlink -f /sbin/.$id/$id) \
/data/adb/$id \
/data/adb/modules/$id \
/data/adb/service.d/${id}-*.sh \
/data/media/0/${id}-logs-*.tar.* \
/data/data/mattecarra.accapp/files/$id \
/data/data/com.termux/files/home/.termux/boot/${id}-init.sh \
$(test "${1:-}" = install || echo "/data/adb/${id}-data /data/media/0/.${id}-config-backup.txt")
$(test "${1:-}" = install || echo "/data/adb/${id}-data /sdcard/Download/$id")

# remove flashable uninstaller
rm ${3:-/data/media/0/${id}-uninstaller.zip}
#legacy
rm $(readlink -f /sbin/.$id/$id) \
/data/media/0/${id}-logs-*.tar.* \
/data/media/0/${id}-uninstaller.zip \
/data/media/0/.${id}-config-backup.txt 2>/dev/null

touch /dev/.acc-removed
exit 0
Binary file modified bin/acc-uninstaller.zip
Binary file not shown.
15 changes: 4 additions & 11 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ srcDir=${srcDir/#"${0##*/}"/"."}
name=$(get_prop name)
author=$(get_prop author)
version=$(get_prop version)
userDir=/sdcard/Download/$id
magiskModDir=/data/adb/modules
versionCode=$(get_prop versionCode)
: ${installDir:=/data/data/mattecarra.${id}app/files} ###
Expand Down Expand Up @@ -142,7 +143,7 @@ GPLv3+
cp -R $srcDir/$id/ $installDir/
installDir=$(readlink -f $installDir/$id)
cp $srcDir/module.prop $installDir/
mkdir -p ${config%/*}/info
mkdir -p ${config%/*}/info $userDir
cp -f $srcDir/*.md ${config%/*}/info


Expand All @@ -161,12 +162,6 @@ cp -f $srcDir/*.md ${config%/*}/info
###
if $acca; then

(cd $installDir && ln -s service.sh ${id}-init.sh) # legacy

# upgrade bundled version
#cp -f $srcDir/install-tarball.sh ${installDir%/*}/
#tar -cvf - . -C $srcDir --exclude .git | gzip -9 > ${installDir%/*}/acc_bundle.tar.gz

! $magisk || {

ln -fs $installDir /data/data/mattecarra.${id}app/files/
Expand Down Expand Up @@ -200,12 +195,11 @@ fi


# restore config backup
[ -d /data/media/0 ] || ln -s /sdcard /data/media/0 # legacy
[ -f $config ] || cp /data/media/0/.${id}-config-backup.txt $config 2>/dev/null || :
[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || :


# flashable uninstaller
cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/
cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/


# Termux, fix sha-bang
Expand All @@ -220,7 +214,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/

# set perms
set_perms_recursive ${config%/*}
chmod 0666 /data/media/0/${id}-uninstaller.zip
case $installDir in
/data/*/files/*$id)
pkg=${installDir%/files/*$id}
Expand Down
2 changes: 1 addition & 1 deletion install-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ case "$PWD" in
esac

# install ${1:-$id}
test -f ${1:-$id}[-_]*/install.sh || i=-current # legacy
test -f ${1:-$id}[-_]*/install.sh || i=-current #legacy
export installDir="$2"
/system/bin/sh ${1:-$id}[-_]*/install${i}.sh

Expand Down
15 changes: 4 additions & 11 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ srcDir=${srcDir/#"${0##*/}"/"."}
name=$(get_prop name)
author=$(get_prop author)
version=$(get_prop version)
userDir=/sdcard/Download/$id
magiskModDir=/data/adb/modules
versionCode=$(get_prop versionCode)
: ${installDir:=/data/data/mattecarra.${id}app/files} ###
Expand Down Expand Up @@ -142,7 +143,7 @@ GPLv3+
cp -R $srcDir/$id/ $installDir/
installDir=$(readlink -f $installDir/$id)
cp $srcDir/module.prop $installDir/
mkdir -p ${config%/*}/info
mkdir -p ${config%/*}/info $userDir
cp -f $srcDir/*.md ${config%/*}/info


Expand All @@ -161,12 +162,6 @@ cp -f $srcDir/*.md ${config%/*}/info
###
if $acca; then

(cd $installDir && ln -s service.sh ${id}-init.sh) # legacy

# upgrade bundled version
#cp -f $srcDir/install-tarball.sh ${installDir%/*}/
#tar -cvf - . -C $srcDir --exclude .git | gzip -9 > ${installDir%/*}/acc_bundle.tar.gz

! $magisk || {

ln -fs $installDir /data/data/mattecarra.${id}app/files/
Expand Down Expand Up @@ -200,12 +195,11 @@ fi


# restore config backup
[ -d /data/media/0 ] || ln -s /sdcard /data/media/0 # legacy
[ -f $config ] || cp /data/media/0/.${id}-config-backup.txt $config 2>/dev/null || :
[ -f $config ] || cp $userDir/.${id}-config-backup.txt $config 2>/dev/null || :


# flashable uninstaller
cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/
cp -f $srcDir/bin/${id}-uninstaller.zip $userDir/


# Termux, fix sha-bang
Expand All @@ -220,7 +214,6 @@ cp -f $srcDir/bin/${id}-uninstaller.zip /data/media/0/

# set perms
set_perms_recursive ${config%/*}
chmod 0666 /data/media/0/${id}-uninstaller.zip
case $installDir in
/data/*/files/*$id)
pkg=${installDir%/files/*$id}
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.7.25
versionCode=202007250
version=v2020.7.26
versionCode=202007260
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 9a841b2

Please sign in to comment.