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
This commit is contained in:
Jason Monk
2015-05-26 15:56:05 -04:00
parent 85a72a9088
commit 646befdd16
3 changed files with 22 additions and 26 deletions

View File

@@ -878,20 +878,33 @@ public class ApplicationsState {
synchronized (mEntriesMap) {
AppEntry entry = mEntriesMap.get(userId).get(packageName);
if (entry == null) {
for (int i=0; i<mApplications.size(); i++) {
ApplicationInfo info = mApplications.get(i);
if (packageName.equals(info.packageName)
&& userId == UserHandle.getUserId(info.uid)) {
entry = getEntryLocked(info);
break;
ApplicationInfo info = getAppInfoLocked(packageName, userId);
if (info == null) {
try {
info = mIpm.getApplicationInfo(packageName, 0, userId);
} catch (RemoteException e) {
Log.w(TAG, "getEntry couldn't reach PackageManager", e);
return null;
}
}
entry = getEntryLocked(info);
}
if (DEBUG_LOCKING) Log.v(TAG, "...getEntry releasing lock");
return entry;
}
}
private ApplicationInfo getAppInfoLocked(String pkg, int userId) {
for (int i = 0; i < mApplications.size(); i++) {
ApplicationInfo info = mApplications.get(i);
if (pkg.equals(info.packageName)
&& userId == UserHandle.getUserId(info.uid)) {
return info;
}
}
return null;
}
void ensureIcon(AppEntry entry) {
if (entry.icon != null) {
return;
@@ -1153,8 +1166,8 @@ public class ApplicationsState {
mMainHandler.sendMessage(msg);
}
}
if (mCurComputingSizePkg == null
|| (mCurComputingSizePkg.equals(stats.packageName)
if (mCurComputingSizePkg != null
&& (mCurComputingSizePkg.equals(stats.packageName)
&& mCurComputingSizeUserId == stats.userHandle)) {
mCurComputingSizePkg = null;
sendEmptyMessage(MSG_LOAD_SIZES);