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

Commit 29a4a9ed authored by Ruben Brunk's avatar Ruben Brunk
Browse files

Don't crash system server when setting scheduler.

Bug: 30671326
Change-Id: I2f7913cd3cca052d5a653ff288459b0a6a69deda
parent 828d4ff6
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -2328,6 +2328,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                            ProcessRecord proc = r.app;
                            if (proc.vrThreadTid > 0) {
                                if (proc.curSchedGroup == ProcessList.SCHED_GROUP_TOP_APP) {
                                    try {
                                        if (mInVrMode == true) {
                                            Process.setThreadScheduler(proc.vrThreadTid,
                                                Process.SCHED_FIFO | Process.SCHED_RESET_ON_FORK, 1);
@@ -2335,6 +2336,10 @@ public final class ActivityManagerService extends ActivityManagerNative
                                            Process.setThreadScheduler(proc.vrThreadTid,
                                                Process.SCHED_OTHER, 0);
                                        }
                                    } catch (IllegalArgumentException e) {
                                        Slog.e(TAG, "Failed to set scheduling policy, thread does"
                                                + " not exist:\n" + e);
                                    }
                                }
                            }
                        }