diff options
author | Svet Ganov <svetoslavganov@google.com> | 2015-07-15 21:58:47 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-15 21:58:50 +0000 |
commit | 75f6b94a5d5cadb218725011729466e8e438b231 (patch) | |
tree | 0ab0c82098f395cc335b78f3feeef6de14539338 /services/core/java | |
parent | 78b6e6c742a7872ba23c3684c47ff714dbd80cf6 (diff) | |
parent | 50a8bf4da0fe1685bfe6a0ecd9a9677e363e2ee1 (diff) | |
download | frameworks_base-75f6b94a5d5cadb218725011729466e8e438b231.zip frameworks_base-75f6b94a5d5cadb218725011729466e8e438b231.tar.gz frameworks_base-75f6b94a5d5cadb218725011729466e8e438b231.tar.bz2 |
Merge "Grant default permissions to the setup app robustly." into mnc-dev
Diffstat (limited to 'services/core/java')
-rw-r--r-- | services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java | 22 | ||||
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 2 |
2 files changed, 9 insertions, 15 deletions
diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java index e3c6037..7fde68f 100644 --- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java @@ -29,7 +29,6 @@ import android.content.pm.ProviderInfo; import android.content.pm.ResolveInfo; import android.net.Uri; import android.os.Build; -import android.os.Debug; import android.os.UserHandle; import android.provider.CalendarContract; import android.provider.ContactsContract; @@ -120,12 +119,7 @@ final class DefaultPermissionGrantPolicy { private static final Set<String> ACCOUNTS_PERMISSIONS = new ArraySet<>(); static { - //ACCOUNTS_PERMISSIONS.add(Manifest.permission.GET_ACCOUNTS); - } - - private static final Set<String> SETTINGS_PERMISSIONS = new ArraySet<>(); - static { - SETTINGS_PERMISSIONS.add(Manifest.permission.WRITE_SETTINGS); + ACCOUNTS_PERMISSIONS.add(Manifest.permission.GET_ACCOUNTS); } private final PackageManagerService mService; @@ -161,7 +155,7 @@ final class DefaultPermissionGrantPolicy { mDialerAppPackagesProvider = provider; } - public void setSyncAdapterPackagesProviderrLPw(SyncAdapterPackagesProvider provider) { + public void setSyncAdapterPackagesProviderLPw(SyncAdapterPackagesProvider provider) { mSyncAdapterPackagesProvider = provider; } @@ -256,7 +250,7 @@ final class DefaultPermissionGrantPolicy { // SetupWizard Intent setupIntent = new Intent(Intent.ACTION_MAIN); - setupIntent.addCategory(Intent.CATEGORY_HOME); + setupIntent.addCategory(Intent.CATEGORY_SETUP_WIZARD); PackageParser.Package setupPackage = getDefaultSystemHandlerActivityPackageLPr( setupIntent, userId); if (setupPackage != null @@ -374,8 +368,7 @@ final class DefaultPermissionGrantPolicy { // Calendar provider sync adapters List<PackageParser.Package> calendarSyncAdapters = getHeadlessSyncAdapterPackagesLPr( - calendarSyncAdapterPackages, - userId); + calendarSyncAdapterPackages, userId); final int calendarSyncAdapterCount = calendarSyncAdapters.size(); for (int i = 0; i < calendarSyncAdapterCount; i++) { PackageParser.Package calendarSyncAdapter = calendarSyncAdapters.get(i); @@ -398,8 +391,7 @@ final class DefaultPermissionGrantPolicy { // Contacts provider sync adapters List<PackageParser.Package> contactsSyncAdapters = getHeadlessSyncAdapterPackagesLPr( - contactsSyncAdapterPackages, - userId); + contactsSyncAdapterPackages, userId); final int contactsSyncAdapterCount = contactsSyncAdapters.size(); for (int i = 0; i < contactsSyncAdapterCount; i++) { PackageParser.Package contactsSyncAdapter = contactsSyncAdapters.get(i); @@ -628,10 +620,12 @@ final class DefaultPermissionGrantPolicy { List<ResolveInfo> handlers = mService.mActivities.queryIntent(intent, intent.resolveType(mService.mContext.getContentResolver()), PackageManager.GET_DISABLED_COMPONENTS, userId); + if (handlers == null) { + return null; + } final int handlerCount = handlers.size(); for (int i = 0; i < handlerCount; i++) { ResolveInfo handler = handlers.get(i); - // TODO: This is a temporary hack to figure out the setup app. PackageParser.Package handlerPackage = getSystemPackageLPr( handler.activityInfo.packageName); if (handlerPackage != null) { diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index ef9bc8b..4b2c1ff 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -16407,7 +16407,7 @@ public class PackageManagerService extends IPackageManager.Stub { @Override public void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider) { synchronized (mPackages) { - mDefaultPermissionPolicy.setSyncAdapterPackagesProviderrLPw(provider); + mDefaultPermissionPolicy.setSyncAdapterPackagesProviderLPw(provider); } } |