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

Commit 779499c4 authored by Winson's avatar Winson Committed by Winson Chiu
Browse files

Break out of DomainVerificationProxyV1 if info is null

This was found in a presubmit test run, and is probably the result of
a race or an invalid package state. Or even a broken v1 verifier
implementation.

For now, just exit. This failure means the package state is gone, so
continuing verification for it is meaningless.

Bug: 179493004

Test: manual, run v1 verification

Change-Id: Idcfaac95fbd16e7a0981b3d27a2a074c2ede5b1e
parent 804a79e7
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -37,10 +37,10 @@ import android.util.Pair;
import android.util.Slog;

import com.android.internal.annotations.GuardedBy;
import com.android.server.pm.parsing.pkg.AndroidPackage;
import com.android.server.pm.verify.domain.DomainVerificationCollector;
import com.android.server.pm.verify.domain.DomainVerificationManagerInternal;
import com.android.server.pm.verify.domain.DomainVerificationMessageCodes;
import com.android.server.pm.parsing.pkg.AndroidPackage;

import java.util.Collections;
import java.util.List;
@@ -152,18 +152,22 @@ public class DomainVerificationProxyV1 implements DomainVerificationProxy {

                UUID domainSetId = pair.first;
                String packageName = pair.second;
                DomainVerificationInfo set;
                DomainVerificationInfo info;
                try {
                    set = mManager.getDomainVerificationInfo(packageName);
                    info = mManager.getDomainVerificationInfo(packageName);
                } catch (PackageManager.NameNotFoundException ignored) {
                    return true;
                }

                if (!Objects.equals(domainSetId, set.getIdentifier())) {
                if (info == null) {
                    return true;
                }

                if (!Objects.equals(domainSetId, info.getIdentifier())) {
                    return true;
                }

                Set<String> successfulDomains = new ArraySet<>(set.getHostToStateMap().keySet());
                Set<String> successfulDomains = new ArraySet<>(info.getHostToStateMap().keySet());
                successfulDomains.removeAll(response.failedDomains);

                int callingUid = response.callingUid;