Fix issue #2643754: Launcher is caching widget layouts for too long

With the .apk file names now changing during an update, we need
to make sure to flush all caches related to a package when the
package is removed.  Otherwise we can continue to use the old
package, since its old file may still exist if we try to load it
too soon.

Change-Id: I15f08dffca3feac999dbca4f24bef12a30ca0a66
This commit is contained in:
Dianne Hackborn
2010-05-04 17:22:49 -07:00
parent 5e5202bd6f
commit 4416c3d6e4
5 changed files with 106 additions and 85 deletions

View File

@@ -12269,6 +12269,18 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
}
}
private final void sendPackageBroadcastLocked(int cmd, String[] packages) {
for (int i = mLruProcesses.size() - 1 ; i >= 0 ; i--) {
ProcessRecord r = mLruProcesses.get(i);
if (r.thread != null) {
try {
r.thread.dispatchPackageBroadcast(cmd, packages);
} catch (RemoteException ex) {
}
}
}
}
private final int broadcastIntentLocked(ProcessRecord callerApp,
String callerPackage, Intent intent, String resolvedType,
IIntentReceiver resultTo, int resultCode, String resultData,
@@ -12315,6 +12327,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
for (String pkg : list) {
forceStopPackageLocked(pkg, -1, false, true, true);
}
sendPackageBroadcastLocked(
IApplicationThread.EXTERNAL_STORAGE_UNAVAILABLE, list);
}
} else {
Uri data = intent.getData();
@@ -12324,6 +12338,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
forceStopPackageLocked(ssp,
intent.getIntExtra(Intent.EXTRA_UID, -1), false, true, true);
}
if (intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) {
sendPackageBroadcastLocked(IApplicationThread.PACKAGE_REMOVED,
new String[] {ssp});
}
}
}
}