diff options
| author | 2017-08-28 12:39:35 -0700 | |
|---|---|---|
| committer | 2017-08-28 15:12:05 -0700 | |
| commit | 5bb6bc6e52de2ee4442bf65fae2b8d6534bf33a6 (patch) | |
| tree | 0217b40cf57c234232f2d8f45f711f8686c88678 | |
| parent | df421a8b471bfe9998bad94ceccb73d839f90206 (diff) | |
Grant location to default launcher
Test: updated DefaultPermissionGrantPolicy test which passes
bug:62959599
Change-Id: Ifaac04758348049dd170a7e7b7ac234dced5f759
| -rw-r--r-- | core/java/android/content/Intent.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java | 17 |
2 files changed, 24 insertions, 3 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index daeb987f5f2a..678aeae9c00f 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -3903,6 +3903,16 @@ public class Intent implements Parcelable, Cloneable { @SdkConstant(SdkConstantType.INTENT_CATEGORY) public static final String CATEGORY_SETUP_WIZARD = "android.intent.category.SETUP_WIZARD"; /** + * This is the home activity, that is the activity that serves as the launcher app + * from there the user can start other apps. Often components with lower/higher + * priority intent filters handle the home intent, for example SetupWizard, to + * setup the device and we need to be able to distinguish the home app from these + * setup helpers. + * @hide + */ + @SdkConstant(SdkConstantType.INTENT_CATEGORY) + public static final String CATEGORY_LAUNCHER_APP = "android.intent.category.LAUNCHER_APP"; + /** * This activity is a preference panel. */ @SdkConstant(SdkConstantType.INTENT_CATEGORY) diff --git a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java index d1aecb1b8d1d..8095f6dbbfe7 100644 --- a/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java +++ b/services/core/java/com/android/server/pm/DefaultPermissionGrantPolicy.java @@ -623,14 +623,25 @@ final class DefaultPermissionGrantPolicy { grantRuntimePermissionsLPw(musicPackage, STORAGE_PERMISSIONS, userId); } + // Home + Intent homeIntent = new Intent(Intent.ACTION_MAIN); + homeIntent.addCategory(Intent.CATEGORY_HOME); + homeIntent.addCategory(Intent.CATEGORY_LAUNCHER_APP); + PackageParser.Package homePackage = getDefaultSystemHandlerActivityPackageLPr( + homeIntent, userId); + if (homePackage != null + && doesPackageSupportRuntimePermissions(homePackage)) { + grantRuntimePermissionsLPw(homePackage, LOCATION_PERMISSIONS, false, userId); + } + // Watches if (mService.hasSystemFeature(PackageManager.FEATURE_WATCH, 0)) { // Home application on watches - Intent homeIntent = new Intent(Intent.ACTION_MAIN); - homeIntent.addCategory(Intent.CATEGORY_HOME_MAIN); + Intent wearHomeIntent = new Intent(Intent.ACTION_MAIN); + wearHomeIntent.addCategory(Intent.CATEGORY_HOME_MAIN); PackageParser.Package wearHomePackage = getDefaultSystemHandlerActivityPackageLPr( - homeIntent, userId); + wearHomeIntent, userId); if (wearHomePackage != null && doesPackageSupportRuntimePermissions(wearHomePackage)) { |