-
Notifications
You must be signed in to change notification settings - Fork 6
/
customize.sh
198 lines (171 loc) · 6.88 KB
/
customize.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
#!/bin/bash
# Define "detect Volume key input" helper
chooseport() {
[ -n "$1" ] && local DELAY=$1 || local DELAY=10
[ "$2" = "YES" ] && local DEFAULT=$2 || local DEFAULT="NO"
local START_TIMESTAMP=$(date +%s)
local REMAINING_DELAY=$DELAY
ui_print "Please answer within $DELAY seconds or $DEFAULT will be assumed."
while [ "$REMAINING_DELAY" -gt 0 ]; do
timeout ${REMAINING_DELAY}s /system/bin/getevent -lqc 1 2>&1 > $TMPDIR/events &
wait $! 2>/dev/null # hide "Terminated" message
if (`grep -q 'KEY_VOLUMEUP *DOWN' $TMPDIR/events`); then
ui_print "Volume UP (+) = YES detected!"
return 0 # 0 = True
elif (`grep -q 'KEY_VOLUMEDOWN *DOWN' $TMPDIR/events`); then
ui_print "Volume DOWN (-) = NO detected!"
return 1 # 1 = False
fi
REMAINING_DELAY=$(($START_TIMESTAMP + $DELAY - $(date +%s)))
done
ui_print "Volume key could not be detected..."
if [ "$DEFAULT" = "YES" ] ; then
ui_print "Volume UP (+) = YES assumed!"
return 0 # 0 = True
else
ui_print "Volume DOWN (-) = NO assumed!"
return 1 # 1 = False
fi
}
INSTALLED_APPS=""
# Initialize installation
ui_print ""
ui_print "Installing AA dependency stubs for MicroG"
ui_print "+ XLauncher Unlocked..."
ui_print ""
ui_print "*** Please answer using volume keys ***"
ui_print "*** Volume UP (+) = YES ***"
ui_print "*** Volume DOWN (-) = NO ***"
# Request if Fake Google Maps stub dependency should be installed
ui_print ""
ui_print "*** Install Fake Google Maps stub? ***"
ui_print "(a.k.a. com.google.android.apps.maps)"
ui_print ""
if chooseport 20 "NO"; then # 0 = True, why shell why..
ui_print "Fake Google Maps stub will be installed on next reboot!"
INSTALLED_APPS="Google Maps stub"
else
rm -r "$MODPATH/system/product/app/Maps";
ui_print "Excluded Fake Google Maps stub from installation..."
fi
# Request if Fake Google Speech Services stub dependency should be installed
ui_print ""
ui_print "*** Install Fake Google Speech Services stub? ***"
ui_print "(a.k.a. com.google.android.tts)"
ui_print ""
if chooseport 10 "NO"; then # 0 = True, why shell why..
ui_print "Fake Google Speech Services stub will be installed on next reboot!"
[ -n "$INSTALLED_APPS" ] && INSTALLED_APPS="$INSTALLED_APPS,"
INSTALLED_APPS="${INSTALLED_APPS}Google Speech Services stub"
else
rm -r "$MODPATH/system/product/app/GoogleTTS";
ui_print "Excluded Fake Google Speech Services stub from installation..."
fi
# Request if Fake Google Search stub dependency should be installed
ui_print ""
ui_print "*** Install Fake Google Search stub? ***"
ui_print "(a.k.a. com.google.android.googlequicksearchbox)"
ui_print ""
if chooseport 10 "NO"; then # 0 = True, why shell why..
ui_print "Fake Google Search stub will be installed on next reboot!"
[ -n "$INSTALLED_APPS" ] && INSTALLED_APPS="$INSTALLED_APPS,"
INSTALLED_APPS="${INSTALLED_APPS}Google Search stub"
else
rm -r "$MODPATH/system/product/priv-app/Velvet";
ui_print "Excluded Fake Google Search stub from installation..."
fi
# Ask for Android Auto - XLauncher Unlocked
ui_print ""
ui_print "*** Install Android Auto - XLauncher Unlocked? ***"
ui_print "*** Recommended for enabling 3rd party apps ***"
ui_print ""
AAXLU="true"
if chooseport 10 "YES"; then
ui_print "Android Auto - XLauncher Unlocked will be installed on next reboot!"
[ -n "$INSTALLED_APPS" ] && INSTALLED_APPS="$INSTALLED_APPS,"
INSTALLED_APPS="${INSTALLED_APPS}Android Auto - XLauncher Unlocked"
else
rm -r "$MODPATH/system/product/app/XLauncherUnlocked";
ui_print "Excluded Android Auto - XLauncher Unlocked from installation..."
AAXLU="false"
fi
# Setup "vanilla" phenotype.db SQLite database, pre-patched with AA-Tweaker.
# Used to make Android Auto + apps work correctly, can be patched further with AA-Tweaker / manually.
ui_print ""
GMS_PATH=/data/data/com.google.android.gms/
PHENOTYPE_DB_PATH="$GMS_PATH"databases/
COPY_PHENOTYPE_DB="true"
if [ -f "${PHENOTYPE_DB_PATH}/phenotype.db" ] ; then
ui_print "*** Overwrite pre-existing phenotyope.db? ***"
ui_print ""
if chooseport 10 "NO"; then
ui_print "Overwriting phenotype.db"
else
ui_print "Keeping pre-existing phenotype.db"
COPY_PHENOTYPE_DB="false"
fi
fi
if [ "$COPY_PHENOTYPE_DB" = "true" ] ; then
ui_print "Creating initial 'phenotype.db'..."
GMS_OWNER=$(stat -c '%U' "$GMS_PATH")
GMS_GROUP=$(stat -c '%G' "$GMS_PATH")
# Create the folder if missing + Inject the phenotype.db file
mkdir -p "$PHENOTYPE_DB_PATH"
cp "$MODPATH""$PHENOTYPE_DB_PATH"phenotype.db \
"$PHENOTYPE_DB_PATH"phenotype.db
# Restore correct ownership
chown -R "$GMS_OWNER" "$PHENOTYPE_DB_PATH"
chgrp -R "$GMS_GROUP" "$PHENOTYPE_DB_PATH"
fi
AA_PATH=/data/data/com.google.android.projection.gearhead/
PHENOTYPE_PB_PATH="$AA_PATH"files/phenotype/shared/
if [ ! -f "${PHENOTYPE_PB_PATH}com.google.android.projection.gearhead.pb" ] ; then
# Setup "vanilla" com.google.android.projection.gearhead.pb binary file.
# CoolWalk requirement, file cannot be modified..
ui_print "Setting up additional dependencies..."
AA_OWNER=$(stat -c '%U' "$AA_PATH")
AA_GROUP=$(stat -c '%U' "$AA_PATH")
# Create the folder if missing + Inject the binary .pb file
mkdir -p "$PHENOTYPE_PB_PATH"
cp "$MODPATH""$PHENOTYPE_PB_PATH"com.google.android.projection.gearhead.pb \
"$PHENOTYPE_PB_PATH"com.google.android.projection.gearhead.pb
# Restore correct ownership
chown -R "$AA_OWNER" "$AA_PATH"files/
chgrp -R "$AA_GROUP" "$AA_PATH"files/
fi
# At this point, the module is ready for A13
# We need to make some changes for A11 and A12
if [ $API -lt 33 ] ; then
mv $MODPATH/system/product/* $MODPATH/system/
rm -rf $MODPATH/system/product
fi
if [ $API -lt 31 ] ; then
# is this really needed for A11?
if [ -f "$MODPATH/system/priv-app/Velvet/Velvet.apk" ] ; then
mkdir -p $MODPATH/system/app/QuickSearchBox
mv $MODPATH/system/priv-app/Velvet/Velvet.apk $MODPATH/system/app/QuickSearchBox/QuickSearchBox.apk
rm -rf $MODPATH/system/priv-app/Velvet
ls $MODPATH/system/app/QuickSearchBox -1
fi
fi
# Finish installation, dependency APKs will automatically be installed on reboot
ui_print ""
ui_print "Installation of"
ui_print " Android Auto 4 MicroG"
IFS=','
for INSTALLED_APP in $INSTALLED_APPS ; do
ui_print " $INSTALLED_APP"
done
ui_print "successfull! 🎉"
ui_print ""
ui_print "*** Please re-boot your device, ***"
ui_print "*** and then update Android Auto (e.g. with Aurora)! ***"
ui_print ""
if [ $AAXLU = "true" ] ; then
ui_print "*** Please also have a look at the README ***"
ui_print "*** for instructions on how to activate ***"
ui_print "*** XLauncher Unlocked's XPosed module ***"
fi
ui_print ""
ui_print ""
ui_print ""