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

Commit 0738f2c9 authored by Steve Kondik's avatar Steve Kondik
Browse files

Move wakelock check in AM after all other processing.

This change allows us to bump the oom adj, but still honor the
correct sched policy.
parent 2bcc98f3
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -13181,11 +13181,6 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
            // counts as being in the foreground.
            adj = FOREGROUND_APP_ADJ;
            app.adjType = "exec-service";
        } else if (mUidWakeLocks.get(app.info.uid) != null) {
            // An app that is currently holding a wakelock also
            // counts as being in the foreground.
            adj = FOREGROUND_APP_ADJ;
            app.adjType = "wakelock";
        } else if (app.foregroundServices) {
            // The user is aware of this app, so make it visible.
            adj = VISIBLE_APP_ADJ;
@@ -13378,11 +13373,21 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
            adj = app.maxAdj;
        }
        app.curAdj = adj;
        app.curSchedGroup = adj > VISIBLE_APP_ADJ
                ? Process.THREAD_GROUP_BG_NONINTERACTIVE
                : Process.THREAD_GROUP_DEFAULT;
        
        // An app that is currently holding a wakelock also
        // counts as being in the foreground.
        // We do this after setting the schedgroup so that it can't
        // escalate beyond it's original priority
        if (mUidWakeLocks.get(app.info.uid) != null) {
            adj = FOREGROUND_APP_ADJ;
            app.adjType = "wakelock";
        } 
        
        app.curAdj = adj;
        
        return adj;
    }