-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
service.sh
129 lines (103 loc) · 3.44 KB
/
service.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
MODPATH=${0%/*}
# log
exec 2>$MODPATH/debug.log
set -x
# var
API=`getprop ro.build.version.sdk`
# prop
resetprop -n ro.samsung.display.device.type 0
# wait
until [ "`getprop sys.boot_completed`" == 1 ]; do
sleep 10
done
# list
PKGS="`cat $MODPATH/package.txt`
com.samsung.android.app.galaxyfinder:receiver
com.samsung.android.app.galaxyfinder:local
com.samsung.android.app.galaxyfinder:appservice"
for PKG in $PKGS; do
magisk --denylist rm $PKG 2>/dev/null
magisk --sulist add $PKG 2>/dev/null
done
if magisk magiskhide sulist; then
for PKG in $PKGS; do
magisk magiskhide add $PKG
done
else
for PKG in $PKGS; do
magisk magiskhide rm $PKG
done
fi
# function
grant_permission() {
pm grant $PKG android.permission.READ_EXTERNAL_STORAGE
pm grant $PKG android.permission.WRITE_EXTERNAL_STORAGE
if [ "$API" -ge 29 ]; then
pm grant $PKG android.permission.ACCESS_MEDIA_LOCATION 2>/dev/null
appops set $PKG ACCESS_MEDIA_LOCATION allow
fi
if [ "$API" -ge 33 ]; then
pm grant $PKG android.permission.READ_MEDIA_AUDIO 2>/dev/null
pm grant $PKG android.permission.READ_MEDIA_VIDEO
pm grant $PKG android.permission.READ_MEDIA_IMAGES
appops set $PKG ACCESS_RESTRICTED_SETTINGS allow
fi
appops set $PKG LEGACY_STORAGE allow
appops set $PKG READ_EXTERNAL_STORAGE allow
appops set $PKG WRITE_EXTERNAL_STORAGE allow
appops set $PKG READ_MEDIA_AUDIO allow
appops set $PKG READ_MEDIA_VIDEO allow
appops set $PKG READ_MEDIA_IMAGES allow
appops set $PKG WRITE_MEDIA_AUDIO allow
appops set $PKG WRITE_MEDIA_VIDEO allow
appops set $PKG WRITE_MEDIA_IMAGES allow
if [ "$API" -ge 30 ]; then
appops set $PKG MANAGE_EXTERNAL_STORAGE allow
appops set $PKG NO_ISOLATED_STORAGE allow
appops set $PKG AUTO_REVOKE_PERMISSIONS_IF_UNUSED ignore
fi
if [ "$API" -ge 31 ]; then
appops set $PKG MANAGE_MEDIA allow
fi
PKGOPS=`appops get $PKG`
UID=`dumpsys package $PKG 2>/dev/null | grep -m 1 Id= | sed -e 's| userId=||g' -e 's| appId=||g'`
if [ "$UID" ] && [ "$UID" -gt 9999 ]; then
appops set --uid "$UID" LEGACY_STORAGE allow
appops set --uid "$UID" READ_EXTERNAL_STORAGE allow
appops set --uid "$UID" WRITE_EXTERNAL_STORAGE allow
if [ "$API" -ge 29 ]; then
appops set --uid "$UID" ACCESS_MEDIA_LOCATION allow
fi
if [ "$API" -ge 34 ]; then
appops set --uid "$UID" READ_MEDIA_VISUAL_USER_SELECTED allow
fi
UIDOPS=`appops get --uid "$UID"`
fi
}
# grant
PKG=com.sec.android.app.launcher
appops set $PKG SYSTEM_ALERT_WINDOW allow
appops set $PKG GET_USAGE_STATS allow
pm grant $PKG android.permission.READ_PHONE_STATE
pm grant $PKG android.permission.CALL_PHONE
pm grant $PKG android.permission.READ_CONTACTS
# grant
PKG=com.samsung.android.rubin.app
#pm grant $PKG android.permission.READ_SMS
#pm grant $PKG android.permission.READ_CALL_LOG
pm grant $PKG android.permission.READ_CALENDAR
pm grant $PKG android.permission.ACCESS_FINE_LOCATION
pm grant $PKG android.permission.ACCESS_COARSE_LOCATION
#pm grant $PKG android.permission.PROCESS_OUTGOING_CALLS
pm grant $PKG android.permission.GET_ACCOUNTS
pm grant $PKG android.permission.ACTIVITY_RECOGNITION
pm grant $PKG android.permission.ACCESS_BACKGROUND_LOCATION
pm grant $PKG android.permission.READ_CONTACTS
grant_permission
# grant
PKG=com.samsung.android.app.galaxyfinder
pm grant $PKG android.permission.ACCESS_FINE_LOCATION
pm grant $PKG android.permission.ACCESS_COARSE_LOCATION
pm grant $PKG android.permission.READ_CONTACTS
appops set $PKG SYSTEM_ALERT_WINDOW allow
grant_permission