Loading core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -847,5 +847,5 @@ interface IPackageManager { @EnforcePermission("GET_APP_METADATA") int getAppMetadataSource(String packageName, int userId); ComponentName getDomainVerificationAgent(); ComponentName getDomainVerificationAgent(int userId); } services/core/java/com/android/server/pm/PackageManagerService.java +8 −7 Original line number Diff line number Diff line Loading @@ -2446,7 +2446,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService ComponentName intentFilterVerifierComponent = getIntentFilterVerifierComponentNameLPr(computer); ComponentName domainVerificationAgent = getDomainVerificationAgentComponentNameLPr(computer); getDomainVerificationAgentComponentNameLPr(computer, UserHandle.USER_SYSTEM); DomainVerificationProxy domainVerificationProxy = DomainVerificationProxy.makeProxy( intentFilterVerifierComponent, domainVerificationAgent, mContext, Loading Loading @@ -2754,12 +2754,13 @@ public class PackageManagerService implements PackageSender, TestUtilityService } @Nullable private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer) { private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer, int userId) { Intent intent = new Intent(Intent.ACTION_DOMAINS_NEED_VERIFICATION); List<ResolveInfo> matches = mResolveIntentHelper.queryIntentReceiversInternal(computer, intent, null, MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM, Binder.getCallingUid()); userId, Binder.getCallingUid()); ResolveInfo best = null; final int N = matches.size(); for (int i = 0; i < N; i++) { Loading @@ -2767,7 +2768,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService final String packageName = cur.getComponentInfo().packageName; if (checkPermission( android.Manifest.permission.DOMAIN_VERIFICATION_AGENT, packageName, UserHandle.USER_SYSTEM) != PackageManager.PERMISSION_GRANTED) { userId) != PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Domain verification agent found but does not hold permission: " + packageName); continue; Loading @@ -2775,7 +2776,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService if (best == null || cur.priority > best.priority) { if (computer.isComponentEffectivelyEnabled(cur.getComponentInfo(), UserHandle.SYSTEM)) { UserHandle.of(userId))) { best = cur; } else { Slog.w(TAG, "Domain verification agent found but not enabled"); Loading Loading @@ -6512,13 +6513,13 @@ public class PackageManagerService implements PackageSender, TestUtilityService @Override @Nullable public ComponentName getDomainVerificationAgent() { public ComponentName getDomainVerificationAgent(int userId) { final int callerUid = Binder.getCallingUid(); if (!PackageManagerServiceUtils.isRootOrShell(callerUid)) { throw new SecurityException("Not allowed to query domain verification agent"); } final Computer snapshot = snapshotComputer(); return getDomainVerificationAgentComponentNameLPr(snapshot); return getDomainVerificationAgentComponentNameLPr(snapshot, userId); } @Override Loading services/core/java/com/android/server/pm/PackageManagerShellCommand.java +24 −1 Original line number Diff line number Diff line Loading @@ -4412,8 +4412,31 @@ class PackageManagerShellCommand extends ShellCommand { private int runGetDomainVerificationAgent() throws RemoteException { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_ALL; String opt; while ((opt = getNextOption()) != null) { if (opt.equals("--user")) { userId = UserHandle.parseUserArg(getNextArgRequired()); if (userId != UserHandle.USER_ALL && userId != UserHandle.USER_CURRENT) { UserManagerInternal umi = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umi.getUserInfo(userId); if (userInfo == null) { pw.println("Failure [user " + userId + " doesn't exist]"); return 1; } } } else { pw.println("Error: Unknown option: " + opt); return 1; } } final int translatedUserId = translateUserId(userId, UserHandle.USER_SYSTEM, "runGetDomainVerificationAgent"); try { final ComponentName domainVerificationAgent = mInterface.getDomainVerificationAgent(); final ComponentName domainVerificationAgent = mInterface.getDomainVerificationAgent(translatedUserId); pw.println(domainVerificationAgent == null ? "No Domain Verifier available!" : domainVerificationAgent.flattenToString()); } catch (Exception e) { Loading Loading
core/java/android/content/pm/IPackageManager.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -847,5 +847,5 @@ interface IPackageManager { @EnforcePermission("GET_APP_METADATA") int getAppMetadataSource(String packageName, int userId); ComponentName getDomainVerificationAgent(); ComponentName getDomainVerificationAgent(int userId); }
services/core/java/com/android/server/pm/PackageManagerService.java +8 −7 Original line number Diff line number Diff line Loading @@ -2446,7 +2446,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService ComponentName intentFilterVerifierComponent = getIntentFilterVerifierComponentNameLPr(computer); ComponentName domainVerificationAgent = getDomainVerificationAgentComponentNameLPr(computer); getDomainVerificationAgentComponentNameLPr(computer, UserHandle.USER_SYSTEM); DomainVerificationProxy domainVerificationProxy = DomainVerificationProxy.makeProxy( intentFilterVerifierComponent, domainVerificationAgent, mContext, Loading Loading @@ -2754,12 +2754,13 @@ public class PackageManagerService implements PackageSender, TestUtilityService } @Nullable private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer) { private ComponentName getDomainVerificationAgentComponentNameLPr(@NonNull Computer computer, int userId) { Intent intent = new Intent(Intent.ACTION_DOMAINS_NEED_VERIFICATION); List<ResolveInfo> matches = mResolveIntentHelper.queryIntentReceiversInternal(computer, intent, null, MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM, Binder.getCallingUid()); userId, Binder.getCallingUid()); ResolveInfo best = null; final int N = matches.size(); for (int i = 0; i < N; i++) { Loading @@ -2767,7 +2768,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService final String packageName = cur.getComponentInfo().packageName; if (checkPermission( android.Manifest.permission.DOMAIN_VERIFICATION_AGENT, packageName, UserHandle.USER_SYSTEM) != PackageManager.PERMISSION_GRANTED) { userId) != PackageManager.PERMISSION_GRANTED) { Slog.w(TAG, "Domain verification agent found but does not hold permission: " + packageName); continue; Loading @@ -2775,7 +2776,7 @@ public class PackageManagerService implements PackageSender, TestUtilityService if (best == null || cur.priority > best.priority) { if (computer.isComponentEffectivelyEnabled(cur.getComponentInfo(), UserHandle.SYSTEM)) { UserHandle.of(userId))) { best = cur; } else { Slog.w(TAG, "Domain verification agent found but not enabled"); Loading Loading @@ -6512,13 +6513,13 @@ public class PackageManagerService implements PackageSender, TestUtilityService @Override @Nullable public ComponentName getDomainVerificationAgent() { public ComponentName getDomainVerificationAgent(int userId) { final int callerUid = Binder.getCallingUid(); if (!PackageManagerServiceUtils.isRootOrShell(callerUid)) { throw new SecurityException("Not allowed to query domain verification agent"); } final Computer snapshot = snapshotComputer(); return getDomainVerificationAgentComponentNameLPr(snapshot); return getDomainVerificationAgentComponentNameLPr(snapshot, userId); } @Override Loading
services/core/java/com/android/server/pm/PackageManagerShellCommand.java +24 −1 Original line number Diff line number Diff line Loading @@ -4412,8 +4412,31 @@ class PackageManagerShellCommand extends ShellCommand { private int runGetDomainVerificationAgent() throws RemoteException { final PrintWriter pw = getOutPrintWriter(); int userId = UserHandle.USER_ALL; String opt; while ((opt = getNextOption()) != null) { if (opt.equals("--user")) { userId = UserHandle.parseUserArg(getNextArgRequired()); if (userId != UserHandle.USER_ALL && userId != UserHandle.USER_CURRENT) { UserManagerInternal umi = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umi.getUserInfo(userId); if (userInfo == null) { pw.println("Failure [user " + userId + " doesn't exist]"); return 1; } } } else { pw.println("Error: Unknown option: " + opt); return 1; } } final int translatedUserId = translateUserId(userId, UserHandle.USER_SYSTEM, "runGetDomainVerificationAgent"); try { final ComponentName domainVerificationAgent = mInterface.getDomainVerificationAgent(); final ComponentName domainVerificationAgent = mInterface.getDomainVerificationAgent(translatedUserId); pw.println(domainVerificationAgent == null ? "No Domain Verifier available!" : domainVerificationAgent.flattenToString()); } catch (Exception e) { Loading