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

Commit 6ec7ed2f authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Deal with UserState#getEnabledPrintServices returning null."

parents 231c9fd7 05e34230
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -555,8 +555,14 @@ public final class PrintManagerService extends SystemService {
                        // to handle it as the change may affect ongoing print jobs.
                        UserState userState = getOrCreateUserStateLocked(getChangingUserId());
                        boolean stoppedSomePackages = false;
                        Iterator<PrintServiceInfo> iterator = userState.getEnabledPrintServices()
                                .iterator();

                        List<PrintServiceInfo> enabledServices = userState
                                .getEnabledPrintServices();
                        if (enabledServices == null) {
                            return false;
                        }

                        Iterator<PrintServiceInfo> iterator = enabledServices.iterator();
                        while (iterator.hasNext()) {
                            ComponentName componentName = iterator.next().getComponentName();
                            String componentPackage = componentName.getPackageName();
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.content.pm.PackageManager.GET_META_DATA;
import static android.content.pm.PackageManager.GET_SERVICES;
import static android.content.pm.PackageManager.MATCH_DEBUG_TRIAGED_MISSING;

import android.annotation.Nullable;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -336,7 +337,7 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
        mSpooler.setPrintJobState(printJobId, PrintJobInfo.STATE_QUEUED, null);
    }

    public List<PrintServiceInfo> getEnabledPrintServices() {
    public @Nullable List<PrintServiceInfo> getEnabledPrintServices() {
        synchronized (mLock) {
            List<PrintServiceInfo> enabledServices = null;
            final int installedServiceCount = mInstalledServices.size();