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

Commit 9f1dae8b authored by Evan Rosky's avatar Evan Rosky
Browse files

Update InputSink on transition finish

InputSink surface properties depend on whether the activity
is in a transition or not. This means that when the transition
state changes we need to update. Start is currently handled
already via prepareSurface, but finish is not.

Additionally, isInTransition was incorrectly checking if
a transition is ongoing rather than if the activity itself was
in the transition.

Bug: 234636672
Test: atest ActivityRecordInputSinkTests#testOverlappingActivityInNewTask_BlocksTouches
Change-Id: Iff7bc2dfbebe8024a8f666cce9b39bc92fa35a0a
parent 804b1851
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -925,7 +925,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    // SystemUi sets the pinned mode on activity after transition is done.
    boolean mWaitForEnteringPinnedMode;

    private final ActivityRecordInputSink mActivityRecordInputSink;
    final ActivityRecordInputSink mActivityRecordInputSink;

    // Activities with this uid are allowed to not create an input sink while being in the same
    // task and directly above this ActivityRecord. This field is updated whenever a new activity
@@ -7897,7 +7897,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    boolean isInTransition() {
        return mTransitionController.inTransition() // Shell transitions.
        return mTransitionController.inTransition(this) // Shell transitions.
                || isAnimating(PARENTS | TRANSITION); // Legacy transitions.
    }

+2 −2
Original line number Diff line number Diff line
@@ -81,8 +81,8 @@ class ActivityRecordInputSink {
        // Don't block touches from passing through to an activity below us in the same task, if
        // that activity is either from the same uid or if that activity has launched an activity
        // in our uid.
        final ActivityRecord activityBelowInTask =
                mActivityRecord.getTask().getActivityBelow(mActivityRecord);
        final ActivityRecord activityBelowInTask = mActivityRecord.getTask() != null
                ? mActivityRecord.getTask().getActivityBelow(mActivityRecord) : null;
        final boolean allowPassthrough = activityBelowInTask != null && (
                activityBelowInTask.mAllowedTouchUid == mActivityRecord.getUid()
                        || activityBelowInTask.isUid(mActivityRecord.getUid()));
+13 −1
Original line number Diff line number Diff line
@@ -95,7 +95,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;

/**
@@ -656,6 +655,19 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                mController.dispatchLegacyAppTransitionFinished(ar);
            }
        }

        // Update the input-sink (touch-blocking) state now that the animation is finished.
        SurfaceControl.Transaction inputSinkTransaction = null;
        for (int i = 0; i < mParticipants.size(); ++i) {
            final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
            if (ar == null || !ar.isVisible()) continue;
            if (inputSinkTransaction == null) {
                inputSinkTransaction = new SurfaceControl.Transaction();
            }
            ar.mActivityRecordInputSink.applyChangesToSurfaceIfChanged(inputSinkTransaction);
        }
        if (inputSinkTransaction != null) inputSinkTransaction.apply();

        // Always schedule stop processing when transition finishes because activities don't
        // stop while they are in a transition thus their stop could still be pending.
        mController.mAtm.mTaskSupervisor