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

Commit a88e8926 authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Handle user changes off the main thread." into lmp-dev

parents f634c08b c82768ff
Loading
Loading
Loading
Loading
+31 −17
Original line number Diff line number Diff line
@@ -627,7 +627,12 @@ public final class PrintManagerService extends SystemService {
            return userState;
        }

        private void handleUserStarted(int userId) {
        private void handleUserStarted(final int userId) {
            // This code will touch the remote print spooler which
            // must be called off the main thread, so post the work.
            BackgroundThread.getHandler().post(new Runnable() {
                @Override
                public void run() {
                    UserState userState;
                    synchronized (mLock) {
                        userState = getOrCreateUserStateLocked(userId);
@@ -638,8 +643,15 @@ public final class PrintManagerService extends SystemService {
                    // are from the last boot and no application would query them.
                    userState.removeObsoletePrintJobs();
                }
            });
        }

        private void handleUserStopped(int userId) {
        private void handleUserStopped(final int userId) {
            // This code will touch the remote print spooler which
            // must be called off the main thread, so post the work.
            BackgroundThread.getHandler().post(new Runnable() {
                @Override
                public void run() {
                    synchronized (mLock) {
                        UserState userState = mUserStates.get(userId);
                        if (userState != null) {
@@ -648,6 +660,8 @@ public final class PrintManagerService extends SystemService {
                        }
                    }
                }
            });
        }

        private int resolveCallingProfileParentLocked(int userId) {
            if (userId != getCurrentUserId()) {