summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorIgor Murashkin <iam@google.com>2014-11-05 15:21:12 -0800
committerIgor Murashkin <iam@google.com>2014-11-05 15:21:12 -0800
commit9e87a8014055606b514b1c72b21915e17db7d513 (patch)
tree6ed56fff4e535a2bb76ffa53f4a31f82c775315f /cmds
parent7b97351b68e96ea67380140266abb897fe1be57d (diff)
downloadframeworks_native-9e87a8014055606b514b1c72b21915e17db7d513.zip
frameworks_native-9e87a8014055606b514b1c72b21915e17db7d513.tar.gz
frameworks_native-9e87a8014055606b514b1c72b21915e17db7d513.tar.bz2
installd: Set priority to background for dexopting
This fixes jank caused by dex2oat while installing an application in the background. Bug: 17497551 Change-Id: I5a69b00c0fd76ae22a0d1adb242bef6c18a75743
Diffstat (limited to 'cmds')
-rw-r--r--cmds/installd/commands.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index fc3972e..1954d8d 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -20,6 +20,7 @@
#include <cutils/sched_policy.h>
#include <diskusage/dirsize.h>
#include <selinux/android.h>
+#include <system/thread_defs.h>
/* Directory records that are used in execution of commands. */
dir_rec_t android_data_dir;
@@ -985,6 +986,10 @@ int dexopt(const char *apk_path, uid_t uid, bool is_public,
ALOGE("set_sched_policy failed: %s\n", strerror(errno));
exit(70);
}
+ if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) {
+ ALOGE("setpriority failed: %s\n", strerror(errno));
+ exit(71);
+ }
if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) {
ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno));
exit(67);