forked from Kingsman44/Pixelify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service.sh
203 lines (181 loc) · 6.79 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#!/system/bin/sh
# Do NOT assume where your module will be located.
# ALWAYS use $MODDIR if you need to know where this script
# and module is placed.
# This will make sure your module will still work
# if Magisk change its mount point in the future
MODDIR=${0%/*}
# This script will be executed in late_start service mode
export DIALER_PREF=/data/data/com.google.android.dialer/shared_prefs/dialer_phenotype_flags.xml
export GBOARD_PREF=/data/data/com.google.android.inputmethod.latin/shared_prefs/flag_value.xml
export FIT=/data/data/com.google.android.apps.fitness/shared_prefs/growthkit_phenotype_prefs.xml
export TURBO=/data/data/com.google.android.apps.turbo/shared_prefs/phenotypeFlags.xml
temp=""
pm_enable() {
pm enable $1 > /dev/null 2>&1
log "Enabling $1"
}
log() {
date=$(date +%y/%m/%d)
tim=$(date +%H:%M:%S)
temp="$temp
$date $tim: $@"
}
set_prop() {
setprop "$1" "$2"
log "Setting prop $1 to $2"
}
bool_patch() {
file=$2
if [ -f $file ]; then
line=$(grep $1 $2 | grep false | cut -c 16- | cut -d' ' -f1)
for i in $line; do
val_false='value="false"'
val_true='value="true"'
write="${i} $val_true"
find="${i} $val_false"
log "Setting bool $(echo $i | cut -d'"' -f2) to True"
sed -i -e "s/${find}/${write}/g" $file
done
fi
}
bool_patch_false() {
file=$2
if [ -f $file ]; then
line=$(grep $1 $2 | grep false | cut -c 14- | cut -d' ' -f1)
for i in $line; do
val_false='value="true"'
val_true='value="false"'
write="${i} $val_true"
find="${i} $val_false"
log "Setting bool $i to False"
sed -i -e "s/${find}/${write}/g" $file
done
fi
}
string_patch() {
file=$3
if [ -f $file ]; then
str1=$(grep $1 $3 | grep string | cut -c 14- | cut -d'>' -f1)
for i in $str1; do
str2=$(grep $i $3 | grep string | cut -c 14- | cut -d'<' -f1)
add="$i>$2"
if [ ! "$add" == "$str2" ]; then
log "Setting string $i to $2"
sed -i -e "s/${str2}/${add}/g" $file
fi
done
fi
}
long_patch() {
file=$3
if [ -f $file ]; then
lon=$(grep $1 $3 | grep long | cut -c 17- | cut -d'"' -f1)
for i in $lon; do
str=$(grep $i $3 | grep long | cut -c 17- | cut -d'"' -f1-2)
str1=$(grep $i $3 | grep long | cut -c 17- | cut -d'"' -f1-3)
add="$str\"$2"
if [ ! "$add" == "$str1" ]; then
log "Setting string $i to $2"
sed -i -e "s/${str1}/${add}/g" $file
fi
done
fi
}
mkdir -p /sdcard/Pixelify
log "Service Started"
if [ $(grep CallScreen $MODDIR/config.prop | cut -d'=' -f2) -eq 1 ]; then
# Call Screening
bool_patch speak_easy $DIALER_PREF
bool_patch speakeasy $DIALER_PREF
bool_patch call_screen $DIALER_PREF
bool_patch revelio $DIALER_PREF
bool_patch record $DIALER_PREF
bool_patch atlas $DIALER_PREF
bool_patch transript $DIALER_PREF
cp -Tf $MODDIR/com.google.android.dialer /data/data/com.google.android.dialer/files/phenotype/com.google.android.dialer
fi
# GBoard
bool_patch nga $GBOARD_PREF
bool_patch redesign $GBOARD_PREF
bool_patch lens $GBOARD_PREF
bool_patch generation $GBOARD_PREF
bool_patch multiword $GBOARD_PREF
bool_patch voice_promo $GBOARD_PREF
bool_patch silk $GBOARD_PREF
bool_patch enable_email_provider_completion $GBOARD_PREF
bool_patch enable_multiword_predictions $GBOARD_PREF
bool_patch_false disable_multiword_autocompletion $GBOARD_PREF
bool_patch enable_inline_suggestions_on_decoder_side $GBOARD_PREF
bool_patch enable_core_typing_experience_indicator_on_composing_text $GBOARD_PREF
bool_patch enable_inline_suggestions_on_client_side $GBOARD_PREF
bool_patch enable_core_typing_experience_indicator_on_candidates $GBOARD_PREF
long_patch inline_suggestion_experiment_version 1 $GBOARD_PREF
long_patch user_history_learning_strategies 1 $GBOARD_PREF
long_patch crank_max_char_num_limit 100 $GBOARD_PREF
long_patch crank_min_char_num_limit 5 $GBOARD_PREF
long_patch keyboard_redesign 1 $GBOARD_PREF
bool_patch fast_access_bar $GBOARD_PREF
bool_patch tiresias $GBOARD_PREF
bool_patch agsa $GBOARD_PREF
bool_patch enable_voice $GBOARD_PREF
bool_patch personalization $GBOARD_PREF
bool_patch lm $GBOARD_PREF
bool_patch feature_cards $GBOARD_PREF
bool_patch dynamic_art $GBOARD_PREF
bool_patch multilingual $GBOARD_PREF
bool_patch show_suggestions_for_selected_text_while_dictating $GBOARD_PREF
#bool_patch enable_highlight_voice_reconversion_composing_text $GBOARD_PREF
#bool_patch enable_handling_concepts_for_contextual_bitmoji $GBOARD_PREF
bool_patch enable_preemptive_decode $GBOARD_PREF
bool_patch enable_show_inline_suggestions_in_popup_view $GBOARD_PREF
bool_patch enable_nebulae_materializer_v2 $GBOARD_PREF
#bool_patch use_scrollable_candidate_for_voice $GBOARD_PREF
string_patch crank_inline_suggestion_language_tags "ar,de,en,es,fr,hi-IN,hi-Latn,id,it,ja,ko,nl,pl,pt,ru,th,tr,zh-CN,zh-HK,zh-TW" $GBOARD_PREF
bool_patch_false force_key_shadows $GBOARD_PREF
# GoogleFit
bool_patch DeviceStateFeature $FIT
bool_patch TestingFeature $FIT
bool_patch Sync__sync_after_promo_shown $FIT
bool_patch Sync__use_experiment_flag_from_promo $FIT
bool_patch Promotions $FIT
bool_patch googler $FIT
bool_patch dasher $FIT
# Turbo
bool_patch AdaptiveCharging__v1_enabled $TURBO
# Wellbeing
pm_enable com.google.android.apps.wellbeing/com.google.android.apps.wellbeing.walkingdetection.ui.WalkingDetectionActivity
while true; do
boot=$(getprop sys.boot_completed)
if [ "$boot" == 1 ]; then
sleep 10
break
fi
done
if [ $(grep CallScreen $MODDIR/config.prop | cut -d'=' -f2) -eq 1 ]; then
mkdir -p /data/data/com.google.android.dialer/files/phenotype
cp -Tf $MODDIR/com.google.android.dialer /data/data/com.google.android.dialer/files/phenotype/com.google.android.dialer
chmod 500 /data/data/com.google.android.dialer/files/phenotype
am force-stop com.google.android.dialer
fi
flip_perm="android.permission.READ_DEVICE_CONFIG
android.permission.SUSPEND_APPS
android.permission.QUERY_ALL_PACKAGES
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.FOREGROUND_SERVICE
android.permission.SYSTEM_ALERT_WINDOW
android.permission.WRITE_SECURE_SETTINGS
android.permission.WRITE_SETTINGS
android.permission.REAL_GET_TASKS
android.permission.INTERACT_ACROSS_USERS_FULL
android.permission.KILL_BACKGROUND_PROCESSES
android.permission.MODIFY_QUIET_MODE
android.permission.INTERACT_ACROSS_PROFILES
android.permission.CONTROL_DISPLAY_COLOR_TRANSFORMS
android.permission.TETHER_PRIVILEGED
android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"
for i in $flip_perm; do
pm grant com.google.android.flipendo $i
done
log "Service Finished"
echo "$temp" >> /sdcard/Pixelify/logs.txt