Loading cmds/installd/commands.cpp +3 −12 Original line number Original line Diff line number Diff line Loading @@ -1030,14 +1030,6 @@ static bool calculate_odex_file_path(char path[PKG_PATH_MAX], return true; 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) { static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) { if (set_to_bg) { if (set_to_bg) { if (set_sched_policy(0, SP_BACKGROUND) < 0) { if (set_sched_policy(0, SP_BACKGROUND) < 0) { Loading @@ -1053,7 +1045,7 @@ static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) { int dexopt(const char *apk_path, uid_t uid, bool is_public, int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgname, const char *instruction_set, int dexopt_needed, 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 utimbuf ut; struct stat input_stat; struct stat input_stat; Loading @@ -1062,7 +1054,6 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *input_file; const char *input_file; char in_odex_path[PKG_PATH_MAX]; char in_odex_path[PKG_PATH_MAX]; int res, input_fd=-1, out_fd=-1, swap_fd=-1; 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. // 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 // Note: the cache path will require an additional 5 bytes for ".swap", but we'll try to run Loading Loading @@ -1185,7 +1176,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, ALOGE("capset failed: %s\n", strerror(errno)); ALOGE("capset failed: %s\n", strerror(errno)); exit(66); exit(66); } } SetDex2OatAndPatchOatScheduling(post_bootcomplete); SetDex2OatAndPatchOatScheduling(boot_complete); if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); exit(67); exit(67); Loading @@ -1202,7 +1193,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, input_file_name++; input_file_name++; } } run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname, 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 { } else { ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); exit(73); exit(73); Loading cmds/installd/installd.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -48,9 +48,9 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused) static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) { { /* apk_path, uid, is_public, pkgname, instruction_set, /* apk_path, uid, is_public, pkgname, instruction_set, * dexopt_needed, vm_safe_mode, debuggable, oat_dir */ * dexopt_needed, vm_safe_mode, debuggable, oat_dir, boot_complete */ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), atoi(arg[6]), atoi(arg[7]), arg[8]); atoi(arg[6]), atoi(arg[7]), arg[8], atoi(arg[9])); } } static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) Loading Loading @@ -188,7 +188,7 @@ struct cmdinfo { struct cmdinfo cmds[] = { struct cmdinfo cmds[] = { { "ping", 0, do_ping }, { "ping", 0, do_ping }, { "install", 5, do_install }, { "install", 5, do_install }, { "dexopt", 9, do_dexopt }, { "dexopt", 10, do_dexopt }, { "markbootcomplete", 1, do_mark_boot_complete }, { "markbootcomplete", 1, do_mark_boot_complete }, { "movedex", 3, do_move_dex }, { "movedex", 3, do_move_dex }, { "rmdex", 2, do_rm_dex }, { "rmdex", 2, do_rm_dex }, Loading cmds/installd/installd.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -236,7 +236,7 @@ int get_size(const char *uuid, const char *pkgname, userid_t userid, const char int free_cache(const char *uuid, int64_t free_size); int free_cache(const char *uuid, int64_t free_size); int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, 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, const char *instruction_set, int dexopt_needed, bool vm_safe_mode, bool debuggable, const char* oat_dir); bool debuggable, const char* oat_dir, bool boot_complete); int mark_boot_complete(const char *instruction_set); int mark_boot_complete(const char *instruction_set); int movefiles(); int movefiles(); int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); Loading Loading
cmds/installd/commands.cpp +3 −12 Original line number Original line Diff line number Diff line Loading @@ -1030,14 +1030,6 @@ static bool calculate_odex_file_path(char path[PKG_PATH_MAX], return true; 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) { static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) { if (set_to_bg) { if (set_to_bg) { if (set_sched_policy(0, SP_BACKGROUND) < 0) { if (set_sched_policy(0, SP_BACKGROUND) < 0) { Loading @@ -1053,7 +1045,7 @@ static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) { int dexopt(const char *apk_path, uid_t uid, bool is_public, int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgname, const char *instruction_set, int dexopt_needed, 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 utimbuf ut; struct stat input_stat; struct stat input_stat; Loading @@ -1062,7 +1054,6 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *input_file; const char *input_file; char in_odex_path[PKG_PATH_MAX]; char in_odex_path[PKG_PATH_MAX]; int res, input_fd=-1, out_fd=-1, swap_fd=-1; 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. // 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 // Note: the cache path will require an additional 5 bytes for ".swap", but we'll try to run Loading Loading @@ -1185,7 +1176,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, ALOGE("capset failed: %s\n", strerror(errno)); ALOGE("capset failed: %s\n", strerror(errno)); exit(66); exit(66); } } SetDex2OatAndPatchOatScheduling(post_bootcomplete); SetDex2OatAndPatchOatScheduling(boot_complete); if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); exit(67); exit(67); Loading @@ -1202,7 +1193,7 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public, input_file_name++; input_file_name++; } } run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname, 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 { } else { ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); exit(73); exit(73); Loading
cmds/installd/installd.cpp +3 −3 Original line number Original line Diff line number Diff line Loading @@ -48,9 +48,9 @@ static int do_install(char **arg, char reply[REPLY_MAX] __unused) static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) { { /* apk_path, uid, is_public, pkgname, instruction_set, /* apk_path, uid, is_public, pkgname, instruction_set, * dexopt_needed, vm_safe_mode, debuggable, oat_dir */ * dexopt_needed, vm_safe_mode, debuggable, oat_dir, boot_complete */ return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), atoi(arg[6]), atoi(arg[7]), arg[8]); atoi(arg[6]), atoi(arg[7]), arg[8], atoi(arg[9])); } } static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) Loading Loading @@ -188,7 +188,7 @@ struct cmdinfo { struct cmdinfo cmds[] = { struct cmdinfo cmds[] = { { "ping", 0, do_ping }, { "ping", 0, do_ping }, { "install", 5, do_install }, { "install", 5, do_install }, { "dexopt", 9, do_dexopt }, { "dexopt", 10, do_dexopt }, { "markbootcomplete", 1, do_mark_boot_complete }, { "markbootcomplete", 1, do_mark_boot_complete }, { "movedex", 3, do_move_dex }, { "movedex", 3, do_move_dex }, { "rmdex", 2, do_rm_dex }, { "rmdex", 2, do_rm_dex }, Loading
cmds/installd/installd.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -236,7 +236,7 @@ int get_size(const char *uuid, const char *pkgname, userid_t userid, const char int free_cache(const char *uuid, int64_t free_size); int free_cache(const char *uuid, int64_t free_size); int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, 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, const char *instruction_set, int dexopt_needed, bool vm_safe_mode, bool debuggable, const char* oat_dir); bool debuggable, const char* oat_dir, bool boot_complete); int mark_boot_complete(const char *instruction_set); int mark_boot_complete(const char *instruction_set); int movefiles(); int movefiles(); int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); Loading