-
Notifications
You must be signed in to change notification settings - Fork 3
/
teclast_prepare.sh
executable file
·251 lines (211 loc) · 8.63 KB
/
teclast_prepare.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/bin/bash
###############################
# NOTES:
# first put the tablet manually into adb-receptive mode
# user must go to "settings/about" and tap repeatedly on "build number"
# user then chooses "developer options" and "developer options: on" and then "usb debugging: on"
#
# keycode docs: http://thecodeartist.blogspot.hk/2011/03/simulating-keyevents-on-android-device.html https://developer.android.com/reference/android/view/KeyEvent.html http://publish.illinois.edu/weiyang-david/2013/08/08/code-numbers-for-adb-input/
# more keycode docs: https://stackoverflow.com/questions/7789826/adb-shell-input-events
###############################
echo "disable screen rotation"
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
###############################
# go to home screen
adb shell input keyevent KEYCODE_HOME
###############################
###############################
# make the display bright
echo "Setting screen brightness to max"
adb shell settings put system screen_brightness 255
###############################
###############################
# set screen timeout to 30 minutes, when not plugged in
# note: maybe not needed any longer since we are replacing the global settings.db
echo "Setting screen timeout to 'never'"
adb shell settings put system screen_off_timeout 2147483646
adb shell svc power stayon true
# and for good measure disable screen timeout while plugged in
# note: maybe not needed any longer since we are replacing the global settings.db
#echo "Setting screen on when plugged in"
#adb shell settings put global stay_on_while_plugged_in 3
###############################
echo "lower volume to zero"
# from https://developer.android.com/reference/android/view/KeyEvent
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
adb shell input keyevent KEYCODE_VOLUME_DOWN
###############################
###############################
# disable screen swipe lock
echo "Disabling screen swipe to lock"
adb shell am start -a android.settings.SECURITY_SETTINGS
sleep 0.5
adb shell input tap 700 600
sleep 0.3
adb shell input tap 200 150
sleep 0.5
adb shell am force-stop com.android.settings
###############################
###############################
# enable file copying over USB
#adb shell svc usb setFunction adb,mtp
###############################
###############################
echo "enable 'show taps' on screen"
adb shell content insert --uri content://settings/system --bind name:s:show_touches --bind value:i:1
###############################
###############################
# disable Google FTP account locking feature, as it's very annoying
# https://blog.sombex.com/2018/01/all-adb-and-fastboot-commands-to-remove-frp-lock-on-android-phones.html
adb shell content insert --uri content://settings/secure --bind name:s:user_setup_complete --bind value:s:1
###############################
###############################
# enable bluetooth
echo "Enabling bluetooth"
adb shell am start -a android.settings.BLUETOOTH_SETTINGS
sleep 0.5
adb shell input tap 200 300
sleep 0.5
adb shell am force-stop com.android.settings
###############################
###############################
# copy our source files over
echo "Copying Tablet App"
#adb shell rm -rf /mnt/sdcard/de1plus
#adb shell rm -rf /mnt/sdcard/backup_de1plus
adb push /d/download/sync/de1plus /mnt/sdcard/de1plus
echo "Making backup on tablet of tablet app"
adb shell cp -R /sdcard/de1plus /sdcard/backup_de1plus &
###############################
###############################
# install File Manager +
echo "Installing File Manager +"
adb install android/filemanager.apk
###############################
###############################
# disable google home screen app
echo "disable google home screen app "
adb shell input draganddrop 200 200 200 200 1000
adb shell input tap 365 425
adb shell input tap 1233 163
adb shell input keyevent KEYCODE_HOME
###############################
# install wallpaper
echo "Setting wallpaper"
adb shell am start -a android.intent.action.ATTACH_DATA -c android.intent.category.DEFAULT -d file:///mnt/sdcard/de1plus/wallpaper/spy_2560x1600.jpg -t 'image/*' -e mimeType 'image/*'
sleep 2
adb shell input tap 610 630
sleep 2
adb shell input tap 910 690
sleep 3
adb shell input tap 140 50
sleep 3
adb shell input tap 450 480
sleep 1
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
sleep 1
adb shell am force-stop com.android.settings
sleep 0.3
adb shell input keyevent KEYCODE_HOME
sleep 0.3
###############################
###############################
# install androwish
echo "Installing Androwish"
adb install android/androwish.apk
sleep 0.3
adb shell am start -W -n tk.tcl.wish/.AndroWishLauncher -a android.intent.action.ACTION_VIEW
sleep 2
# supressing "old app" warning
adb shell input tap 963 450
sleep 1
adb shell am force-stop tk.tcl.wish
###############################
###############################
# enable do not disturb
echo "Enable 'do not disturb' to stop annoying 'wifi available' Android sounds"
adb shell input draganddrop 640 13 640 400 100
adb shell input tap 605 125
adb shell input tap 200 200
###############################
# replace the launcher3 database with our own, which moves the icons where we want them and removes all tne toolbar noise of all those google icons
# from android Launcher3-aosp-release.apk
# need to apk install it and then run it, and then make it the default
# Android 10 P80H uses a launcher that does not accept icon creation, so we need to replace it
# adb pull /data/data/com.android.launcher3/databases/launcher.db android/launcher.db.de1plus81b
# adb pull /data/data/com.android.launcher3/databases/app_icons.db android/app_icons.db81b
# adb pull /data/data/com.android.launcher3/databases/widgetpreviews.db android/widgetpreviews.db81b
# remove 3 icons on the bottom
echo "Remove 3 icons on the bottom"
adb shell input draganddrop 170 650 25 100 100
sleep 0.3
adb shell input draganddrop 340 650 25 100 100
sleep 0.3
adb shell input draganddrop 1050 650 25 100 100
sleep 0.3
# remove sidebar icons
echo "Remove sidebar icons"
adb shell input draganddrop 1250 650 25 100 100
sleep 0.3
adb shell input draganddrop 1250 650 25 100 100
sleep 0.3
adb shell input draganddrop 1250 650 25 100 100
sleep 0.3
adb shell input draganddrop 1250 560 25 100 100
sleep 0.3
adb shell input draganddrop 1250 390 25 100 100
sleep 0.3
echo "Creating decent app icon"
#adb shell 'echo default_font_calibration .6 >>/mnt/sdcard/de1plus/settings.tdb'
adb shell am start -W -n tk.tcl.wish/.AndroWishLauncher -a android.intent.action.ACTION_VIEW -e arg file:///sdcard/de1plus/create_de1plus_icon.tcl
sleep 3
echo "Tapping on system dialog to accept de1 app icon"
adb shell input tap 900 530
sleep 1
adb shell am force-stop tk.tcl.wish
sleep 1
# move the Decent icon
echo "Move the de1 app icon"
adb shell input draganddrop 160 120 600 400 100
sleep 0.3
echo "Creating cloud update icon"
adb shell am start -W -n tk.tcl.wish/.AndroWishLauncher -a android.intent.action.ACTION_VIEW -e arg file:///sdcard/de1plus/create_de1_update_icon.tcl
sleep 3
echo "Tapping on system dialog to accept cloud upload icon"
adb shell input tap 900 530
sleep 1
adb shell am force-stop tk.tcl.wish
# move the cloud update icon
echo "Move the de1 cloud update app icon"
adb shell input draganddrop 160 120 700 400 100
sleep 0.3
# moveing back to home page
adb shell input keyevent KEYCODE_HOME
echo "enable screen rotation"
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:1
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1
###############################
echo "connect to decent wifi"
adb shell am start -a android.settings.WIFI_SETTINGS
sleep 0.5
adb shell input tap 640 245
sleep 0.5
adb shell input text decent99
sleep 0.5
adb shell input keyevent 66
# run decent app to confirm
echo "run decent app to confirm"
adb shell am start -W -n tk.tcl.wish/.AndroWishLauncher -a android.intent.action.ACTION_VIEW -e arg file:///sdcard/de1plus/de1plus.tcl
###############################
# disable developer mode so that people aren't asked if they want to trust this pc
# adb shell settings put global development_settings_enabled 0
# adb reboot