summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Larsson <mattias7.larsson@sonyericsson.com>2010-06-22 22:37:03 +0200
committerJean-Baptiste Queru <jbq@google.com>2010-07-30 08:36:42 -0700
commita4fd0078d138b433d2250a74833ee3cc6424143a (patch)
tree0c0a4df97e36e40d5c7322e63f758d801d31a3de
parent4506c62abd5767d6d42a97e8e87793a1b3bcb625 (diff)
downloadframeworks_base-a4fd0078d138b433d2250a74833ee3cc6424143a.zip
frameworks_base-a4fd0078d138b433d2250a74833ee3cc6424143a.tar.gz
frameworks_base-a4fd0078d138b433d2250a74833ee3cc6424143a.tar.bz2
Clear preferred activities when home process crashes
If the "default" Home application has been replaced with a third-party app that is repeatedly crashing at start-up, there is no way for the user to clear the preferred activities or uninstall the bad application. If we clear the package preferred activities when the application crashes, the user will be prompted with the ResolverActivity at the next boot and can try using the app again or choose to use another Home application. Change-Id: I8ba8e95e6752916d50515d96c117d3084fa980fd
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index a388311..804af9c 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9047,7 +9047,28 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
sr.crashCount++;
}
}
-
+
+ // If the crashing process is what we consider to be the "home process" and it has been
+ // replaced by a third-party app, clear the package preferred activities from packages
+ // with a home activity running in the process to prevent a repeatedly crashing app
+ // from blocking the user to manually clear the list.
+ if (app == mHomeProcess && mHomeProcess.activities.size() > 0
+ && (mHomeProcess.info.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
+ Iterator it = mHomeProcess.activities.iterator();
+ while (it.hasNext()) {
+ HistoryRecord r = (HistoryRecord)it.next();
+ if (r.isHomeActivity) {
+ Log.i(TAG, "Clearing package preferred activities from " + r.packageName);
+ try {
+ ActivityThread.getPackageManager()
+ .clearPackagePreferredActivities(r.packageName);
+ } catch (RemoteException c) {
+ // pm is in same process, this will never happen.
+ }
+ }
+ }
+ }
+
mProcessCrashTimes.put(app.info.processName, app.info.uid, now);
return true;
}