Installd: Take boot status as dexopt parameter
Expect the boot status explicitly as a parameter so that we do not
have to rely on dev.bootcomplete, which isn't meaningfully set
when the device needs the decryption screen on boot.
Bug: 23898216
(cherry picked from commit 72ebebed876a62e719b098e43d9d516361bde029)
Change-Id: I9b34298caf70b1e5d40970cc0d04c469016a80a7
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index adff72e..fbe42f4 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -1030,14 +1030,6 @@
return true;
}
-static bool IsPostBootComplete() {
- char dev_bootcomplete_prop_buf[PROPERTY_VALUE_MAX];
- if (property_get("dev.bootcomplete", dev_bootcomplete_prop_buf, "0") > 0) {
- return (strcmp(dev_bootcomplete_prop_buf, "1") == 0);
- }
- return false;
-}
-
static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) {
if (set_to_bg) {
if (set_sched_policy(0, SP_BACKGROUND) < 0) {
@@ -1053,7 +1045,7 @@
int dexopt(const char *apk_path, uid_t uid, bool is_public,
const char *pkgname, const char *instruction_set, int dexopt_needed,
- bool vm_safe_mode, bool debuggable, const char* oat_dir)
+ bool vm_safe_mode, bool debuggable, const char* oat_dir, bool boot_complete)
{
struct utimbuf ut;
struct stat input_stat;
@@ -1062,7 +1054,6 @@
const char *input_file;
char in_odex_path[PKG_PATH_MAX];
int res, input_fd=-1, out_fd=-1, swap_fd=-1;
- bool post_bootcomplete = IsPostBootComplete();
// Early best-effort check whether we can fit the the path into our buffers.
// Note: the cache path will require an additional 5 bytes for ".swap", but we'll try to run
@@ -1185,7 +1176,7 @@
ALOGE("capset failed: %s\n", strerror(errno));
exit(66);
}
- SetDex2OatAndPatchOatScheduling(post_bootcomplete);
+ SetDex2OatAndPatchOatScheduling(boot_complete);
if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67);
@@ -1202,7 +1193,7 @@
input_file_name++;
}
run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname,
- instruction_set, vm_safe_mode, debuggable, post_bootcomplete);
+ instruction_set, vm_safe_mode, debuggable, boot_complete);
} else {
ALOGE("Invalid dexopt needed: %d\n", dexopt_needed);
exit(73);