Merge "Take into account default app for default grants"
This commit is contained in:
@@ -585,7 +585,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)) {
|
||||||
@@ -595,7 +594,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) {
|
||||||
@@ -673,29 +671,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;
|
||||||
}
|
}
|
||||||
@@ -721,10 +708,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