Merge "Handle general and specific cross profile logic" into sc-dev am: 119b05e461
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14740492 Change-Id: Ic718ae248615c7a0a9e3139563c7f657046c00e4
This commit is contained in:
@@ -9,7 +9,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CtsDomainVerificationDeviceTestCases"
|
"name": "CtsDomainVerificationDeviceStandaloneTestCases"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CtsDomainVerificationDeviceMultiUserTestCases"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CtsDomainVerificationHostTestCases"
|
"name": "CtsDomainVerificationHostTestCases"
|
||||||
|
|||||||
@@ -2335,11 +2335,11 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
List<CrossProfileIntentFilter> matchingFilters =
|
List<CrossProfileIntentFilter> matchingFilters =
|
||||||
getMatchingCrossProfileIntentFilters(intent, resolvedType, userId);
|
getMatchingCrossProfileIntentFilters(intent, resolvedType, userId);
|
||||||
// Check for results that need to skip the current profile.
|
// Check for results that need to skip the current profile.
|
||||||
ResolveInfo xpResolveInfo = querySkipCurrentProfileIntents(matchingFilters, intent,
|
ResolveInfo skipProfileInfo = querySkipCurrentProfileIntents(matchingFilters,
|
||||||
resolvedType, flags, userId);
|
intent, resolvedType, flags, userId);
|
||||||
if (xpResolveInfo != null) {
|
if (skipProfileInfo != null) {
|
||||||
List<ResolveInfo> xpResult = new ArrayList<>(1);
|
List<ResolveInfo> xpResult = new ArrayList<>(1);
|
||||||
xpResult.add(xpResolveInfo);
|
xpResult.add(skipProfileInfo);
|
||||||
return new QueryIntentActivitiesResult(
|
return new QueryIntentActivitiesResult(
|
||||||
applyPostResolutionFilter(
|
applyPostResolutionFilter(
|
||||||
filterIfNotSystemUser(xpResult, userId), instantAppPkgName,
|
filterIfNotSystemUser(xpResult, userId), instantAppPkgName,
|
||||||
@@ -2354,54 +2354,55 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
false /*skipPackageCheck*/, flags);
|
false /*skipPackageCheck*/, flags);
|
||||||
// Check for cross profile results.
|
// Check for cross profile results.
|
||||||
boolean hasNonNegativePriorityResult = hasNonNegativePriority(result);
|
boolean hasNonNegativePriorityResult = hasNonNegativePriority(result);
|
||||||
xpResolveInfo = queryCrossProfileIntents(
|
CrossProfileDomainInfo specificXpInfo = queryCrossProfileIntents(
|
||||||
matchingFilters, intent, resolvedType, flags, userId,
|
matchingFilters, intent, resolvedType, flags, userId,
|
||||||
hasNonNegativePriorityResult);
|
hasNonNegativePriorityResult);
|
||||||
if (xpResolveInfo != null && isUserEnabled(xpResolveInfo.targetUserId)) {
|
|
||||||
boolean isVisibleToUser = filterIfNotSystemUser(
|
|
||||||
Collections.singletonList(xpResolveInfo), userId).size() > 0;
|
|
||||||
if (isVisibleToUser) {
|
|
||||||
result.add(xpResolveInfo);
|
|
||||||
sortResult = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (intent.hasWebURI()) {
|
if (intent.hasWebURI()) {
|
||||||
CrossProfileDomainInfo xpDomainInfo = null;
|
CrossProfileDomainInfo generalXpInfo = null;
|
||||||
final UserInfo parent = getProfileParent(userId);
|
final UserInfo parent = getProfileParent(userId);
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
xpDomainInfo = getCrossProfileDomainPreferredLpr(intent, resolvedType,
|
generalXpInfo = getCrossProfileDomainPreferredLpr(intent, resolvedType,
|
||||||
flags, userId, parent.id);
|
flags, userId, parent.id);
|
||||||
}
|
}
|
||||||
if (xpDomainInfo != null) {
|
|
||||||
if (xpResolveInfo != null) {
|
// Generalized cross profile intents take precedence over specific.
|
||||||
// If we didn't remove it, the cross-profile ResolveInfo would be twice
|
// Note that this is the opposite of the intuitive order.
|
||||||
// in the result.
|
CrossProfileDomainInfo prioritizedXpInfo =
|
||||||
result.remove(xpResolveInfo);
|
generalXpInfo != null ? generalXpInfo : specificXpInfo;
|
||||||
}
|
|
||||||
if (result.size() == 0 && !addInstant) {
|
if (!addInstant) {
|
||||||
|
if (result.isEmpty() && prioritizedXpInfo != null) {
|
||||||
// No result in current profile, but found candidate in parent user.
|
// No result in current profile, but found candidate in parent user.
|
||||||
// And we are not going to add ephemeral app, so we can return the
|
// And we are not going to add ephemeral app, so we can return the
|
||||||
// result straight away.
|
// result straight away.
|
||||||
result.add(xpDomainInfo.resolveInfo);
|
result.add(prioritizedXpInfo.resolveInfo);
|
||||||
|
return new QueryIntentActivitiesResult(
|
||||||
|
applyPostResolutionFilter(result, instantAppPkgName,
|
||||||
|
allowDynamicSplits, filterCallingUid, resolveForStart,
|
||||||
|
userId, intent));
|
||||||
|
} else if (result.size() <= 1 && prioritizedXpInfo == null) {
|
||||||
|
// No result in parent user and <= 1 result in current profile, and we
|
||||||
|
// are not going to add ephemeral app, so we can return the result
|
||||||
|
// without further processing.
|
||||||
return new QueryIntentActivitiesResult(
|
return new QueryIntentActivitiesResult(
|
||||||
applyPostResolutionFilter(result, instantAppPkgName,
|
applyPostResolutionFilter(result, instantAppPkgName,
|
||||||
allowDynamicSplits, filterCallingUid, resolveForStart,
|
allowDynamicSplits, filterCallingUid, resolveForStart,
|
||||||
userId, intent));
|
userId, intent));
|
||||||
}
|
}
|
||||||
} else if (result.size() <= 1 && !addInstant) {
|
|
||||||
// No result in parent user and <= 1 result in current profile, and we
|
|
||||||
// are not going to add ephemeral app, so we can return the result without
|
|
||||||
// further processing.
|
|
||||||
return new QueryIntentActivitiesResult(
|
|
||||||
applyPostResolutionFilter(result, instantAppPkgName,
|
|
||||||
allowDynamicSplits, filterCallingUid, resolveForStart, userId,
|
|
||||||
intent));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have more than one candidate (combining results from current and parent
|
// We have more than one candidate (combining results from current and parent
|
||||||
// profile), so we need filtering and sorting.
|
// profile), so we need filtering and sorting.
|
||||||
result = filterCandidatesWithDomainPreferredActivitiesLPr(
|
result = filterCandidatesWithDomainPreferredActivitiesLPr(
|
||||||
intent, flags, result, xpDomainInfo, userId);
|
intent, flags, result, prioritizedXpInfo, userId);
|
||||||
sortResult = true;
|
sortResult = true;
|
||||||
|
} else {
|
||||||
|
// If not web Intent, just add result to candidate set and let ResolverActivity
|
||||||
|
// figure it out.
|
||||||
|
if (specificXpInfo != null) {
|
||||||
|
result.add(specificXpInfo.resolveInfo);
|
||||||
|
sortResult = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
final PackageSetting setting =
|
final PackageSetting setting =
|
||||||
@@ -2833,15 +2834,17 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
if (ps == null) {
|
if (ps == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (result == null) {
|
|
||||||
result = new CrossProfileDomainInfo();
|
|
||||||
result.resolveInfo = createForwardingResolveInfoUnchecked(
|
|
||||||
new WatchedIntentFilter(), sourceUserId, parentUserId);
|
|
||||||
}
|
|
||||||
|
|
||||||
result.highestApprovalLevel = Math.max(mDomainVerificationManager
|
int approvalLevel = mDomainVerificationManager
|
||||||
.approvalLevelForDomain(ps, intent, resultTargetUser, flags,
|
.approvalLevelForDomain(ps, intent, flags, parentUserId);
|
||||||
parentUserId), result.highestApprovalLevel);
|
|
||||||
|
if (result == null) {
|
||||||
|
result = new CrossProfileDomainInfo(createForwardingResolveInfoUnchecked(
|
||||||
|
new WatchedIntentFilter(), sourceUserId, parentUserId), approvalLevel);
|
||||||
|
} else {
|
||||||
|
result.highestApprovalLevel =
|
||||||
|
Math.max(approvalLevel, result.highestApprovalLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (result != null && result.highestApprovalLevel
|
if (result != null && result.highestApprovalLevel
|
||||||
<= DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE) {
|
<= DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE) {
|
||||||
@@ -3088,8 +3091,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
final String packageName = info.activityInfo.packageName;
|
final String packageName = info.activityInfo.packageName;
|
||||||
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
||||||
if (ps.getInstantApp(userId)) {
|
if (ps.getInstantApp(userId)) {
|
||||||
if (hasAnyDomainApproval(mDomainVerificationManager, ps, intent,
|
if (hasAnyDomainApproval(mDomainVerificationManager, ps, intent, flags,
|
||||||
instantApps, flags, userId)) {
|
userId)) {
|
||||||
if (DEBUG_INSTANT) {
|
if (DEBUG_INSTANT) {
|
||||||
Slog.v(TAG, "Instant app approved for intent; pkg: "
|
Slog.v(TAG, "Instant app approved for intent; pkg: "
|
||||||
+ packageName);
|
+ packageName);
|
||||||
@@ -3416,28 +3419,59 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the filter's target user can handle the intent and is enabled: returns a ResolveInfo
|
* If the filter's target user can handle the intent and is enabled: a [ResolveInfo] that
|
||||||
* that
|
* will forward the intent to the filter's target user, along with the highest approval of
|
||||||
* will forward the intent to the filter's target user.
|
* any handler in the target user. Otherwise, returns null.
|
||||||
* Otherwise, returns null.
|
|
||||||
*/
|
*/
|
||||||
private ResolveInfo createForwardingResolveInfo(CrossProfileIntentFilter filter,
|
@Nullable
|
||||||
Intent intent,
|
private CrossProfileDomainInfo createForwardingResolveInfo(
|
||||||
String resolvedType, int flags, int sourceUserId) {
|
@NonNull CrossProfileIntentFilter filter, @NonNull Intent intent,
|
||||||
|
@Nullable String resolvedType, int flags, int sourceUserId) {
|
||||||
int targetUserId = filter.getTargetUserId();
|
int targetUserId = filter.getTargetUserId();
|
||||||
|
if (!isUserEnabled(targetUserId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent,
|
List<ResolveInfo> resultTargetUser = mComponentResolver.queryActivities(intent,
|
||||||
resolvedType, flags, targetUserId);
|
resolvedType, flags, targetUserId);
|
||||||
if (resultTargetUser != null && isUserEnabled(targetUserId)) {
|
if (CollectionUtils.isEmpty(resultTargetUser)) {
|
||||||
// If all the matches in the target profile are suspended, return null.
|
return null;
|
||||||
for (int i = resultTargetUser.size() - 1; i >= 0; i--) {
|
}
|
||||||
if ((resultTargetUser.get(i).activityInfo.applicationInfo.flags
|
|
||||||
& ApplicationInfo.FLAG_SUSPENDED) == 0) {
|
ResolveInfo forwardingInfo = null;
|
||||||
return createForwardingResolveInfoUnchecked(filter,
|
for (int i = resultTargetUser.size() - 1; i >= 0; i--) {
|
||||||
sourceUserId, targetUserId);
|
ResolveInfo targetUserResolveInfo = resultTargetUser.get(i);
|
||||||
}
|
if ((targetUserResolveInfo.activityInfo.applicationInfo.flags
|
||||||
|
& ApplicationInfo.FLAG_SUSPENDED) == 0) {
|
||||||
|
forwardingInfo = createForwardingResolveInfoUnchecked(filter, sourceUserId,
|
||||||
|
targetUserId);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
if (forwardingInfo == null) {
|
||||||
|
// If all the matches in the target profile are suspended, return null.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
int highestApprovalLevel = DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE;
|
||||||
|
|
||||||
|
int size = resultTargetUser.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
ResolveInfo riTargetUser = resultTargetUser.get(i);
|
||||||
|
if (riTargetUser.handleAllWebDataURI) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String packageName = riTargetUser.activityInfo.packageName;
|
||||||
|
PackageSetting ps = mSettings.getPackageLPr(packageName);
|
||||||
|
if (ps == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
highestApprovalLevel = Math.max(highestApprovalLevel, mDomainVerificationManager
|
||||||
|
.approvalLevelForDomain(ps, intent, flags, targetUserId));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CrossProfileDomainInfo(forwardingInfo, highestApprovalLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter,
|
public ResolveInfo createForwardingResolveInfoUnchecked(WatchedIntentFilter filter,
|
||||||
@@ -3476,34 +3510,59 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return matching ResolveInfo in target user if any.
|
// Return matching ResolveInfo in target user if any.
|
||||||
private ResolveInfo queryCrossProfileIntents(
|
@Nullable
|
||||||
|
private CrossProfileDomainInfo queryCrossProfileIntents(
|
||||||
List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType,
|
List<CrossProfileIntentFilter> matchingFilters, Intent intent, String resolvedType,
|
||||||
int flags, int sourceUserId, boolean matchInCurrentProfile) {
|
int flags, int sourceUserId, boolean matchInCurrentProfile) {
|
||||||
if (matchingFilters != null) {
|
if (matchingFilters == null) {
|
||||||
// Two {@link CrossProfileIntentFilter}s can have the same targetUserId and
|
return null;
|
||||||
// match the same intent. For performance reasons, it is better not to
|
}
|
||||||
// run queryIntent twice for the same userId
|
// Two {@link CrossProfileIntentFilter}s can have the same targetUserId and
|
||||||
SparseBooleanArray alreadyTriedUserIds = new SparseBooleanArray();
|
// match the same intent. For performance reasons, it is better not to
|
||||||
int size = matchingFilters.size();
|
// run queryIntent twice for the same userId
|
||||||
for (int i = 0; i < size; i++) {
|
SparseBooleanArray alreadyTriedUserIds = new SparseBooleanArray();
|
||||||
CrossProfileIntentFilter filter = matchingFilters.get(i);
|
|
||||||
int targetUserId = filter.getTargetUserId();
|
CrossProfileDomainInfo resultInfo = null;
|
||||||
boolean skipCurrentProfile =
|
|
||||||
(filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0;
|
int size = matchingFilters.size();
|
||||||
boolean skipCurrentProfileIfNoMatchFound =
|
for (int i = 0; i < size; i++) {
|
||||||
(filter.getFlags() & PackageManager.ONLY_IF_NO_MATCH_FOUND) != 0;
|
CrossProfileIntentFilter filter = matchingFilters.get(i);
|
||||||
if (!skipCurrentProfile && !alreadyTriedUserIds.get(targetUserId)
|
int targetUserId = filter.getTargetUserId();
|
||||||
&& (!skipCurrentProfileIfNoMatchFound || !matchInCurrentProfile)) {
|
boolean skipCurrentProfile =
|
||||||
// Checking if there are activities in the target user that can handle the
|
(filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0;
|
||||||
// intent.
|
boolean skipCurrentProfileIfNoMatchFound =
|
||||||
ResolveInfo resolveInfo = createForwardingResolveInfo(filter, intent,
|
(filter.getFlags() & PackageManager.ONLY_IF_NO_MATCH_FOUND) != 0;
|
||||||
resolvedType, flags, sourceUserId);
|
if (!skipCurrentProfile && !alreadyTriedUserIds.get(targetUserId)
|
||||||
if (resolveInfo != null) return resolveInfo;
|
&& (!skipCurrentProfileIfNoMatchFound || !matchInCurrentProfile)) {
|
||||||
alreadyTriedUserIds.put(targetUserId, true);
|
// Checking if there are activities in the target user that can handle the
|
||||||
|
// intent.
|
||||||
|
CrossProfileDomainInfo info = createForwardingResolveInfo(filter, intent,
|
||||||
|
resolvedType, flags, sourceUserId);
|
||||||
|
if (info != null) {
|
||||||
|
resultInfo = info;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
alreadyTriedUserIds.put(targetUserId, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
|
if (resultInfo == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ResolveInfo forwardingResolveInfo = resultInfo.resolveInfo;
|
||||||
|
if (!isUserEnabled(forwardingResolveInfo.targetUserId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ResolveInfo> filteredResult =
|
||||||
|
filterIfNotSystemUser(Collections.singletonList(forwardingResolveInfo),
|
||||||
|
sourceUserId);
|
||||||
|
if (filteredResult.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResolveInfo querySkipCurrentProfileIntents(
|
private ResolveInfo querySkipCurrentProfileIntents(
|
||||||
@@ -3516,10 +3575,10 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
if ((filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0) {
|
if ((filter.getFlags() & PackageManager.SKIP_CURRENT_PROFILE) != 0) {
|
||||||
// Checking if there are activities in the target user that can handle the
|
// Checking if there are activities in the target user that can handle the
|
||||||
// intent.
|
// intent.
|
||||||
ResolveInfo resolveInfo = createForwardingResolveInfo(filter, intent,
|
CrossProfileDomainInfo info = createForwardingResolveInfo(filter, intent,
|
||||||
resolvedType, flags, sourceUserId);
|
resolvedType, flags, sourceUserId);
|
||||||
if (resolveInfo != null) {
|
if (info != null) {
|
||||||
return resolveInfo;
|
return info.resolveInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4029,8 +4088,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
if (ps != null) {
|
if (ps != null) {
|
||||||
// only check domain verification status if the app is not a browser
|
// only check domain verification status if the app is not a browser
|
||||||
if (!info.handleAllWebDataURI) {
|
if (!info.handleAllWebDataURI) {
|
||||||
if (hasAnyDomainApproval(mDomainVerificationManager, ps, intent,
|
if (hasAnyDomainApproval(mDomainVerificationManager, ps, intent, flags,
|
||||||
resolvedActivities, flags, userId)) {
|
userId)) {
|
||||||
if (DEBUG_INSTANT) {
|
if (DEBUG_INSTANT) {
|
||||||
Slog.v(TAG, "DENY instant app;" + " pkg: " + packageName
|
Slog.v(TAG, "DENY instant app;" + " pkg: " + packageName
|
||||||
+ ", approved");
|
+ ", approved");
|
||||||
@@ -10131,7 +10190,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
final String packageName = ri.activityInfo.packageName;
|
final String packageName = ri.activityInfo.packageName;
|
||||||
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
final PackageSetting ps = mSettings.getPackageLPr(packageName);
|
||||||
if (ps != null && hasAnyDomainApproval(mDomainVerificationManager, ps,
|
if (ps != null && hasAnyDomainApproval(mDomainVerificationManager, ps,
|
||||||
intent, query, flags, userId)) {
|
intent, flags, userId)) {
|
||||||
return ri;
|
return ri;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10188,10 +10247,10 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
*/
|
*/
|
||||||
private static boolean hasAnyDomainApproval(
|
private static boolean hasAnyDomainApproval(
|
||||||
@NonNull DomainVerificationManagerInternal manager, @NonNull PackageSetting pkgSetting,
|
@NonNull DomainVerificationManagerInternal manager, @NonNull PackageSetting pkgSetting,
|
||||||
@NonNull Intent intent, @NonNull List<ResolveInfo> candidates,
|
@NonNull Intent intent, @PackageManager.ResolveInfoFlags int resolveInfoFlags,
|
||||||
@PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId) {
|
@UserIdInt int userId) {
|
||||||
return manager.approvalLevelForDomain(pkgSetting, intent, candidates, resolveInfoFlags,
|
return manager.approvalLevelForDomain(pkgSetting, intent, resolveInfoFlags, userId)
|
||||||
userId) > DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE;
|
> DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -10624,7 +10683,20 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
private static class CrossProfileDomainInfo {
|
private static class CrossProfileDomainInfo {
|
||||||
/* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */
|
/* ResolveInfo for IntentForwarderActivity to send the intent to the other profile */
|
||||||
ResolveInfo resolveInfo;
|
ResolveInfo resolveInfo;
|
||||||
int highestApprovalLevel = DomainVerificationManagerInternal.APPROVAL_LEVEL_NONE;
|
int highestApprovalLevel;
|
||||||
|
|
||||||
|
CrossProfileDomainInfo(ResolveInfo resolveInfo, int highestApprovalLevel) {
|
||||||
|
this.resolveInfo = resolveInfo;
|
||||||
|
this.highestApprovalLevel = highestApprovalLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "CrossProfileDomainInfo{"
|
||||||
|
+ "resolveInfo=" + resolveInfo
|
||||||
|
+ ", highestApprovalLevel=" + highestApprovalLevel
|
||||||
|
+ '}';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
|
private CrossProfileDomainInfo getCrossProfileDomainPreferredLpr(Intent intent,
|
||||||
|
|||||||
@@ -389,7 +389,6 @@ public interface DomainVerificationManagerInternal {
|
|||||||
*/
|
*/
|
||||||
@ApprovalLevel
|
@ApprovalLevel
|
||||||
int approvalLevelForDomain(@NonNull PackageSetting pkgSetting, @NonNull Intent intent,
|
int approvalLevelForDomain(@NonNull PackageSetting pkgSetting, @NonNull Intent intent,
|
||||||
@NonNull List<ResolveInfo> candidates,
|
|
||||||
@PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId);
|
@PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1717,7 +1717,6 @@ public class DomainVerificationService extends SystemService
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int approvalLevelForDomain(@NonNull PackageSetting pkgSetting, @NonNull Intent intent,
|
public int approvalLevelForDomain(@NonNull PackageSetting pkgSetting, @NonNull Intent intent,
|
||||||
@NonNull List<ResolveInfo> candidates,
|
|
||||||
@PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId) {
|
@PackageManager.ResolveInfoFlags int resolveInfoFlags, @UserIdInt int userId) {
|
||||||
String packageName = pkgSetting.getName();
|
String packageName = pkgSetting.getName();
|
||||||
if (!DomainVerificationUtils.isDomainVerificationIntent(intent, resolveInfoFlags)) {
|
if (!DomainVerificationUtils.isDomainVerificationIntent(intent, resolveInfoFlags)) {
|
||||||
@@ -1783,9 +1782,26 @@ public class DomainVerificationService extends SystemService
|
|||||||
return APPROVAL_LEVEL_NONE;
|
return APPROVAL_LEVEL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pkgUserState.installed || !pkgUserState.isPackageEnabled(pkg)) {
|
if (!pkgUserState.installed) {
|
||||||
if (DEBUG_APPROVAL) {
|
if (DEBUG_APPROVAL) {
|
||||||
debugApproval(packageName, debugObject, userId, false, "package not enabled");
|
debugApproval(packageName, debugObject, userId, false,
|
||||||
|
"package not installed for user");
|
||||||
|
}
|
||||||
|
return APPROVAL_LEVEL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pkgUserState.isPackageEnabled(pkg)) {
|
||||||
|
if (DEBUG_APPROVAL) {
|
||||||
|
debugApproval(packageName, debugObject, userId, false,
|
||||||
|
"package not enabled for user");
|
||||||
|
}
|
||||||
|
return APPROVAL_LEVEL_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pkgUserState.suspended) {
|
||||||
|
if (DEBUG_APPROVAL) {
|
||||||
|
debugApproval(packageName, debugObject, userId, false,
|
||||||
|
"package suspended for user");
|
||||||
}
|
}
|
||||||
return APPROVAL_LEVEL_NONE;
|
return APPROVAL_LEVEL_NONE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CtsDomainVerificationDeviceTestCases"
|
"name": "CtsDomainVerificationDeviceStandaloneTestCases"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "CtsDomainVerificationDeviceMultiUserTestCases"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "CtsDomainVerificationHostTestCases"
|
"name": "CtsDomainVerificationHostTestCases"
|
||||||
|
|||||||
Reference in New Issue
Block a user