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
This commit is contained in:
Evan Rosky
2022-06-07 18:18:14 -07:00
parent 804b185119
commit 9f1dae8b99
3 changed files with 17 additions and 5 deletions

View File

@@ -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.
}

View File

@@ -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()));

View File

@@ -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