diff options
author | Doug Zongker <dougz@android.com> | 2014-05-23 08:40:35 -0700 |
---|---|---|
committer | Doug Zongker <dougz@android.com> | 2014-05-23 08:52:31 -0700 |
commit | c704e06ce596bd0a6de66b10b108aee95535468a (patch) | |
tree | 3005b89333b7500aaa78e0867e377eac2f0280ab /install.cpp | |
parent | ffb557d351776bed40818fa77afaa743d9e34a34 (diff) | |
download | bootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.tar.gz bootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.tar.bz2 bootable_recovery-c704e06ce596bd0a6de66b10b108aee95535468a.zip |
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 'install.cpp')
-rw-r--r-- | install.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/install.cpp b/install.cpp index 0bd7945..0f05960 100644 --- a/install.cpp +++ b/install.cpp @@ -160,6 +160,11 @@ try_update_binary(const char *path, ZipArchive *zip, int* wipe_cache) { *wipe_cache = 1; } else if (strcmp(command, "clear_display") == 0) { ui->SetBackground(RecoveryUI::NONE); + } else if (strcmp(command, "enable_reboot") == 0) { + // packages can explicitly request that they want the user + // to be able to reboot during installation (useful for + // debugging packages that don't exit). + ui->SetEnableReboot(true); } else { LOGE("unknown command [%s]\n", command); } @@ -236,7 +241,9 @@ really_install_package(const char *path, int* wipe_cache) /* Verify and install the contents of the package. */ ui->Print("Installing update...\n"); + ui->SetEnableReboot(false); int result = try_update_binary(path, &zip, wipe_cache); + ui->SetEnableReboot(true); sysReleaseMap(&map); |