Revert "Take into account default app for default grants"
Apparently OEMs can set the chooser so this patch is not enough since it assumes the chooser is a platform component.
This reverts commit fce33d58d8.
Change-Id: I3b8e499d2f0a731a227d193f6c5d6ed528be2272
This commit is contained in:
@@ -583,6 +583,7 @@ final class DefaultPermissionGrantPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void grantDefaultPermissionsToDefaultSystemSmsAppLPr(
|
||||
PackageParser.Package smsPackage, int userId) {
|
||||
if (doesPackageSupportRuntimePermissions(smsPackage)) {
|
||||
@@ -592,6 +593,7 @@ final class DefaultPermissionGrantPolicy {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void grantDefaultPermissionsToDefaultSmsAppLPr(String packageName, int userId) {
|
||||
Log.i(TAG, "Granting permissions to default sms app for user:" + userId);
|
||||
if (packageName == null) {
|
||||
@@ -669,18 +671,29 @@ final class DefaultPermissionGrantPolicy {
|
||||
|
||||
private PackageParser.Package getDefaultSystemHandlerActivityPackageLPr(
|
||||
Intent intent, int userId) {
|
||||
ResolveInfo handler = mService.resolveIntent(intent,
|
||||
intent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||
if (handler == null) {
|
||||
List<ResolveInfo> handlers = mService.mActivities.queryIntent(intent,
|
||||
intent.resolveType(mService.mContext.getContentResolver()),
|
||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
||||
if (handlers == null) {
|
||||
return null;
|
||||
}
|
||||
return getSystemPackageLPr(handler.activityInfo.packageName);
|
||||
final int handlerCount = handlers.size();
|
||||
for (int i = 0; i < handlerCount; i++) {
|
||||
ResolveInfo handler = handlers.get(i);
|
||||
PackageParser.Package handlerPackage = getSystemPackageLPr(
|
||||
handler.activityInfo.packageName);
|
||||
if (handlerPackage != null) {
|
||||
return handlerPackage;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private PackageParser.Package getDefaultSystemHandlerServicePackageLPr(
|
||||
Intent intent, int userId) {
|
||||
List<ResolveInfo> handlers = mService.queryIntentServices(intent,
|
||||
intent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||
intent.resolveType(mService.mContext.getContentResolver()),
|
||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
||||
if (handlers == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -706,9 +719,10 @@ final class DefaultPermissionGrantPolicy {
|
||||
for (String syncAdapterPackageName : syncAdapterPackageNames) {
|
||||
homeIntent.setPackage(syncAdapterPackageName);
|
||||
|
||||
ResolveInfo homeActivity = mService.resolveIntent(homeIntent,
|
||||
homeIntent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||
if (homeActivity != null) {
|
||||
List<ResolveInfo> homeActivities = mService.mActivities.queryIntent(homeIntent,
|
||||
homeIntent.resolveType(mService.mContext.getContentResolver()),
|
||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
||||
if (!homeActivities.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user