In the factory they need an automated way to shut down the device after setupwizard finishes, but we also don't want to let them talk to Android over USB on a user / locked device. When bootmode is "firstboot" (Set by bootloader), the device will wait for USB cable to be disconnected, then shut down. Bug: 110896488 Change-Id: Ic0b7d65cfc8727c74be507a858f32a68199d5fee Merged-In: Ib09460b242a7c2149f816f8a13cca698e02745e7
19 lines
493 B
Bash
Executable File
19 lines
493 B
Bash
Executable File
#!/vendor/bin/sh
|
|
|
|
# Init starts this script in the factory, to trigger shutdown after
|
|
# setupwizard has started, and USB is removed.
|
|
|
|
# wait for system to settle down after sys.boot_complete
|
|
sleep 5
|
|
|
|
# Wait for USB to be removed.
|
|
type=`cat /sys/class/power_supply/usb/typec_mode`
|
|
while [ "x$type" != "xNothing attached" ]; do
|
|
echo Wait for \"$type\" == \"Nothing attached\"
|
|
sleep 1;
|
|
type=`cat /sys/class/power_supply/usb/typec_mode`
|
|
done;
|
|
|
|
# Shutdown
|
|
setprop sys.powerctl shutdown
|