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

Commit c4655419 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Schedule top-resumed-activity-gain after previous one paused" into main

parents 0e01c577 a02252e8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -77,9 +77,9 @@ public class ActivityClient {
     * Reports after {@link Activity#onTopResumedActivityChanged(boolean)} is called for losing the
     * top most position.
     */
    public void activityTopResumedStateLost() {
    public void activityTopResumedStateLost(IBinder token) {
        try {
            getActivityClientController().activityTopResumedStateLost();
            getActivityClientController().activityTopResumedStateLost(token);
        } catch (RemoteException e) {
            e.rethrowFromSystemServer();
        }
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ interface IActivityClientController {
     * This call is not one-way because {@link #activityPaused()) is not one-way, or
     * the top-resumed-lost could be reported after activity paused.
     */
    void activityTopResumedStateLost();
    void activityTopResumedStateLost(in IBinder token);
    /**
     * Notifies that the activity has completed paused. This call is not one-way because it can make
     * consecutive launch in the same process more coherent. About the order of binder call, it
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public class TopResumedActivityChangeItem extends ActivityTransactionItem {
        // 2. Activity wasn't RESUMED yet, which means that it didn't receive the top state yet.
        // 3. Activity is PAUSED or in other lifecycle state after PAUSED. In this case top resumed
        // state loss was already called right before pausing.
        ActivityClient.getInstance().activityTopResumedStateLost();
        ActivityClient.getInstance().activityTopResumedStateLost(getActivityToken());
    }

    // Parcelable implementation
+10 −0
Original line number Diff line number Diff line
@@ -196,3 +196,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "windowing_sdk"
    name: "fix_rapid_top_resumed_switch"
    description: "Prevent top-resumed-activity rapidly switched in multi-window mode."
    bug: "417956804"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -220,10 +220,18 @@ class ActivityClientController extends IActivityClientController.Stub {
    }

    @Override
    public void activityTopResumedStateLost() {
    public void activityTopResumedStateLost(IBinder token) {
        final long origId = Binder.clearCallingIdentity();
        synchronized (mGlobalLock) {
            mTaskSupervisor.handleTopResumedStateReleased(false /* timeout */);
            if (com.android.window.flags.Flags.fixRapidTopResumedSwitch()) {
                final ActivityRecord r = ActivityRecord.forTokenLocked(token);
                if (r != null) {
                    mTaskSupervisor.handleTopResumedStateReleasedIfNeeded(r, false /* timeout */);
                }
            } else {
                mTaskSupervisor.handleTopResumedStateReleasedIfNeeded(null, false /* timeout */);
            }

        }
        Binder.restoreCallingIdentity(origId);
    }
Loading