Merge "Take into account default app for default grants"
am: 82eeb2f20c
* commit '82eeb2f20c934ddc97380032b3c8ecacc21d9a04':
Take into account default app for default grants
This commit is contained in:
@@ -608,7 +608,6 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void grantDefaultPermissionsToDefaultSystemSmsAppLPr(
|
private void grantDefaultPermissionsToDefaultSystemSmsAppLPr(
|
||||||
PackageParser.Package smsPackage, int userId) {
|
PackageParser.Package smsPackage, int userId) {
|
||||||
if (doesPackageSupportRuntimePermissions(smsPackage)) {
|
if (doesPackageSupportRuntimePermissions(smsPackage)) {
|
||||||
@@ -618,7 +617,6 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void grantDefaultPermissionsToDefaultSmsAppLPr(String packageName, int userId) {
|
public void grantDefaultPermissionsToDefaultSmsAppLPr(String packageName, int userId) {
|
||||||
Log.i(TAG, "Granting permissions to default sms app for user:" + userId);
|
Log.i(TAG, "Granting permissions to default sms app for user:" + userId);
|
||||||
if (packageName == null) {
|
if (packageName == null) {
|
||||||
@@ -696,29 +694,18 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
|
|
||||||
private PackageParser.Package getDefaultSystemHandlerActivityPackageLPr(
|
private PackageParser.Package getDefaultSystemHandlerActivityPackageLPr(
|
||||||
Intent intent, int userId) {
|
Intent intent, int userId) {
|
||||||
List<ResolveInfo> handlers = mService.mActivities.queryIntent(intent,
|
ResolveInfo handler = mService.resolveIntent(intent,
|
||||||
intent.resolveType(mService.mContext.getContentResolver()),
|
intent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
if (handler == null) {
|
||||||
if (handlers == null) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final int handlerCount = handlers.size();
|
return getSystemPackageLPr(handler.activityInfo.packageName);
|
||||||
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(
|
private PackageParser.Package getDefaultSystemHandlerServicePackageLPr(
|
||||||
Intent intent, int userId) {
|
Intent intent, int userId) {
|
||||||
List<ResolveInfo> handlers = mService.queryIntentServices(intent,
|
List<ResolveInfo> handlers = mService.queryIntentServices(intent,
|
||||||
intent.resolveType(mService.mContext.getContentResolver()),
|
intent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
|
||||||
if (handlers == null) {
|
if (handlers == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -744,10 +731,9 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
for (String syncAdapterPackageName : syncAdapterPackageNames) {
|
for (String syncAdapterPackageName : syncAdapterPackageNames) {
|
||||||
homeIntent.setPackage(syncAdapterPackageName);
|
homeIntent.setPackage(syncAdapterPackageName);
|
||||||
|
|
||||||
List<ResolveInfo> homeActivities = mService.mActivities.queryIntent(homeIntent,
|
ResolveInfo homeActivity = mService.resolveIntent(homeIntent,
|
||||||
homeIntent.resolveType(mService.mContext.getContentResolver()),
|
homeIntent.resolveType(mService.mContext.getContentResolver()), 0, userId);
|
||||||
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
if (homeActivity != null) {
|
||||||
if (!homeActivities.isEmpty()) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user