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

Commit 11eedb63 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix various crashes from a destroy-timeout activity"

parents 3b92f796 66b74a82
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ public final class ActivityThread extends ClientTransactionHandler {
    final H mH = new H();
    final Executor mExecutor = new HandlerExecutor(mH);
    final ArrayMap<IBinder, ActivityClientRecord> mActivities = new ArrayMap<>();
    /** The activities to be truly destroyed (not include relaunch). */
    final Map<IBinder, ClientTransactionItem> mActivitiesToBeDestroyed =
            Collections.synchronizedMap(new ArrayMap<IBinder, ClientTransactionItem>());
    // List of new activities (via ActivityRecord.nextIdle) that should
@@ -3078,6 +3079,10 @@ public final class ActivityThread extends ClientTransactionHandler {
    }

    private void reportSizeConfigurations(ActivityClientRecord r) {
        if (mActivitiesToBeDestroyed.containsKey(r.token)) {
            // Size configurations of a destroyed activity is meaningless.
            return;
        }
        Configuration[] configurations = r.activity.getResources().getSizeConfigurations();
        if (configurations == null) {
            return;
@@ -3826,6 +3831,13 @@ public final class ActivityThread extends ClientTransactionHandler {
            // We didn't actually resume the activity, so skipping any follow-up actions.
            return;
        }
        if (mActivitiesToBeDestroyed.containsKey(token)) {
            // Although the activity is resumed, it is going to be destroyed. So the following
            // UI operations are unnecessary and also prevents exception because its token may
            // be gone that window manager cannot recognize it. All necessary cleanup actions
            // performed below will be done while handling destruction.
            return;
        }

        final Activity a = r.activity;

+1 −4
Original line number Diff line number Diff line
@@ -2410,10 +2410,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    public boolean isTopOfTask(IBinder token) {
        synchronized (mGlobalLock) {
            ActivityRecord r = ActivityRecord.isInStackLocked(token);
            if (r == null) {
                throw new IllegalArgumentException();
            }
            return r.getTask().getTopActivity() == r;
            return r != null && r.getTask().getTopActivity() == r;
        }
    }