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

Commit b90388ea authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not freeze system_server" into main

parents db8020fc e9bff95e
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -101,6 +101,9 @@ nsecs_t now() {
    return systemTime(SYSTEM_TIME_MONOTONIC);
    return systemTime(SYSTEM_TIME_MONOTONIC);
}
}


// The current process.  This is cached here on startup.
const pid_t sThisProcess = getpid();

// Return true if the process exists and false if we cannot know.
// Return true if the process exists and false if we cannot know.
bool processExists(pid_t pid) {
bool processExists(pid_t pid) {
    char path[PATH_MAX];
    char path[PATH_MAX];
@@ -726,7 +729,7 @@ class AnrTimerService::Timer {
            uid(uid),
            uid(uid),
            timeout(timeout),
            timeout(timeout),
            extend(extend),
            extend(extend),
            freeze(pid != 0 && freeze),
            freeze(freeze),
            split(trace.earlyTimeout),
            split(trace.earlyTimeout),
            action(trace.action),
            action(trace.action),
            status(Running),
            status(Running),
@@ -1188,8 +1191,11 @@ const char* AnrTimerService::statusString(Status s) {
}
}


AnrTimerService::timer_id_t AnrTimerService::start(int pid, int uid, nsecs_t timeout) {
AnrTimerService::timer_id_t AnrTimerService::start(int pid, int uid, nsecs_t timeout) {
    // Use the freezer only if the pid is not 0 (a nonsense value) and the pid is not self.
    // Freezing the current process is a fatal error.
    bool useFreezer = freeze_ && (pid != 0) && (pid != sThisProcess);
    AutoMutex _l(lock_);
    AutoMutex _l(lock_);
    Timer t(pid, uid, timeout, extend_, freeze_, tracer_.getConfig(pid));
    Timer t(pid, uid, timeout, extend_, useFreezer, tracer_.getConfig(pid));
    insertLocked(t);
    insertLocked(t);
    t.start();
    t.start();
    counters_.started++;
    counters_.started++;