summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-03-12 15:26:47 +0100
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2021-03-12 15:32:27 +0100
commit4a29cc58608439ffe96c869145f4f0c97971826c (patch)
treeac895083fc44348308dfa4ed91ae3fa26a7eb8ca
parentf111e65b7dccb06e40468f516cc57464594dbb13 (diff)
downloadvendor_replicant-scripts-4a29cc58608439ffe96c869145f4f0c97971826c.tar.gz
vendor_replicant-scripts-4a29cc58608439ffe96c869145f4f0c97971826c.tar.bz2
vendor_replicant-scripts-4a29cc58608439ffe96c869145f4f0c97971826c.zip
Add scripts to reboot and off shutdown the device cleanlyreplicant-6.0-0004-rc5-transitionreplicant-6.0-0004-rc5
This can be convenient when using the shell. Alternatively it could also help users with broken power buttons. Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r--power/Android.mk14
-rwxr-xr-xpower/device-files/reboot.sh5
-rwxr-xr-xpower/device-files/shutdown.sh5
-rwxr-xr-xpower/setup.sh12
4 files changed, 36 insertions, 0 deletions
diff --git a/power/Android.mk b/power/Android.mk
new file mode 100644
index 0000000..8e7671f
--- /dev/null
+++ b/power/Android.mk
@@ -0,0 +1,14 @@
+# Ship the scripts on the device
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := reboot.sh
+LOCAL_SRC_FILES := device-files/reboot.sh
+LOCAL_MODULE_CLASS := EXECUTABLES
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := shutdown.sh
+LOCAL_SRC_FILES := device-files/shutdown.sh
+LOCAL_MODULE_CLASS := EXECUTABLES
+include $(BUILD_PREBUILT)
diff --git a/power/device-files/reboot.sh b/power/device-files/reboot.sh
new file mode 100755
index 0000000..f03b36d
--- /dev/null
+++ b/power/device-files/reboot.sh
@@ -0,0 +1,5 @@
+#!/system/xbin/bash
+# References:
+# https://android.googlesource.com/platform/frameworks/base/+/android-4.1.1_r1/core/res/AndroidManifest.xml#1723
+# https://android.stackexchange.com/questions/43706/whats-the-best-way-to-restart-android-via-command-line-remotely/139139#139139
+am start -a android.intent.action.REBOOT
diff --git a/power/device-files/shutdown.sh b/power/device-files/shutdown.sh
new file mode 100755
index 0000000..2875b6a
--- /dev/null
+++ b/power/device-files/shutdown.sh
@@ -0,0 +1,5 @@
+#!/system/xbin/bash
+# References:
+# https://android.googlesource.com/platform/frameworks/base/+/android-4.1.1_r1/core/res/AndroidManifest.xml#1723
+# https://android.stackexchange.com/questions/43706/whats-the-best-way-to-restart-android-via-command-line-remotely/139139#139139
+am start -a android.intent.action.ACTION_REQUEST_SHUTDOWN
diff --git a/power/setup.sh b/power/setup.sh
new file mode 100755
index 0000000..90a8be2
--- /dev/null
+++ b/power/setup.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+topdir=$(dirname $0)
+adb root | grep "^root access"
+ret="$?"
+if [ "${ret}" -ne 0 ] ; then
+ adb wait-for-device
+ adb remount
+ adb push "${topdir}/device-files/reboot.sh" /system/bin/
+ adb push "${topdir}/device-files/shutdown.sh" /system/bin/
+ adb shell "mount -o remount,ro /system"
+ adb shell "sync"
+fi