blob: 0229bff9dadf926f16eba8afb181a6163b7ade6e [file] [log] [blame]
Luca Weiss062595a2021-10-05 12:01:05 +02001#!/system/bin/sh
2
3# Check if this script should trigger, exit quietly otherwise.
4if [ ! -f /data/userdata_automation/trigger ]; then
5 echo >&2 "+++ SKIPPING automation setup for ATS. Trigger not set. +++"
6 exit 0
7fi
8
9settings_put() {
10 echo >&2 "[automation_setup] settings put $*"
11 # -w: Wait for the service to be ready, as we're running in early boot
12 cmd -w settings put "$@"
13}
14
15# Output on stderr, to be picked up via stdio_to_kmsg on kmsg.
16echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS +++"
17
Prashantsinh Parmara7a37962021-10-21 23:29:00 +053018# Following `settings put` calls must run as root from Android 11 on. The
19# `system` user doesn't have enough permissions.
Luca Weiss062595a2021-10-05 12:01:05 +020020
Prashantsinh Parmara7a37962021-10-21 23:29:00 +053021# Enable adb, system settings part
Luca Weiss062595a2021-10-05 12:01:05 +020022settings_put global development_settings_enabled 1
23settings_put global verifier_verify_adb_installs 0
24settings_put global adb_enabled 1
25
26# Skip setupwizard
27settings_put global device_provisioned 1
28settings_put secure user_setup_complete 1
29
Karsten Tauschee6d01992022-09-28 14:35:13 +020030# Allow "mock" modem for Android 13 and beyond
31setprop persist.radio.allow_mock_modem true
32
Luca Weiss062595a2021-10-05 12:01:05 +020033# Remove trigger so we don't run again
34rm -v /data/userdata_automation/trigger
35
Karsten Tausche0fa3feb2021-10-19 11:38:44 +020036echo >&2 "+++ AUTOMATION: Waiting for late boot trigger. +++"
37while [ "$(getprop sys.boot_completed)" != "1" ]; do
38 # Full boot can take a while, especially after factory reset.
39 sleep 2
40done
41
42# Enable mobile data. Requires service `phone` to be running.
43svc data enable
44
Luca Weiss062595a2021-10-05 12:01:05 +020045echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS DONE +++"