Merge "Make sure recents animation input consumer is above the top task" into sc-v2-dev

This commit is contained in:
Winson Chung
2021-08-05 20:38:09 +00:00
committed by Android (Google) Code Review
2 changed files with 19 additions and 1 deletions

View File

@@ -539,7 +539,8 @@ final class InputMonitor {
if (mAddRecentsAnimationInputConsumerHandle && shouldApplyRecentsInputConsumer) { if (mAddRecentsAnimationInputConsumerHandle && shouldApplyRecentsInputConsumer) {
if (recentsAnimationController.updateInputConsumerForApp( if (recentsAnimationController.updateInputConsumerForApp(
mRecentsAnimationInputConsumer.mWindowHandle)) { mRecentsAnimationInputConsumer.mWindowHandle)) {
mRecentsAnimationInputConsumer.show(mInputTransaction, w.mActivityRecord); mRecentsAnimationInputConsumer.show(mInputTransaction,
recentsAnimationController.getHighestLayerTask());
mAddRecentsAnimationInputConsumerHandle = false; mAddRecentsAnimationInputConsumerHandle = false;
} }
} }

View File

@@ -1102,6 +1102,23 @@ public class RecentsAnimationController implements DeathRecipient {
return mTargetActivityRecord.findMainWindow(); return mTargetActivityRecord.findMainWindow();
} }
/**
* Returns the task with the highest layer, or null if none is found.
*/
public Task getHighestLayerTask() {
int highestLayer = Integer.MIN_VALUE;
Task highestLayerTask = null;
for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
TaskAnimationAdapter adapter = mPendingAnimations.get(i);
int layer = adapter.mTask.getPrefixOrderIndex();
if (layer > highestLayer) {
highestLayer = layer;
highestLayerTask = adapter.mTask;
}
}
return highestLayerTask;
}
boolean isAnimatingTask(Task task) { boolean isAnimatingTask(Task task) {
for (int i = mPendingAnimations.size() - 1; i >= 0; i--) { for (int i = mPendingAnimations.size() - 1; i >= 0; i--) {
if (task == mPendingAnimations.get(i).mTask) { if (task == mPendingAnimations.get(i).mTask) {