diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-01-29 15:22:22 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2013-01-29 15:22:22 -0800 |
commit | 596f0cfb4654a18b863f7e6a9dd6742bd57c2b96 (patch) | |
tree | 7d7be2b87b46daebd08536b18fb5f3a4508ad43a /src | |
parent | 159def092cbd07a83ca350fc18ae7abd005aa34e (diff) | |
download | packages_apps_Settings-596f0cfb4654a18b863f7e6a9dd6742bd57c2b96.zip packages_apps_Settings-596f0cfb4654a18b863f7e6a9dd6742bd57c2b96.tar.gz packages_apps_Settings-596f0cfb4654a18b863f7e6a9dd6742bd57c2b96.tar.bz2 |
Improve resetting of application state.
We now reset preferred apps to our defaults, instead of
just clearing everything out.
Change-Id: I70f713ce62b2ffb2d7f6a8e056978847734c27f7
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/applications/ManageApplications.java | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index c6a9792..c48f648 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -1115,6 +1115,8 @@ public class ManageApplications extends Fragment implements public void onClick(DialogInterface dialog, int which) { if (mResetDialog == dialog) { final PackageManager pm = getActivity().getPackageManager(); + final IPackageManager mIPm = IPackageManager.Stub.asInterface( + ServiceManager.getService("package")); final INotificationManager nm = INotificationManager.Stub.asInterface( ServiceManager.getService(Context.NOTIFICATION_SERVICE)); final NetworkPolicyManager npm = NetworkPolicyManager.from(getActivity()); @@ -1130,8 +1132,6 @@ public class ManageApplications extends Fragment implements nm.setNotificationsEnabledForPackage(app.packageName, true); } catch (android.os.RemoteException ex) { } - if (DEBUG) Log.v(TAG, "Clearing preferred: " + app.packageName); - pm.clearPackagePreferredActivities(app.packageName); if (!app.enabled) { if (DEBUG) Log.v(TAG, "Enabling app: " + app.packageName); if (pm.getApplicationEnabledSetting(app.packageName) @@ -1142,16 +1142,9 @@ public class ManageApplications extends Fragment implements } } } - // We should have cleared all of the preferred apps above; - // just in case some may be lingering, retrieve whatever is - // still set and remove it. - ArrayList<IntentFilter> filters = new ArrayList<IntentFilter>(); - ArrayList<ComponentName> prefActivities = new ArrayList<ComponentName>(); - pm.getPreferredActivities(filters, prefActivities, null); - for (int i=0; i<prefActivities.size(); i++) { - if (DEBUG) Log.v(TAG, "Clearing preferred: " - + prefActivities.get(i).getPackageName()); - pm.clearPackagePreferredActivities(prefActivities.get(i).getPackageName()); + try { + mIPm.resetPreferredActivities(UserHandle.myUserId()); + } catch (RemoteException e) { } final int[] restrictedUids = npm.getUidsWithPolicy( POLICY_REJECT_METERED_BACKGROUND); |