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

Commit a9281e74 authored by Tim Murray's avatar Tim Murray Committed by android-build-merger
Browse files

Increase UI and RenderThread priority when not using FIFO. am: a636b0b4 am: c8ee2116

am: 40e06f9a

Change-Id: I95c5f8e6e55d52e09be65078e3f67be93ed0f45e
parents f445e388 40e06f9a
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -12547,7 +12547,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            synchronized (mPidsSelfLocked) {
                int pid = Binder.getCallingPid();
                proc = mPidsSelfLocked.get(pid);
                if (mUseFifoUiScheduling && proc != null && proc.renderThreadTid == 0 && tid > 0) {
                if (proc != null && proc.renderThreadTid == 0 && tid > 0) {
                    // ensure the tid belongs to the process
                    if (!Process.isThreadInProcess(pid, tid)) {
                        throw new IllegalArgumentException(
@@ -12560,8 +12560,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                    // promote to FIFO now
                    if (proc.curSchedGroup == ProcessList.SCHED_GROUP_TOP_APP) {
                        if (DEBUG_OOM_ADJ) Slog.d("UI_FIFO", "Promoting " + tid + "out of band");
                        if (mUseFifoUiScheduling) {
                            Process.setThreadScheduler(proc.renderThreadTid,
                                Process.SCHED_FIFO | Process.SCHED_RESET_ON_FORK, 1);
                        } else {
                            Process.setThreadPriority(proc.renderThreadTid, -10);
                        }
                    }
                } else {
                    if (DEBUG_OOM_ADJ) {
@@ -20272,6 +20276,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                                        Slog.d("UI_FIFO", "Not setting RenderThread TID");
                                    }
                                }
                            } else {
                                // Boost priority for top app UI and render threads
                                Process.setThreadPriority(app.pid, -10);
                                if (app.renderThreadTid != 0) {
                                    Process.setThreadPriority(app.renderThreadTid, -10);
                                }
                            }
                        }
                    } else if (oldSchedGroup == ProcessList.SCHED_GROUP_TOP_APP &&
@@ -20290,6 +20300,12 @@ public final class ActivityManagerService extends ActivityManagerNative
                                    Process.SCHED_OTHER, 0);
                                Process.setThreadPriority(app.renderThreadTid, -4);
                            }
                        } else {
                            // Reset priority for top app UI and render threads
                            Process.setThreadPriority(app.pid, 0);
                            if (app.renderThreadTid != 0) {
                                Process.setThreadPriority(app.renderThreadTid, 0);
                            }
                        }
                    }
                } catch (Exception e) {