Skip to content

Commit d8e201e

Browse files
committed
Upload file
1 parent bf9cb36 commit d8e201e

7 files changed

Lines changed: 266 additions & 40 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Add-on
2+
id=apk_utilities
3+
name=Apk patch
4+
author=Kakathic
5+
description=Many small amenities
6+
version=1.0
7+
versionCode=100
8+
root=false
9+
10+
# language
11+
home_text_1="Patch apk"
12+
select_text_1="Options"
13+
clean_text_1="Project"
14+
clean_text_2="Present:"
15+
clean_text_3="Remove language"
16+
clean_text_4="Select the languages you want to delete"
17+
clean_text_5="Deleted:"
18+
google_text="Currently using google translate"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Kakathic
2+
MPAT="${0%/*}"
3+
chmod -R 777 "$MPAT"
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/data/data/com.tool.tree/files/home/bin/bash
2+
# kakathic
3+
4+
# clean
5+
clean(){
6+
if [ -n "$(glog project_apk_clean)" ];then
7+
show_clean=1
8+
path_clean="$(glog project_apk_clean)"
9+
fi
10+
xml_print '
11+
<group>
12+
<action shell="hidden" reload="true">
13+
<title>'$clean_text_1'</title>
14+
<summary>'$clean_text_2' '"$path_clean"'</summary>
15+
<param name="project" label="'$select_text_1'" options-sh="cd $APK/$PTAH; ls -1d */apktool.yml */archive-info.json | sed -e '"'s|/apktool.yml||'"' -e '"'s|/archive-info.json||'"' " value-sh="glog project_apk_clean" required="true" />
16+
<set>slog project_apk_clean "$project"</set>
17+
</action>
18+
</group>
19+
20+
<group>
21+
<action reload="true" visible="echo '$show_clean'">
22+
<title>'$clean_text_3'</title>
23+
<param name="LIST" desc="'$clean_text_4'" multiple="multiple" options-sh="cd $APK/$PTAH/'$path_clean'; ls -1d resources/package_1/res/values-*/strings.xml res/values-*/strings.xml | sed -e '"'s|resources/package_1/||'"' -e '"'s|res/||'"' -e '"'s|/strings.xml||'"' "/>
24+
<set>
25+
for vv in $LIST; do
26+
echo "'$clean_text_5' $vv"
27+
if [ -d "$APK/$PTAH/'$path_clean'/resources/package_1/res" ];then
28+
rm -fr "$APK/$PTAH/'$path_clean'/resources/package_1/res/$vv"
29+
elif [ -d "$APK/$PTAH/'$path_clean'/res" ];then
30+
rm -fr "$APK/$PTAH/'$path_clean'/res/$vv"
31+
fi
32+
done
33+
</set>
34+
</action>
35+
</group>'
36+
}
37+
38+
# home
39+
home(){
40+
xml_print '<group title="'$trans_text'">
41+
<page title="'$home_text_1'" config-sh="'$MPAT'/index.sh clean"/>
42+
</group>'
43+
}
44+
45+
# Thư mục hiện tại
46+
MPAT="${0%/*}"
47+
48+
# Ngôn ngữ mặc định
49+
eval "$(sed '1,/root=/d' $MPAT/addon.prop)"
50+
51+
# Tự động dịch
52+
if [ "$(glog "auto_trans_text_${MPAT##*/}")" == 1 ];then
53+
sum_md5="$(sha256sum -b $MPAT/addon.prop)"
54+
if [[ "$sum_md5" != "$(glog "sum_md5_${MPAT##*/}")" ]] || [[ ! -f $MPAT/auto.prop ]] || [[ "$(grep -cm1 '=\"\"' $MPAT/auto.prop)" == 1 ]];then
55+
[ -f $MPAT/auto.prop ] && rm -fr $MPAT/auto.prop
56+
for vc in $(grep -e '="' $MPAT/addon.prop | cut -d= -f1); do
57+
echo -e "${vc}=\"$(echo "${!vc}" | trans $LANGUAGE-$COUNTRY | awk '{ $0 = toupper(substr($0,1,1)) substr($0,2); print }')\" #${!vc}" >>$MPAT/auto.prop &
58+
done
59+
wait
60+
if [[ "$(grep -cm1 '=\"\"' $MPAT/auto.prop)" == 1 ]];then
61+
sed -i '/=\"\"/d' $MPAT/auto.prop
62+
else
63+
slog "sum_md5_${MPAT##*/}" "$sum_md5"
64+
fi
65+
fi
66+
[[ -f $MPAT/auto.prop ]] && source $MPAT/auto.prop
67+
trans_text="$google_text"
68+
fi
69+
70+
# index
71+
echo '<?xml version="1.0" encoding="UTF-8" ?>
72+
<group>'
73+
case "$1" in
74+
home|clean)
75+
"$1"
76+
;;
77+
*)
78+
cat "$ETC/error.xml"
79+
;;
80+
esac
81+
echo '</group>'
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Kakathic
2+
MPAT="${0%/*}"
3+
source language 2>/dev/null
4+
echo '
5+
<option type="default" id="v1" auto-off="true" reload="true" interruptible="false" >'$google_translate_text'</option>
6+
<handler>
7+
if [ "$menu_id" == "v1" ];then
8+
[ "$(glog auto_trans_text_'${MPAT##*/}')" == 1 ] && slog auto_trans_text_'${MPAT##*/}' 0 || slog auto_trans_text_'${MPAT##*/}' 1
9+
fi
10+
</handler>
11+
'
Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# Add-on
22
id=online_utilities
3-
name=Apk utility
3+
name=Utility
44
author=Kakathic
55
description=Many small amenities
66
version=1.0
77
versionCode=100
88
root=false
99

1010
# language
11-
home_text_1="Patch apk"
12-
select_text_1="Options"
13-
clean_text_1="Project"
14-
clean_text_2="Present:"
15-
clean_text_3="Remove language"
16-
clean_text_4="Select the languages you want to delete"
17-
clean_text_5="Deleted:"
1811
google_text="Currently using google translate"
12+
13+
fs_text_1="Run fstrim to clean up blocks"
14+
fs_text_2="Clean block"
15+
fs_text_3="Root access is required"
16+
fs_text_4="Clean blocks:"
17+
18+
ufs_text_1="EOL status:"
19+
ufs_text_2="Unknown"
20+
ufs_text_3="Wear level:"
21+
ufs_text_4="Exceeded lifespan"
22+
ufs_text_5="Warning"
23+
ufs_text_6="Normal"
24+
25+
check_ufs_text="UFS check"
26+
check_ufs_text_1="Measuring reading speed..."
27+
check_ufs_text_2="Measuring recording speed..."

pio/src/main/assets/module/ZAPK/online_utilities/index.sh

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,48 @@
11
#!/data/data/com.tool.tree/files/home/bin/bash
22
# kakathic
33

4-
# clean
5-
clean(){
6-
if [ -n "$(glog project_apk_clean)" ];then
7-
show_clean=1
8-
path_clean="$(glog project_apk_clean)"
9-
fi
10-
xml_print '
11-
<group>
12-
<action shell="hidden" reload="true">
13-
<title>'$clean_text_1'</title>
14-
<summary>'$clean_text_2' '"$path_clean"'</summary>
15-
<param name="project" label="'$select_text_1'" options-sh="cd $APK/$PTAH; ls -1d */apktool.yml */archive-info.json | sed -e '"'s|/apktool.yml||'"' -e '"'s|/archive-info.json||'"' " value-sh="glog project_apk_clean" required="true" />
16-
<set>slog project_apk_clean "$project"</set>
4+
# home
5+
home(){
6+
[ "$ROT" == 0 ] && text_root="ROOT: $ROOT" || text_rr="$fs_text_1"
7+
xml_print '<group>
8+
<action title="'$check_ufs_text'" summary="'$text_root'">
9+
<lock>
10+
[ "$ROT" == 0 ] && echo "'$fs_text_3'" || echo 0
11+
</lock>
12+
<set>
13+
export MPAT='$MPAT'
14+
'$MPAT'/scrip/ufs.sh
15+
</set>
1716
</action>
1817
</group>
1918
2019
<group>
21-
<action reload="true" visible="echo '$show_clean'">
22-
<title>'$clean_text_3'</title>
23-
<param name="LIST" desc="'$clean_text_4'" multiple="multiple" options-sh="cd $APK/$PTAH/'$path_clean'; ls -1d resources/package_1/res/values-*/strings.xml res/values-*/strings.xml | sed -e '"'s|resources/package_1/||'"' -e '"'s|res/||'"' -e '"'s|/strings.xml||'"' "/>
20+
<action title="'$fs_text_2'" desc="'$text_rr'" summary="'$text_root'">
21+
<lock>
22+
[ "$ROT" == 0 ] && echo "'$fs_text_3'" || echo 0
23+
</lock>
2424
<set>
25-
for vv in $LIST; do
26-
echo "'$clean_text_5' $vv"
27-
if [ -d "$APK/$PTAH/'$path_clean'/resources/package_1/res" ];then
28-
rm -fr "$APK/$PTAH/'$path_clean'/resources/package_1/res/$vv"
29-
elif [ -d "$APK/$PTAH/'$path_clean'/res" ];then
30-
rm -fr "$APK/$PTAH/'$path_clean'/res/$vv"
31-
fi
32-
done
25+
echo "'$fs_text_4' /data"
26+
fstrim /data;
27+
echo "'$fs_text_4' /cache"
28+
fstrim /cache
29+
echo "'$fs_text_4' auto"
30+
echo
31+
sm fstrim
32+
echo
33+
checktime
3334
</set>
3435
</action>
35-
</group>'
36-
}
37-
38-
# home
39-
home(){
40-
xml_print '<group title="'$trans_text'">
41-
<page title="'$home_text_1'" config-sh="'$MPAT'/index.sh clean"/>
4236
</group>
4337
4438
<group>
4539
<page html="https://zenlua.github.io/Tool-Tree/add-on/web/terminal.html" title="Web Terminal" />
40+
</group>
41+
42+
<group>
4643
<page html="https://zenlua.github.io/Tool-Tree/add-on/web/manager.html" title="Web Manager" />
47-
</group>'; }
44+
</group>'
45+
}
4846

4947
# Thư mục hiện tại
5048
MPAT="${0%/*}"
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
if [ -e $MPAT/auto.prop ]; then
3+
source $MPAT/auto.prop
4+
else
5+
eval "$(sed '1,/root=/d' $MPAT/addon.prop)"
6+
fi
7+
8+
bDeviceLifeTimeEstA=""
9+
10+
# --- Life Time Estimation A ---
11+
if [ -f /sys/devices/platform/soc/1d84000.ufshc/health_descriptor/life_time_estimation_a ]; then
12+
bDeviceLifeTimeEstA=$(cat /sys/devices/platform/soc/1d84000.ufshc/health_descriptor/life_time_estimation_a)
13+
14+
elif [ -f /sys/devices/virtual/mi_memory/mi_memory_device/ufshcd0/dump_health_desc ]; then
15+
bDeviceLifeTimeEstA=$(grep bDeviceLifeTimeEstA \
16+
/sys/devices/virtual/mi_memory/mi_memory_device/ufshcd0/dump_health_desc \
17+
| cut -d '=' -f2 | awk '{print $1}')
18+
19+
else
20+
bDeviceLifeTimeEstA=$(grep bDeviceLifeTimeEstA \
21+
/sys/kernel/debug/*.ufshc/dump_health_desc 2>/dev/null \
22+
| cut -d '=' -f2 | awk '{print $1}')
23+
fi
24+
25+
dump_files=$(find /sys -name "dump_*_desc" 2>/dev/null | grep ufshc)
26+
27+
if [ -z "$bDeviceLifeTimeEstA" ]; then
28+
for line in $dump_files; do
29+
str=$(grep bDeviceLifeTimeEstA "$line" | cut -d '=' -f2 | awk '{print $1}')
30+
[ -n "$str" ] && bDeviceLifeTimeEstA="$str" && break
31+
done
32+
fi
33+
34+
if [ -z "$bDeviceLifeTimeEstA" ]; then
35+
for line in $(find /sys -name "life_time_estimation_a" 2>/dev/null | grep ufshc); do
36+
str=$(cat "$line")
37+
[ -n "$str" ] && bDeviceLifeTimeEstA="$str" && break
38+
done
39+
fi
40+
41+
case "$bDeviceLifeTimeEstA" in
42+
0x00|0x0) echo "$ufs_text_3 $ufs_text_2" ;;
43+
0x01|0x1) echo "$ufs_text_3 0% ~ 10%" ;;
44+
0x02|0x2) echo "$ufs_text_3 10% ~ 20%" ;;
45+
0x03|0x3) echo "$ufs_text_3 20% ~ 30%" ;;
46+
0x04|0x4) echo "$ufs_text_3 30% ~ 40%" ;;
47+
0x05|0x5) echo "$ufs_text_3 40% ~ 50%" ;;
48+
0x06|0x6) echo "$ufs_text_3 50% ~ 60%" ;;
49+
0x07|0x7) echo "$ufs_text_3 60% ~ 70%" ;;
50+
0x08|0x8) echo "$ufs_text_3 70% ~ 80%" ;;
51+
0x09|0x9) echo "$ufs_text_3 80% ~ 90%" ;;
52+
0x0A|0xA) echo "$ufs_text_3 90% ~ 100%" ;;
53+
0x0B|0xB) echo "$ufs_text_3 $ufs_text_4" ;;
54+
*) echo "$ufs_text_3 $ufs_text_2" ;;
55+
esac
56+
echo
57+
58+
# --- Pre EOL Info ---
59+
bPreEOLInfo=""
60+
61+
if [ -f /sys/devices/platform/soc/1d84000.ufshc/health_descriptor/eol_info ]; then
62+
bPreEOLInfo=$(cat /sys/devices/platform/soc/1d84000.ufshc/health_descriptor/eol_info)
63+
64+
elif [ -f /sys/devices/virtual/mi_memory/mi_memory_device/ufshcd0/dump_health_desc ]; then
65+
bPreEOLInfo=$(grep bPreEOLInfo \
66+
/sys/devices/virtual/mi_memory/mi_memory_device/ufshcd0/dump_health_desc \
67+
| cut -d '=' -f2 | awk '{print $1}')
68+
69+
else
70+
bPreEOLInfo=$(grep bPreEOLInfo \
71+
/sys/kernel/debug/*.ufshc/dump_health_desc 2>/dev/null \
72+
| cut -d '=' -f2 | awk '{print $1}')
73+
fi
74+
75+
if [ -z "$bPreEOLInfo" ]; then
76+
for line in $dump_files; do
77+
str=$(grep bPreEOLInfo "$line" | cut -d '=' -f2 | awk '{print $1}')
78+
[ -n "$str" ] && bPreEOLInfo="$str" && break
79+
done
80+
fi
81+
82+
if [ -z "$bPreEOLInfo" ]; then
83+
for line in $(find /sys -name "eol_info" 2>/dev/null | grep ufshc); do
84+
str=$(cat "$line")
85+
[ -n "$str" ] && bPreEOLInfo="$str" && break
86+
done
87+
fi
88+
89+
case "$bPreEOLInfo" in
90+
0x00|0x0) echo "$ufs_text_1 $ufs_text_2" ;;
91+
0x01|0x1) echo "$ufs_text_1 $ufs_text_6" ;;
92+
0x02|0x2) echo "$ufs_text_1 $ufs_text_5" ;;
93+
0x03|0x3) echo "$ufs_text_1 $ufs_text_4" ;;
94+
*) echo "$ufs_text_1 $ufs_text_2" ;;
95+
esac
96+
97+
echo
98+
echo "$check_ufs_text_2"
99+
echo
100+
dd if=/dev/zero of=${0%/*}/test.bin bs=4M count=256 conv=fsync
101+
102+
echo
103+
echo "$check_ufs_text_1"
104+
echo
105+
dd if=${0%/*}/test.bin of=/dev/null bs=4M
106+
rm -fr ${0%/*}/test.bin

0 commit comments

Comments
 (0)