Skip to content

Commit

Permalink
**v2021.8.29 (202108290)**
Browse files Browse the repository at this point in the history
- acc -t <file> skips panicky switches in subsequent runs.

- `acc[d] -x [options] [args]` sets `log=/sdcard/acc[d]-${device}.log`; it's useful for debugging unwanted reboots.

- accd is always stopped gracefully - to ensure defaults are always restored.
This has a potential unwanted side-effect.
Refer to the release note bellow and documentation for details.

- Additional charging switches

- [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc+10%, sc+5%, sc+300mV and sc+100mV.

- Charging switches set with `acc -ss` are now persistent (i.e., the string " --" is automatically appended to them).

- Enhanced current and voltage units conversion
- Improved fronted support (installers and doc)
- General optimizations

- If charging switch is set to 3700 (millivolts), acc stops charging by limiting voltage.
-
- Implemented workarounds for unreadable battery/uevent and unreliable battery/status (kernel bugs) affecting mainly Pixel and LG devices.

- Set batt_slate_mode as default charging control file for Exynos devices
- Support for plugins, refer to [plugins](#plugins) for details.
- Removed potentially troublesome switches.

- The wizard includes battery info (--info).
- Updated documentation (more information, now with a table of contents and in HTML format)

Release note: plug the charger if the install, upgrade, stop or restart processes seem to take too long.
  • Loading branch information
VR-25 committed Aug 29, 2021
1 parent 13c47b8 commit f8146e0
Show file tree
Hide file tree
Showing 28 changed files with 2,009 additions and 569 deletions.
61 changes: 38 additions & 23 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ SKIPUNZIP=1
echo
id=acc
domain=vr25
umask 0077
data_dir=/data/adb/$domain/${id}-data


Expand Down Expand Up @@ -71,25 +70,27 @@ esac
get_prop() { sed -n "s|^$1=||p" ${2:-$srcDir/module.prop}; }

set_perms() {
local owner=${2:-0} perms=0600 target=$(readlink -f $1)
local owner=${2:-0}
local perms=0600
local target
target=$(readlink -f $1)
if echo $target | grep -q '.*\.sh$' || [ -d $target ]; then perms=0700; fi
chmod $perms $target
chown $owner:$owner $target
chcon u:object_r:system_file:s0 $target 2>/dev/null || :
}

set_perms_recursive() {
local owner=${2-0} target=""
local owner=${2-0}
local target
find $1 2>/dev/null | while read target; do set_perms $target $owner; done
}

set -eu


# set source code directory
[ -f $PWD/${0##*/} ] && srcDir=$PWD || srcDir=${0%/*}
srcDir=${srcDir/#"${0##*/}"/"."}

srcDir="$(cd "${0%/*}" 2>/dev/null || :; echo "$PWD")"

# extract flashable zip if source code is unavailable
[ -f $srcDir/module.prop ] || {
Expand All @@ -110,14 +111,27 @@ accaFiles=/data/data/mattecarra.accapp/files ###
config=$data_dir/config.txt


# install in front-end's internal path by default
if [ "$installDir" != "$accaFiles" ]; then
case "$installDir" in
/data/data/*|/data/user/*)
accaFiles="$installDir"
;;
esac
fi


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


# ensure AccA's files/ exists - to prevent unwanted downgrades ###
if $acca && [ ! -d $accaFiles ]; then
mkdir -p $accaFiles
chmod 0777 ${accaFiles%/*} $accaFiles
if mkdir $accaFiles 2>/dev/null; then
chown $(stat -c %u:%g ${accaFiles%/*}) $accaFiles
chmod $(stat -c %a ${accaFiles%/*}) $accaFiles
/system/bin/restorecon $accaFiles
fi
fi


Expand Down Expand Up @@ -199,30 +213,29 @@ cp -f $srcDir/bin/${id}-uninstaller.zip $data_dir/


# Termux, fix shebang
[[ $installDir != *com.termux* ]] && termux=false || {
termux=true
for f in $installDir/*.sh; do
! grep -q '^#\!/.*/sh' $f \
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
done
}
termux=false
case "$installDir" in
*/com.termux*)
termux=true
for f in $installDir/*.sh; do
! grep -q '^#\!/.*/sh' $f \
|| sed -i 's|^#!/.*/sh|#!/data/data/com.termux/files/usr/bin/bash|' $f
done
;;
esac


# set perms
case $installDir in
/data/*/files/*$id)
pkg=${installDir%/files/*$id}
pkg=${pkg##/data*/}
owner=$(grep $pkg /data/system/packages.list | cut -d ' ' -f 2)
set_perms_recursive $installDir $owner
/data/data/*|/data/user/*)
set_perms_recursive $installDir $(stat -c %u ${installDir%/$id})

# Termux:Boot
! $termux || {
mkdir -p ${installDir%/*}/.termux/boot
ln -sf $installDir/service.sh ${installDir%/*}/.termux/boot/${id}-init.sh
chown -R $(stat -c %u:%g /data/data/com.termux) ${installDir%/*}/.termux
chmod -R 0755 ${installDir%/*}/.termux
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1
/system/bin/restorecon -R ${installDir%/*}/.termux > /dev/null 2>&1 || :
}
;;
*)
Expand Down Expand Up @@ -253,7 +266,9 @@ echo "


case $installDir in
/data/adb/*) echo "
/data/adb/modules*)
;;
*) 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
Expand Down
1,252 changes: 1,252 additions & 0 deletions README.html

Large diffs are not rendered by default.

Loading

0 comments on commit f8146e0

Please sign in to comment.