Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 1 | #!/system/bin/sh |
| 2 | |
| 3 | # Check if this script should trigger, exit quietly otherwise. |
| 4 | if [ ! -f /data/userdata_automation/trigger ]; then |
| 5 | echo >&2 "+++ SKIPPING automation setup for ATS. Trigger not set. +++" |
| 6 | exit 0 |
| 7 | fi |
| 8 | |
| 9 | settings_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. |
| 16 | echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS +++" |
| 17 | |
Prashantsinh Parmar | a7a3796 | 2021-10-21 23:29:00 +0530 | [diff] [blame] | 18 | # Following `settings put` calls must run as root from Android 11 on. The |
| 19 | # `system` user doesn't have enough permissions. |
Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 20 | |
Prashantsinh Parmar | a7a3796 | 2021-10-21 23:29:00 +0530 | [diff] [blame] | 21 | # Enable adb, system settings part |
Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 22 | settings_put global development_settings_enabled 1 |
| 23 | settings_put global verifier_verify_adb_installs 0 |
| 24 | settings_put global adb_enabled 1 |
| 25 | |
| 26 | # Skip setupwizard |
| 27 | settings_put global device_provisioned 1 |
| 28 | settings_put secure user_setup_complete 1 |
| 29 | |
Karsten Tausche | e6d0199 | 2022-09-28 14:35:13 +0200 | [diff] [blame^] | 30 | # Allow "mock" modem for Android 13 and beyond |
| 31 | setprop persist.radio.allow_mock_modem true |
| 32 | |
Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 33 | # Remove trigger so we don't run again |
| 34 | rm -v /data/userdata_automation/trigger |
| 35 | |
Karsten Tausche | 0fa3feb | 2021-10-19 11:38:44 +0200 | [diff] [blame] | 36 | echo >&2 "+++ AUTOMATION: Waiting for late boot trigger. +++" |
| 37 | while [ "$(getprop sys.boot_completed)" != "1" ]; do |
| 38 | # Full boot can take a while, especially after factory reset. |
| 39 | sleep 2 |
| 40 | done |
| 41 | |
| 42 | # Enable mobile data. Requires service `phone` to be running. |
| 43 | svc data enable |
| 44 | |
Luca Weiss | 062595a | 2021-10-05 12:01:05 +0200 | [diff] [blame] | 45 | echo >&2 "+++ TRIGGERING AUTOMATION SETUP FOR ATS DONE +++" |