Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85673d91 authored by Mattias Larsson's avatar Mattias Larsson Committed by Android Git Automerger
Browse files

am a4fd0078: Clear preferred activities when home process crashes

Merge commit 'a4fd0078' into gingerbread-plus-aosp

* commit 'a4fd0078':
  Clear preferred activities when home process crashes
parents eb248a58 a4fd0078
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -6045,6 +6045,27 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
            }
        }

        // 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;
    }