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

Commit 973d8af1 authored by Narayan Kamath's avatar Narayan Kamath
Browse files

PrintManagerService: Don't prune services on all package change events.

We should only need to prune services if the package that changed
had a print service or has been changed to have a print service.

Bug: 63019430
Test: Manual; observed that the print spooler isn't started up.
Test: run cts -m CtsPrintTestCases

Change-Id: I32df27e4b1d11615cf6053dd3d35c2b60068d0d3
parent 7ef9f224
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -736,15 +736,19 @@ public final class PrintManagerService extends SystemService {
                    UserState userState = getOrCreateUserStateLocked(getChangingUserId(), false,
                            false /* enforceUserUnlockingOrUnlocked */);

                    boolean prunePrintServices = false;
                    synchronized (mLock) {
                        if (hadPrintService(userState, packageName)
                                || hasPrintService(packageName)) {
                            userState.updateIfNeededLocked();
                            prunePrintServices = true;
                        }
                    }

                    if (prunePrintServices) {
                        userState.prunePrintServices();
                    }
                }

                @Override
                public void onPackageRemoved(String packageName, int uid) {
@@ -752,14 +756,18 @@ public final class PrintManagerService extends SystemService {
                    UserState userState = getOrCreateUserStateLocked(getChangingUserId(), false,
                            false /* enforceUserUnlockingOrUnlocked */);

                    boolean prunePrintServices = false;
                    synchronized (mLock) {
                        if (hadPrintService(userState, packageName)) {
                            userState.updateIfNeededLocked();
                            prunePrintServices = true;
                        }
                    }

                    if (prunePrintServices) {
                        userState.prunePrintServices();
                    }
                }

                @Override
                public boolean onHandleForceStop(Intent intent, String[] stoppedPackages,