summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-02-27 04:13:09 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-02-27 04:13:09 +0000
commitf70e38fac4ec744cacc6d00f846c70ffc20e1b04 (patch)
tree54e38c9afa017a99400876b12da47f589bb612b5
parent6a04dd28fdb881c16a42f873a9a90c8ac05b290d (diff)
parent58111749eb6d12ff8ef6924ad7477e04ad2e861c (diff)
downloadbonito-pie-qpr3-release.tar.gz
Snap for 5339334 from 58111749eb6d12ff8ef6924ad7477e04ad2e861c to pi-qpr3-releaseandroid-9.0.0_r46android-9.0.0_r44android-9.0.0_r43pie-qpr3-release
Change-Id: If31802e4df90b8cbf8d024d56eb3a030e5da9192
-rw-r--r--device.mk1
-rwxr-xr-xinit.firstboot.sh18
-rw-r--r--init.hardware.rc8
3 files changed, 27 insertions, 0 deletions
diff --git a/device.mk b/device.mk
index 7912c18f..e5bcdd63 100644
--- a/device.mk
+++ b/device.mk
@@ -91,6 +91,7 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \
$(LOCAL_PATH)/init.insmod.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.cfg \
$(LOCAL_PATH)/thermal-engine-$(PRODUCT_HARDWARE).conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-$(PRODUCT_HARDWARE).conf \
+ $(LOCAL_PATH)/init.firstboot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.firstboot.sh \
$(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ramoops.sh
# Edge Sense initialization script.
diff --git a/init.firstboot.sh b/init.firstboot.sh
new file mode 100755
index 00000000..05a1b856
--- /dev/null
+++ b/init.firstboot.sh
@@ -0,0 +1,18 @@
+#!/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
diff --git a/init.hardware.rc b/init.hardware.rc
index 773d251e..5a5a1468 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -842,3 +842,11 @@ on property:vendor.all.modules.ready=1
wait /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/suspend
+
+on property:sys.boot_completed=1 && property:ro.boot.mode=firstboot
+ start init-firstboot-sh
+
+service init-firstboot-sh /vendor/bin/init.firstboot.sh
+ user nobody
+ disabled
+ oneshot