-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathandroid8_prepare.sh
More file actions
executable file
·175 lines (140 loc) · 6.43 KB
/
android8_prepare.sh
File metadata and controls
executable file
·175 lines (140 loc) · 6.43 KB
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
#!/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
###############################
# if there are any parameters on the url then this is a DE1+ tablet pre, otherwise this is a DE1 tablet prep
tableterase=0
if [ "$1" != "" ]
then
tableterase=1;
fi
###############################
# optional: reset the tablet to factory settings (requires user to then proceed through setup menu)
if [ $tableterase = 1 ]
then
adb shell am broadcast -a android.intent.action.MASTER_CLEAR;
sleep 60
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 2; done; input keyevent 3'
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 2; done; input keyevent 3'
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 2; done; input keyevent 3'
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 2; done; input keyevent 3'
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 2; done; input keyevent 3'
fi
###############################
# go to home screen
adb shell input keyevent KEYCODE_HOME
###############################
###############################
# make the display bright
echo "Setting screen brightness to max"
adb shell 'echo 255 > /sys/devices/platform/leds-mt65xx/leds/lcd-backlight/brightness'
###############################
###############################
# 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
###############################
###############################
# disable screen swipe lock
echo "Disabling screen swipe to lock"
adb shell am force-stop com.android.settings
#sleep 0.3
adb shell input keyevent KEYCODE_HOME
sleep 0.3
adb shell am start -a android.intent.action.MAIN -n com.android.settings/.SecuritySettings
#sleep 0.3
adb shell input tap 700 200
sleep 0.3
adb shell input tap 700 150
sleep 0.5
adb shell am force-stop com.android.settings
###############################
###############################
# enable file copying over USB
#adb shell svc usb setFunction adb,mtp
###############################
###############################
# 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"
# john 19-11-19 not needed for android 8.1 as BLE is on by default
#adb shell service call bluetooth_manager 8
#adb shell service call bluetooth_manager 6
###############################
###############################
# copy our source files over
echo "Copying DE1+ software"
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 DE1+ software"
adb shell cp -R /sdcard/de1plus /sdcard/backup_de1plus &
###############################
###############################
# install androwish
echo "Installing Androwish"
adb install android/androwish.apk
###############################
###############################
# install wallpaper
#adb pull /data/system/users/0/wallpaper
#adb pull /data/system/users/0/wallpaper_info.xml
echo "Setting wallpaper"
adb push android/wallpaper_info.xml /data/system/users/0/wallpaper_info.xml
adb push wallpaper/spy_1280x800.jpg /data/system/users/0/wallpaper
###############################
###############################
# 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
# 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
echo "Creating de1+ icon"
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+ icon"
adb shell input tap 900 530
adb shell am force-stop tk.tcl.wish
sleep 1
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
adb push android/launcher.db.de1plus81 /data/data/com.android.launcher3/databases/launcher.db
adb shell am force-stop com.android.launcher3
#adb push android/app_icons.db81 /data/data/com.android.launcher3/databases/app_icons.db
#adb push android/widgetpreviews.db81 /data/data/com.android.launcher3/databases/widgetpreviews.db
###############################
###############################
# install Chrome
echo "Installing Chrome"
adb install android/chrome.apk
###############################
###############################
# install Chrome
echo "Installing File Manager +"
adb install android/filemanager.apk
###############################
adb shell am restart