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

Commit 95737a0d authored by Song Chun Fan's avatar Song Chun Fan Committed by Android (Google) Code Review
Browse files

Merge "[pm] fix get-domain-verification-agent command on aosp builds" into main

parents 744b87a4 808c8bbf
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -6519,7 +6519,19 @@ public class PackageManagerService implements PackageSender, TestUtilityService
                throw new SecurityException("Not allowed to query domain verification agent");
            }
            final Computer snapshot = snapshotComputer();
            return getDomainVerificationAgentComponentNameLPr(snapshot, userId);
            final ComponentName agent = mDomainVerificationManager.getProxy().getComponentName();
            final PackageStateInternal ps = snapshot.getPackageStateForInstalledAndFiltered(
                    agent.getPackageName(), callerUid, userId);
            if (ps == null) {
                return null;
            }
            final var disabledComponents =
                    ps.getUserStateOrDefault(userId).getDisabledComponentsNoCopy();
            if (disabledComponents != null && disabledComponents.contains(agent.getClassName())) {
                return null;
            }
            // Only return the result if the agent is installed and enabled on the target user
            return agent;
        }

        @Override
+3 −2
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static android.content.pm.PackageManager.RESTRICTION_HIDE_NOTIFICATIONS;
import static android.content.pm.PackageManager.RESTRICTION_NONE;

import static com.android.server.LocalManagerRegistry.ManagerNotFoundException;
import static com.android.server.pm.PackageManagerService.DEFAULT_FILE_ACCESS_MODE;

import android.accounts.IAccountManager;
import android.annotation.NonNull;
@@ -4849,8 +4848,10 @@ class PackageManagerShellCommand extends ShellCommand {
        pw.println("    to unarchive an app to the responsible installer. Options are:");
        pw.println("      --user: request unarchival of the app from the given user.");
        pw.println("");
        pw.println("  get-domain-verification-agent");
        pw.println("  get-domain-verification-agent [--user USER_ID]");
        pw.println("    Displays the component name of the domain verification agent on device.");
        pw.println("    If the component isn't enabled, an error message will be displayed.");
        pw.println("      --user: return the agent of the given user (SYSTEM_USER if unspecified)");
        pw.println("");
        printArtServiceHelp();
        pw.println("");