diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2015-05-12 00:52:57 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-12 00:52:58 +0000 |
commit | e2f43948d1de58e49192b97306e8a4e1c99412f4 (patch) | |
tree | 7de62b5c5df41b5cb6e70b32ff714f814e76790f /services | |
parent | 7c4b054ebffac9f00bae698865f291ce0a14032e (diff) | |
parent | 3453e081e0a94bbb0b8c1d58ce4ccdbf2e53639e (diff) | |
download | frameworks_base-e2f43948d1de58e49192b97306e8a4e1c99412f4.zip frameworks_base-e2f43948d1de58e49192b97306e8a4e1c99412f4.tar.gz frameworks_base-e2f43948d1de58e49192b97306e8a4e1c99412f4.tar.bz2 |
Merge "Add user selectable Default Browser feature - part 6" into mnc-dev
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index aeaa272..477af72 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -9217,7 +9217,9 @@ public class PackageManagerService extends IPackageManager.Stub { synchronized (mPackages) { result = mSettings.updateIntentFilterVerificationStatusLPw(packageName, status, userId); } - scheduleWritePackageRestrictionsLocked(userId); + if (result) { + scheduleWritePackageRestrictionsLocked(userId); + } return result; } @@ -9254,9 +9256,11 @@ public class PackageManagerService extends IPackageManager.Stub { public boolean setDefaultBrowserPackageName(String packageName, int userId) { synchronized (mPackages) { boolean result = mSettings.setDefaultBrowserPackageNameLPr(packageName, userId); - result |= updateIntentVerificationStatus(packageName, - PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS, - UserHandle.myUserId()); + if (packageName != null) { + result |= updateIntentVerificationStatus(packageName, + PackageManager.INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS, + UserHandle.myUserId()); + } return result; } } @@ -11970,6 +11974,7 @@ public class PackageManagerService extends IPackageManager.Stub { if (deletedPs != null) { if ((flags&PackageManager.DELETE_KEEP_DATA) == 0) { clearIntentFilterVerificationsLPw(deletedPs.name, UserHandle.USER_ALL); + clearDefaultBrowserIfNeeded(packageName); if (outInfo != null) { mSettings.mKeySetManagerService.removeAppKeySetDataLPw(packageName); outInfo.removedAppId = mSettings.removePackageLPw(packageName); @@ -12504,7 +12509,7 @@ public class PackageManagerService extends IPackageManager.Stub { succeded = deleteApplicationCacheFilesLI(packageName, userId); } clearExternalStorageDataSync(packageName, userId, false); - if(observer != null) { + if (observer != null) { try { observer.onRemoveCompleted(packageName, succeded); } catch (RemoteException e) { @@ -12873,6 +12878,17 @@ public class PackageManagerService extends IPackageManager.Stub { } } + + void clearDefaultBrowserIfNeeded(String packageName) { + for (int oneUserId : sUserManager.getUserIds()) { + String defaultBrowserPackageName = getDefaultBrowserPackageName(oneUserId); + if (TextUtils.isEmpty(defaultBrowserPackageName)) continue; + if (packageName.equals(defaultBrowserPackageName)) { + setDefaultBrowserPackageName(null, oneUserId); + } + } + } + @Override public void resetPreferredActivities(int userId) { /* TODO: Actually use userId. Why is it being passed in? */ |