Skip to content

Commit

Permalink
**v2021.7.28 (202107280)**
Browse files Browse the repository at this point in the history
- acc -p|--parse: helps find potential charging switches quickly, for any device; refer to --help for details.

- Additional charging switches
- Disable charging after a reboot, if min < capacity < max.
- Extended test (`[[...]]`) alternative function for better shell compatibility

- Fixed issue `#89`: "--"" not respected in charging switch options.
- Fixed issue `#90`: acc is disabled in Magisk, but it keeps starting.
- Fixed issue `#97`: accd dies after plugging USB cable (thanks, @530f6caa).

- General fixes & optimizations
- Max allowed custom charging voltage limit set to 4300 millivolts.

- Cooldown, pause, shutdown and resume capacities can be in millivolts instead of percentages (beta feature).

- Post Android shutdown warning notifications at sc+10%, sc+5%, sc+300mV and sc+100mV (beta feature).

- Save data to /data/adb/vr25/acc-data/, for security reasons.
- Strip negative sign from current if battery is charging.
- Updated documentation.

- Use /data/media/0 over /sdcard as base path for user data. FUSE/SDcardFS seem to have issues in deep sleep - making emulated storage unavailable.

Release Notes

- `acc pause_millivolts resume_millivolts`, e.g., `acc 3920 3800`, is yet another "cheap" alternative to direct charging voltage control.

- If you've been facing the "accd stops randomly" issue, share the output of `acc -l tail` as soon as you notice the problem.

- If you need more charging switches, try `acc -p` while charging; it'll print potential candidates.
The results can be batch tested with `acc -t /path/to/list` or `acc -t file on off`.

- Upgrading to this version will reset config.txt.
  • Loading branch information
VR-25 committed Jul 28, 2021
1 parent d0a9a31 commit 4e5da83
Show file tree
Hide file tree
Showing 31 changed files with 600 additions and 386 deletions.
77 changes: 31 additions & 46 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 2019-2020, VR25
# $id Installer/Upgrader
# Copyright 2019-2021, VR25
# License: GPLv3+
#
# devs: triple hashtags (###) mark non-generic code
Expand All @@ -14,7 +14,7 @@ echo
id=acc
domain=vr25
umask 0077
data_dir=/sdcard/Documents/$domain/$id
data_dir=/data/adb/$domain/${id}-data


# log
Expand All @@ -38,25 +38,25 @@ trap exxit EXIT

# set up busybox
#BB#
[ -x /dev/.busybox/ls ] || {
mkdir -p /dev/.busybox
chmod 0700 /dev/.busybox
if [ -f /data/adb/bin/busybox ]; then
[ -x /data/adb/bin/busybox ] || chmod -R 0700 /data/adb/bin
/data/adb/bin/busybox --install -s /dev/.busybox
[ -x /dev/.vr25/busybox/ls ] || {
mkdir -p /dev/.vr25/busybox
chmod 0700 /dev/.vr25/busybox
if [ -f /data/adb/vr25/bin/busybox ]; then
[ -x /data/adb/vr25/bin/busybox ] || chmod -R 0700 /data/adb/vr25/bin
/data/adb/vr25/bin/busybox --install -s /dev/.vr25/busybox
elif [ -f /data/adb/magisk/busybox ]; then
[ -x /data/adb/magisk/busybox ] || chmod 0700 /data/adb/magisk/busybox
/data/adb/magisk/busybox --install -s /dev/.busybox
/data/adb/magisk/busybox --install -s /dev/.vr25/busybox
elif which busybox > /dev/null; then
eval "$(which busybox) --install -s /dev/.busybox"
eval "$(which busybox) --install -s /dev/.vr25/busybox"
else
echo "(!) Install busybox or simply place it in /data/adb/bin/"
echo "(!) Install busybox or simply place it in /data/adb/vr25/bin/"
exit 3
fi
}
case $PATH in
/data/adb/bin:*) :;;
*) export PATH=/data/adb/bin:/dev/.busybox:$PATH;;
/data/adb/vr25/bin:*) :;;
*) export PATH=/data/adb/vr25/bin:/dev/.vr25/busybox:$PATH;;
esac
#/BB#

Expand Down Expand Up @@ -105,19 +105,20 @@ author=$(get_prop author)
version=$(get_prop version)
magiskModDir=/data/adb/modules
versionCode=$(get_prop versionCode)
: ${installDir:=/data/data/mattecarra.${id}app/files} ###
accaFiles=/data/data/mattecarra.accapp/files ###
: ${installDir:=$accaFiles} ###
config=$data_dir/config.txt


[ -d $magiskModDir ] && magisk=true || magisk=false
ls -d /data/app/mattecarra.${id}app* > /dev/null 2>&1 && acca=true || acca=false ###
ls -d ${accaFiles%/*}* > /dev/null 2>&1 && acca=true || acca=false ###


# ensure AccA's files/ exists - to prevent unwanted ACC downgrades ###
if $acca && [ ! -d /data/data/mattecarra.${id}app/files ]; then
mkdir -p /data/data/mattecarra.${id}app/files
chmod 0777 /data/data/mattecarra.${id}app \
/data/data/mattecarra.${id}app/files
# ensure AccA's files/ exists - to prevent unwanted downgrades ###
if $acca && [ ! -d $accaFiles ]; then
mkdir -p $accaFiles
chmod 0777 ${accaFiles%/*} \
$accaFiles
fi


Expand All @@ -132,30 +133,12 @@ fi

###
echo "$name $version ($versionCode)
Copyright 2017-present, $author
Copyright 2017-2021, $author
GPLv3+
(i) Installing in $installDir/$id/..."


# migrate #legacy data

if [ -d /data/adb/${id}-data ]; then
mv -f /data/adb/${id}-data/* /data/adb/${id}-data/.* \
$data_dir/ 2>/dev/null || :
elif [ -d /sdcard/Download/$id ]; then
mv -f /sdcard/Download/$id/* /sdcard/Download/$id/.* \
$data_dir/ 2>/dev/null || :
else
mv -f /sdcard/$domain/$id/* /sdcard/$domain/$id/.* \
$data_dir/ 2>/dev/null || :
fi
rm -rf $data_dir/info 2>/dev/null || :

mkdir -p /dev/.$domain
mv /dev/.$id /dev/.$domain/$id 2>/dev/null || :


/system/bin/sh $srcDir/$id/uninstall.sh install
cp -R $srcDir/$id/ $installDir/
installDir=$(readlink -f $installDir/$id)
Expand All @@ -180,7 +163,7 @@ if $acca; then

! $magisk || {

ln -fs $installDir /data/data/mattecarra.${id}app/files/
ln -fs $installDir $accaFiles/

# AccA post-uninstall cleanup script
mkdir -p /data/adb/service.d || {
Expand All @@ -190,15 +173,15 @@ if $acca; then
echo "#!/system/bin/sh
# AccA post-uninstall cleanup script
until test -d /sdcard/Download \\
until test -d /sdcard/Android \\
&& test .\$(getprop sys.boot_completed) = .1
do
sleep 60
done
sleep 60
[ -e /data/data/mattecarra.${id}app/files/$id ] || rm -rf \$0 /data/adb/$domain/$id /data/adb/modules/$id 2>/dev/null
[ -e $accaFiles/$id ] || rm -rf \$0 /data/adb/$domain/$id /data/adb/modules/$id 2>/dev/null
exit 0" | sed 's/^ //' > /data/adb/service.d/${id}-cleanup.sh
chmod 0700 /data/adb/service.d/${id}-cleanup.sh
Expand Down Expand Up @@ -257,7 +240,7 @@ echo "- Done
"
# print links and changelog
sed -En "\|## LINKS|,\$p" $srcDir/README.md \
sed -En "\|^## LINKS|,\$p" $srcDir/README.md \
| grep -v '^---' | sed 's/^## //'


Expand All @@ -270,9 +253,11 @@ echo "
- Daemon started."


[ $installDir = /data/adb ] && echo "
case $installDir in
/data/adb/*) echo "
(i) Non-Magisk users can enable $id auto-start by running /data/adb/$domain/$id/service.sh, a copy of, or a link to it - with init.d or an app that emulates it."

;;
esac

# initialize $id
/data/adb/$domain/$id/service.sh --init
Expand Down
Loading

0 comments on commit 4e5da83

Please sign in to comment.