From 4cbf9b2d5878cdaf8646851f1e86c89984e7ed76 Mon Sep 17 00:00:00 2001 From: Jason Monk Date: Thu, 7 May 2015 13:41:28 -0400 Subject: [PATCH] Detect uninstalled apps during resume Also cleanup disabled apps check while here Bug: 20651305 Change-Id: I5ba8f6e7aee817842bb2ae2ee825647089bcacd3 --- .../applications/ApplicationsState.java | 18 +++++++++++++----- .../applications/ManageApplications.java | 4 +--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java index c5124c61182..6d8f8677282 100644 --- a/src/com/android/settings/applications/ApplicationsState.java +++ b/src/com/android/settings/applications/ApplicationsState.java @@ -802,10 +802,7 @@ public class ApplicationsState { if (mInterestingConfigChanges.applyNewConfig(mContext.getResources())) { // If an interesting part of the configuration has changed, we // should completely reload the app entries. - for (int i = 0; i < mEntriesMap.size(); i++) { - mEntriesMap.valueAt(i).clear(); - } - mAppEntries.clear(); + clearEntries(); } else { for (int i=0; i mApplications.size()) { + // There are less apps now, some must have been uninstalled. + clearEntries(); + } mCurComputingSizePkg = null; if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) { mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES); } } + private void clearEntries() { + for (int i = 0; i < mEntriesMap.size(); i++) { + mEntriesMap.valueAt(i).clear(); + } + mAppEntries.clear(); + } + public boolean haveDisabledApps() { return mHaveDisabledApps; } @@ -1179,7 +1187,7 @@ public class ApplicationsState { int numDone = 0; synchronized (mEntriesMap) { if (DEBUG_LOCKING) Log.v(TAG, "MSG_LOAD_ENTRIES acquired lock"); - for (int i=0; i