Loading services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +13 −21 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.Manifest; import android.app.DownloadManager; import android.app.DownloadManager; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager; import android.content.Intent; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal.PackagesProvider; import android.content.pm.PackageManagerInternal.PackagesProvider; Loading Loading @@ -585,7 +586,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)) { Loading @@ -595,7 +595,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) { Loading Loading @@ -673,29 +672,23 @@ 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 || handler.activityInfo == null) { if (handlers == null) { return null; return null; } } final int handlerCount = handlers.size(); ActivityInfo activityInfo = handler.activityInfo; for (int i = 0; i < handlerCount; i++) { if (activityInfo.packageName.equals(mService.mResolveActivity.packageName) ResolveInfo handler = handlers.get(i); && activityInfo.name.equals(mService.mResolveActivity.name)) { PackageParser.Package handlerPackage = getSystemPackageLPr( handler.activityInfo.packageName); if (handlerPackage != null) { return handlerPackage; } } return null; return null; } } return getSystemPackageLPr(handler.activityInfo.packageName); } 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; } } Loading @@ -721,10 +714,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; } } Loading Loading
services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +13 −21 Original line number Original line Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.Manifest; import android.app.DownloadManager; import android.app.DownloadManager; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager; import android.content.Intent; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.content.pm.PackageManagerInternal.PackagesProvider; import android.content.pm.PackageManagerInternal.PackagesProvider; Loading Loading @@ -585,7 +586,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)) { Loading @@ -595,7 +595,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) { Loading Loading @@ -673,29 +672,23 @@ 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 || handler.activityInfo == null) { if (handlers == null) { return null; return null; } } final int handlerCount = handlers.size(); ActivityInfo activityInfo = handler.activityInfo; for (int i = 0; i < handlerCount; i++) { if (activityInfo.packageName.equals(mService.mResolveActivity.packageName) ResolveInfo handler = handlers.get(i); && activityInfo.name.equals(mService.mResolveActivity.name)) { PackageParser.Package handlerPackage = getSystemPackageLPr( handler.activityInfo.packageName); if (handlerPackage != null) { return handlerPackage; } } return null; return null; } } return getSystemPackageLPr(handler.activityInfo.packageName); } 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; } } Loading @@ -721,10 +714,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; } } Loading