Merge "Add willShowImeOnTarget in RemoteAnimationTarget(Compat)" into tm-qpr-dev am: 5c0ba8f0f5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19395267

Change-Id: I55490a5534b2206ecb23c2822d5e65e639d4abc3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-08-02 13:19:59 +00:00
committed by Automerger Merge Worker
6 changed files with 45 additions and 3 deletions

View File

@@ -45,6 +45,7 @@ import android.os.Build;
import android.os.Parcel; import android.os.Parcel;
import android.os.Parcelable; import android.os.Parcelable;
import android.util.proto.ProtoOutputStream; import android.util.proto.ProtoOutputStream;
import android.window.TaskSnapshot;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@@ -234,6 +235,12 @@ public class RemoteAnimationTarget implements Parcelable {
*/ */
public @ColorInt int backgroundColor; public @ColorInt int backgroundColor;
/**
* Whether the activity is going to show IME on the target window after the app transition.
* @see TaskSnapshot#hasImeSurface() that used the task snapshot during animating task.
*/
public boolean willShowImeOnTarget;
public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent, public RemoteAnimationTarget(int taskId, int mode, SurfaceControl leash, boolean isTranslucent,
Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position, Rect clipRect, Rect contentInsets, int prefixOrderIndex, Point position,
Rect localBounds, Rect screenSpaceBounds, Rect localBounds, Rect screenSpaceBounds,
@@ -294,12 +301,21 @@ public class RemoteAnimationTarget implements Parcelable {
hasAnimatingParent = in.readBoolean(); hasAnimatingParent = in.readBoolean();
backgroundColor = in.readInt(); backgroundColor = in.readInt();
showBackdrop = in.readBoolean(); showBackdrop = in.readBoolean();
willShowImeOnTarget = in.readBoolean();
} }
public void setShowBackdrop(boolean shouldShowBackdrop) { public void setShowBackdrop(boolean shouldShowBackdrop) {
showBackdrop = shouldShowBackdrop; showBackdrop = shouldShowBackdrop;
} }
public void setWillShowImeOnTarget(boolean showImeOnTarget) {
willShowImeOnTarget = showImeOnTarget;
}
public boolean willShowImeOnTarget() {
return willShowImeOnTarget;
}
@Override @Override
public int describeContents() { public int describeContents() {
return 0; return 0;
@@ -328,6 +344,7 @@ public class RemoteAnimationTarget implements Parcelable {
dest.writeBoolean(hasAnimatingParent); dest.writeBoolean(hasAnimatingParent);
dest.writeInt(backgroundColor); dest.writeInt(backgroundColor);
dest.writeBoolean(showBackdrop); dest.writeBoolean(showBackdrop);
dest.writeBoolean(willShowImeOnTarget);
} }
public void dump(PrintWriter pw, String prefix) { public void dump(PrintWriter pw, String prefix) {
@@ -350,6 +367,7 @@ public class RemoteAnimationTarget implements Parcelable {
pw.print(prefix); pw.print("hasAnimatingParent="); pw.print(hasAnimatingParent); pw.print(prefix); pw.print("hasAnimatingParent="); pw.print(hasAnimatingParent);
pw.print(prefix); pw.print("backgroundColor="); pw.print(backgroundColor); pw.print(prefix); pw.print("backgroundColor="); pw.print(backgroundColor);
pw.print(prefix); pw.print("showBackdrop="); pw.print(showBackdrop); pw.print(prefix); pw.print("showBackdrop="); pw.print(showBackdrop);
pw.print(prefix); pw.print("willShowImeOnTarget="); pw.print(willShowImeOnTarget);
} }
public void dumpDebug(ProtoOutputStream proto, long fieldId) { public void dumpDebug(ProtoOutputStream proto, long fieldId) {

View File

@@ -116,6 +116,9 @@ public final class TransitionInfo implements Parcelable {
/** The first unused bit. This can be used by remotes to attach custom flags to this change. */ /** The first unused bit. This can be used by remotes to attach custom flags to this change. */
public static final int FLAG_FIRST_CUSTOM = 1 << 10; public static final int FLAG_FIRST_CUSTOM = 1 << 10;
/** The container is going to show IME on its task after the transition. */
public static final int FLAG_WILL_IME_SHOWN = 1 << 11;
/** @hide */ /** @hide */
@IntDef(prefix = { "FLAG_" }, value = { @IntDef(prefix = { "FLAG_" }, value = {
FLAG_NONE, FLAG_NONE,
@@ -129,7 +132,8 @@ public final class TransitionInfo implements Parcelable {
FLAG_DISPLAY_HAS_ALERT_WINDOWS, FLAG_DISPLAY_HAS_ALERT_WINDOWS,
FLAG_IS_INPUT_METHOD, FLAG_IS_INPUT_METHOD,
FLAG_IS_EMBEDDED, FLAG_IS_EMBEDDED,
FLAG_FIRST_CUSTOM FLAG_FIRST_CUSTOM,
FLAG_WILL_IME_SHOWN
}) })
public @interface ChangeFlags {} public @interface ChangeFlags {}

View File

@@ -79,6 +79,8 @@ public class RemoteAnimationTargetCompat {
// Fields used only to unrap into RemoteAnimationTarget // Fields used only to unrap into RemoteAnimationTarget
private final Rect startBounds; private final Rect startBounds;
public final boolean willShowImeOnTarget;
public RemoteAnimationTargetCompat(RemoteAnimationTarget app) { public RemoteAnimationTargetCompat(RemoteAnimationTarget app) {
taskId = app.taskId; taskId = app.taskId;
mode = app.mode; mode = app.mode;
@@ -102,6 +104,7 @@ public class RemoteAnimationTargetCompat {
windowType = app.windowType; windowType = app.windowType;
windowConfiguration = app.windowConfiguration; windowConfiguration = app.windowConfiguration;
startBounds = app.startBounds; startBounds = app.startBounds;
willShowImeOnTarget = app.willShowImeOnTarget;
} }
private static int newModeToLegacyMode(int newMode) { private static int newModeToLegacyMode(int newMode) {
@@ -118,14 +121,15 @@ public class RemoteAnimationTargetCompat {
} }
public RemoteAnimationTarget unwrap() { public RemoteAnimationTarget unwrap() {
return new RemoteAnimationTarget( final RemoteAnimationTarget target = new RemoteAnimationTarget(
taskId, mode, leash, isTranslucent, clipRect, contentInsets, taskId, mode, leash, isTranslucent, clipRect, contentInsets,
prefixOrderIndex, position, localBounds, screenSpaceBounds, windowConfiguration, prefixOrderIndex, position, localBounds, screenSpaceBounds, windowConfiguration,
isNotInRecents, mStartLeash, startBounds, taskInfo, allowEnterPip, windowType isNotInRecents, mStartLeash, startBounds, taskInfo, allowEnterPip, windowType
); );
target.setWillShowImeOnTarget(willShowImeOnTarget);
return target;
} }
/** /**
* Almost a copy of Transitions#setupStartState. * Almost a copy of Transitions#setupStartState.
* TODO: remove when there is proper cross-process transaction sync. * TODO: remove when there is proper cross-process transaction sync.
@@ -234,6 +238,7 @@ public class RemoteAnimationTargetCompat {
? change.getTaskInfo().configuration.windowConfiguration ? change.getTaskInfo().configuration.windowConfiguration
: new WindowConfiguration(); : new WindowConfiguration();
startBounds = change.getStartAbsBounds(); startBounds = change.getStartAbsBounds();
willShowImeOnTarget = (change.getFlags() & TransitionInfo.FLAG_WILL_IME_SHOWN) != 0;
} }
public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) { public static RemoteAnimationTargetCompat[] wrap(RemoteAnimationTarget[] apps) {

View File

@@ -9755,6 +9755,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null, record.mThumbnailAdapter != null ? record.mThumbnailAdapter.mCapturedLeash : null,
record.mStartBounds, task.getTaskInfo(), checkEnterPictureInPictureAppOpsState()); record.mStartBounds, task.getTaskInfo(), checkEnterPictureInPictureAppOpsState());
target.setShowBackdrop(record.mShowBackdrop); target.setShowBackdrop(record.mShowBackdrop);
target.setWillShowImeOnTarget(mStartingData != null && mStartingData.hasImeSurface());
target.hasAnimatingParent = record.hasAnimatingParent(); target.hasAnimatingParent = record.hasAnimatingParent();
return target; return target;
} }

View File

@@ -1183,6 +1183,12 @@ public class RecentsAnimationController implements DeathRecipient {
mLocalBounds, mBounds, mTask.getWindowConfiguration(), mLocalBounds, mBounds, mTask.getWindowConfiguration(),
mIsRecentTaskInvisible, null, null, mTask.getTaskInfo(), mIsRecentTaskInvisible, null, null, mTask.getTaskInfo(),
topApp.checkEnterPictureInPictureAppOpsState()); topApp.checkEnterPictureInPictureAppOpsState());
final ActivityRecord topActivity = mTask.getTopNonFinishingActivity();
if (topActivity != null && topActivity.mStartingData != null
&& topActivity.mStartingData.hasImeSurface()) {
mTarget.setWillShowImeOnTarget(true);
}
return mTarget; return mTarget;
} }

View File

@@ -54,6 +54,7 @@ import static android.window.TransitionInfo.FLAG_OCCLUDES_KEYGUARD;
import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER; import static android.window.TransitionInfo.FLAG_SHOW_WALLPAPER;
import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT; import static android.window.TransitionInfo.FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT;
import static android.window.TransitionInfo.FLAG_TRANSLUCENT; import static android.window.TransitionInfo.FLAG_TRANSLUCENT;
import static android.window.TransitionInfo.FLAG_WILL_IME_SHOWN;
import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityRecord.State.RESUMED;
import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM;
@@ -1728,6 +1729,13 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
if (task != null && task.voiceSession != null) { if (task != null && task.voiceSession != null) {
flags |= FLAG_IS_VOICE_INTERACTION; flags |= FLAG_IS_VOICE_INTERACTION;
} }
if (task != null) {
final ActivityRecord topActivity = task.getTopNonFinishingActivity();
if (topActivity != null && topActivity.mStartingData != null
&& topActivity.mStartingData.hasImeSurface()) {
flags |= FLAG_WILL_IME_SHOWN;
}
}
final ActivityRecord record = wc.asActivityRecord(); final ActivityRecord record = wc.asActivityRecord();
if (record != null) { if (record != null) {
if (record.mUseTransferredAnimation) { if (record.mUseTransferredAnimation) {