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

Commit 5356e816 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handle SSM thread failures better"

parents c523daa4 10598561
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -576,19 +576,20 @@ public final class SystemServiceManager implements Dumpable {
        return () -> {
            final TimingsTraceAndSlog t = new TimingsTraceAndSlog(oldTrace);
            final String serviceName = service.getClass().getName();
            try {
            final int curUserId = curUser.getUserIdentifier();
            t.traceBegin("ssm.on" + USER_STARTING + "User-" + curUserId + "_" + serviceName);
            try {
                long time = SystemClock.elapsedRealtime();
                service.onUserStarting(curUser);
                warnIfTooLong(SystemClock.elapsedRealtime() - time, service,
                        "on" + USER_STARTING + "User-" + curUserId);
                t.traceEnd();
            } catch (Exception e) {
                Slog.wtf(TAG, "Failure reporting " + USER_STARTING + " of user " + curUser
                        + " to service " + serviceName, e);
                Slog.e(TAG, "Disabling thread pool - please capture a bug report.");
                sUseLifecycleThreadPool = false;
            } finally {
                t.traceEnd();
            }
        };
    }
@@ -601,11 +602,18 @@ public final class SystemServiceManager implements Dumpable {
            final int curUserId = curUser.getUserIdentifier();
            t.traceBegin("ssm.on" + USER_COMPLETED_EVENT + "User-" + curUserId
                    + "_" + eventType + "_" + serviceName);
            try {
                long time = SystemClock.elapsedRealtime();
                service.onUserCompletedEvent(curUser, eventType);
                warnIfTooLong(SystemClock.elapsedRealtime() - time, service,
                        "on" + USER_COMPLETED_EVENT + "User-" + curUserId);
            } catch (Exception e) {
                Slog.wtf(TAG, "Failure reporting " + USER_COMPLETED_EVENT + " of user " + curUser
                        + " to service " + serviceName, e);
                throw e;
            } finally {
                t.traceEnd();
            }
        };
    }