From 646befdd16fee63fb399aec47950973b64add3ba Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Tue, 26 May 2015 15:56:05 -0400 Subject: [PATCH] Don't have app info pages load so much info They don't need to resume the ApplicationsState session because they only need info for one app, instead just make sure ApplicationsState can load the info as requested. Bug: 20696893 Change-Id: I146387438348fad1396ac4528819b2f1a93a97bf --- .../settings/applications/AppInfoBase.java | 18 ------------ .../applications/ApplicationsState.java | 29 ++++++++++++++----- .../applications/InstalledAppDetails.java | 1 + 3 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/com/android/settings/applications/AppInfoBase.java b/src/com/android/settings/applications/AppInfoBase.java index ef90fd96aa8..dea18afa3c2 100644 --- a/src/com/android/settings/applications/AppInfoBase.java +++ b/src/com/android/settings/applications/AppInfoBase.java @@ -55,7 +55,6 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment protected boolean mAppControlRestricted = false; protected ApplicationsState mState; - private ApplicationsState.Session mSession; protected ApplicationsState.AppEntry mAppEntry; protected PackageInfo mPackageInfo; protected int mUserId; @@ -77,7 +76,6 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment mFinishing = false; mState = ApplicationsState.getInstance(getActivity().getApplication()); - mSession = mState.newSession(this); Context context = getActivity(); mDpm = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE); @@ -85,9 +83,6 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment IBinder b = ServiceManager.getService(Context.USB_SERVICE); mUsbManager = IUsbManager.Stub.asInterface(b); - // Need to make sure we have loaded applications at this point. - mSession.resume(); - retrieveAppEntry(); } @@ -95,25 +90,12 @@ public abstract class AppInfoBase extends SettingsPreferenceFragment public void onResume() { super.onResume(); mAppControlRestricted = mUserManager.hasUserRestriction(UserManager.DISALLOW_APPS_CONTROL); - mSession.resume(); if (!refreshUi()) { setIntentAndFinish(true, true); } } - @Override - public void onPause() { - super.onPause(); - mSession.pause(); - } - - @Override - public void onDestroyView() { - super.onDestroyView(); - mSession.release(); - } - protected String retrieveAppEntry() { final Bundle args = getArguments(); mPackageName = (args != null) ? args.getString(ARG_PACKAGE_NAME) : null; diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java index 01355d91f64..055e415ed21 100644 --- a/src/com/android/settings/applications/ApplicationsState.java +++ b/src/com/android/settings/applications/ApplicationsState.java @@ -878,20 +878,33 @@ public class ApplicationsState { synchronized (mEntriesMap) { AppEntry entry = mEntriesMap.get(userId).get(packageName); if (entry == null) { - for (int i=0; i