Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c919183b authored by Wei Wang's avatar Wei Wang
Browse files

installd: Fix set dex2oat to background after boot_complete

We need set policy before dropping capabilities.

Bug: 175178520
Test: trace and check sched_policy
Change-Id: I24114325f00f19113b360f71a427ebf6bf45dc9b
parent 370181de
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1818,10 +1818,13 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins

    pid_t pid = fork();
    if (pid == 0) {
        // Need to set schedpolicy before dropping privileges
        // for cgroup migration. See details at b/175178520.
        SetDex2OatScheduling(boot_complete);

        /* child -- drop privileges before continuing */
        drop_capabilities(uid);

        SetDex2OatScheduling(boot_complete);
        if (flock(out_oat.fd(), LOCK_EX | LOCK_NB) != 0) {
            PLOG(ERROR) << "flock(" << out_oat.path() << ") failed";
            _exit(DexoptReturnCodes::kFlock);