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

Commit c7416f62 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Check starting data to decide whether to skip IME animation" into main

parents 0b6bb90b 1db1b6ac
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import android.view.InsetsSourceConsumer;
import android.view.InsetsSourceControl;
import android.view.WindowInsets;
import android.view.inputmethod.ImeTracker;
import android.window.TaskSnapshot;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.ProtoLog;
@@ -78,17 +77,22 @@ final class ImeInsetsSourceProvider extends InsetsSourceProvider {
        final InsetsSourceControl control = super.getControl(target);
        if (control != null && target != null && target.getWindow() != null) {
            final WindowState targetWin = target.getWindow();
            final Task task = targetWin.getTask();
            // If the control target changes during the app transition with the task snapshot
            // starting window and the IME snapshot is visible, in case not have duplicated IME
            // showing animation during transitioning, use a flag to inform IME source control to
            // skip showing animation once.
            final TaskSnapshot snapshot = targetWin.getRootTask() != null
                    ? targetWin.mWmService.getTaskSnapshot(targetWin.getRootTask().mTaskId,
                        0 /* userId */, false /* isLowResolution */, false /* restoreFromDisk */)
                    : null;
            control.setSkipAnimationOnce(targetWin.mActivityRecord != null
                    && targetWin.mActivityRecord.hasStartingWindow()
                    && snapshot != null && snapshot.hasImeSurface());
            StartingData startingData = null;
            if (task != null) {
                startingData = targetWin.mActivityRecord.mStartingData;
                if (startingData == null) {
                    final WindowState startingWin = task.topStartingWindow();
                    if (startingWin != null) {
                        startingData = startingWin.mStartingData;
                    }
                }
            }
            control.setSkipAnimationOnce(startingData != null && startingData.hasImeSurface());
        }
        return control;
    }