blob: decf742fbfab4d09e0b7eb700b9c8c6ac503f50f [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
30# Remove trigger so we don't run again
31rm -v /data/userdata_automation/trigger
32
Karsten Tausche0fa3feb2021-10-19 11:38:44 +020033echo >&2 "+++ AUTOMATION: Waiting for late boot trigger. +++"
34while [ "$(getprop sys.boot_completed)" != "1" ]; do
35 # Full boot can take a while, especially after factory reset.
36 sleep 2
37done
38
39# Enable mobile data. Requires service `phone` to be running.
40svc data enable
41
Luca Weiss062595a2021-10-05 12:01:05 +020042echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS DONE +++"