aboutsummaryrefslogtreecommitdiffstats
path: root/updater/install.c
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2014-05-23 08:40:35 -0700
committerDoug Zongker <dougz@android.com>2014-05-23 08:52:31 -0700
commitc704e06ce596bd0a6de66b10b108aee95535468a (patch)
tree3005b89333b7500aaa78e0867e377eac2f0280ab /updater/install.c
parentffb557d351776bed40818fa77afaa743d9e34a34 (diff)
downloadbootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.zip
bootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.tar.gz
bootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.tar.bz2
disable async reboot during package installation
The default recovery UI will reboot the device when the power key is pressed 7 times in a row, regardless of what recovery is doing. Disable this feature during package installation, to minimize the chance of corrupting the device due to a mid-install reboot. (Debug packages can explicitly request that the feature be reenabled.) Change-Id: I20f3ec240ecd344615d452005ff26d8dd7775acf
Diffstat (limited to 'updater/install.c')
-rw-r--r--updater/install.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/updater/install.c b/updater/install.c
index 8defc77..e1071c9 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -1640,6 +1640,15 @@ Value* WipeBlockDeviceFn(const char* name, State* state, int argc, Expr* argv[])
return StringValue(strdup(success ? "t" : ""));
}
+Value* EnableRebootFn(const char* name, State* state, int argc, Expr* argv[]) {
+ if (argc != 0) {
+ return ErrorAbort(state, "%s() expects no args, got %d", name, argc);
+ }
+ UpdaterInfo* ui = (UpdaterInfo*)(state->cookie);
+ fprintf(ui->cmd_pipe, "enable_reboot\n");
+ return StringValue(strdup("t"));
+}
+
void RegisterInstallFunctions() {
RegisterFunction("mount", MountFn);
RegisterFunction("is_mounted", IsMountedFn);
@@ -1689,4 +1698,6 @@ void RegisterInstallFunctions() {
RegisterFunction("reboot_now", RebootNowFn);
RegisterFunction("get_stage", GetStageFn);
RegisterFunction("set_stage", SetStageFn);
+
+ RegisterFunction("enable_reboot", EnableRebootFn);
}