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

Commit 8cdfcd5d authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Don't let IME move to recents activity during recents transition" into...

Merge "Don't let IME move to recents activity during recents transition" into sc-v2-dev am: e7b68347

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

Change-Id: I27be71407cd8ce288e52cf4d899f6f33c9cf8960
parents 3ac3cc4d e7b68347
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -1207,6 +1207,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    },
    "-779535710": {
      "message": "Transition %d: Set %s as transient-launch",
      "level": "VERBOSE",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/Transition.java"
    },
    "-775004869": {
    "-775004869": {
      "message": "Not a match: %s",
      "message": "Not a match: %s",
      "level": "DEBUG",
      "level": "DEBUG",
+6 −6
Original line number Original line Diff line number Diff line
@@ -30,7 +30,6 @@ import static android.app.ActivityManager.START_RETURN_LOCK_TASK_MODE_VIOLATION;
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.ActivityManager.START_SUCCESS;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
import static android.app.ActivityManager.START_TASK_TO_FRONT;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
@@ -1573,11 +1572,7 @@ class ActivityStarter {
            newTransition.setRemoteTransition(remoteTransition);
            newTransition.setRemoteTransition(remoteTransition);
        }
        }
        mService.getTransitionController().collect(r);
        mService.getTransitionController().collect(r);
        // TODO(b/188669821): Remove when navbar reparenting moves to shell
        final boolean isTransient = r.getOptions() != null && r.getOptions().getTransientLaunch();
        if (r.getActivityType() == ACTIVITY_TYPE_HOME && r.getOptions() != null
                && r.getOptions().getTransientLaunch()) {
            mService.getTransitionController().setIsLegacyRecents();
        }
        try {
        try {
            mService.deferWindowLayout();
            mService.deferWindowLayout();
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startActivityInner");
            Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "startActivityInner");
@@ -1625,6 +1620,11 @@ class ActivityStarter {
                    // it as an existence change.
                    // it as an existence change.
                    mService.getTransitionController().collectExistenceChange(r);
                    mService.getTransitionController().collectExistenceChange(r);
                }
                }
                if (isTransient) {
                    // `r` isn't guaranteed to be the actual relevant activity, so we must wait
                    // until after we launched to identify the relevant activity.
                    mService.getTransitionController().setTransientLaunch(mLastStartActivityRecord);
                }
                if (newTransition != null) {
                if (newTransition != null) {
                    mService.getTransitionController().requestStartTransition(newTransition,
                    mService.getTransitionController().requestStartTransition(newTransition,
                            mTargetTask, remoteTransition);
                            mTargetTask, remoteTransition);
+6 −1
Original line number Original line Diff line number Diff line
@@ -578,6 +578,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * Specifies the count to determine whether to defer updating the IME target until ready.
     * Specifies the count to determine whether to defer updating the IME target until ready.
     */
     */
    private int mDeferUpdateImeTargetCount;
    private int mDeferUpdateImeTargetCount;
    private boolean mUpdateImeRequestedWhileDeferred;


    private MagnificationSpec mMagnificationSpec;
    private MagnificationSpec mMagnificationSpec;


@@ -3729,6 +3730,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        final WindowState curTarget = mImeLayeringTarget;
        final WindowState curTarget = mImeLayeringTarget;
        if (!canUpdateImeTarget()) {
        if (!canUpdateImeTarget()) {
            if (DEBUG_INPUT_METHOD) Slog.w(TAG_WM, "Defer updating IME target");
            if (DEBUG_INPUT_METHOD) Slog.w(TAG_WM, "Defer updating IME target");
            mUpdateImeRequestedWhileDeferred = true;
            return curTarget;
            return curTarget;
        }
        }


@@ -4991,6 +4993,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * Increment the deferral count to determine whether to update the IME target.
     * Increment the deferral count to determine whether to update the IME target.
     */
     */
    void deferUpdateImeTarget() {
    void deferUpdateImeTarget() {
        if (mDeferUpdateImeTargetCount == 0) {
            mUpdateImeRequestedWhileDeferred = false;
        }
        mDeferUpdateImeTargetCount++;
        mDeferUpdateImeTargetCount++;
    }
    }


@@ -5004,7 +5009,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }
        }


        mDeferUpdateImeTargetCount--;
        mDeferUpdateImeTargetCount--;
        if (mDeferUpdateImeTargetCount == 0) {
        if (mDeferUpdateImeTargetCount == 0 && mUpdateImeRequestedWhileDeferred) {
            computeImeTarget(true /* updateImeTarget */);
            computeImeTarget(true /* updateImeTarget */);
        }
        }
    }
    }
+17 −0
Original line number Original line Diff line number Diff line
@@ -148,6 +148,9 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
     */
     */
    private final ArraySet<WindowToken> mVisibleAtTransitionEndTokens = new ArraySet<>();
    private final ArraySet<WindowToken> mVisibleAtTransitionEndTokens = new ArraySet<>();


    /** Set of transient activities (lifecycle initially tied to this transition). */
    private ArraySet<ActivityRecord> mTransientLaunches = null;

    /** Custom activity-level animation options and callbacks. */
    /** Custom activity-level animation options and callbacks. */
    private TransitionInfo.AnimationOptions mOverrideOptions;
    private TransitionInfo.AnimationOptions mOverrideOptions;
    private IRemoteCallback mClientAnimationStartCallback = null;
    private IRemoteCallback mClientAnimationStartCallback = null;
@@ -174,6 +177,20 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
        mFlags |= flag;
        mFlags |= flag;
    }
    }


    /** Records an activity as transient-launch. This activity must be already collected. */
    void setTransientLaunch(@NonNull ActivityRecord activity) {
        if (mTransientLaunches == null) {
            mTransientLaunches = new ArraySet<>();
        }
        mTransientLaunches.add(activity);
        ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS, "Transition %d: Set %s as "
                + "transient-launch", mSyncId, activity);
    }

    boolean isTransientLaunch(@NonNull ActivityRecord activity) {
        return mTransientLaunches != null && mTransientLaunches.contains(activity);
    }

    @VisibleForTesting
    @VisibleForTesting
    int getSyncId() {
    int getSyncId() {
        return mSyncId;
        return mSyncId;
+25 −5
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.server.wm;
package com.android.server.wm;


import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_IS_RECENTS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
@@ -185,6 +186,20 @@ class TransitionController {
        return false;
        return false;
    }
    }


    /**
     * @return {@code true} if {@param ar} is part of a transient-launch activity in an active
     * transition.
     */
    boolean isTransientLaunch(@NonNull ActivityRecord ar) {
        if (mCollectingTransition != null && mCollectingTransition.isTransientLaunch(ar)) {
            return true;
        }
        for (int i = mPlayingTransitions.size() - 1; i >= 0; --i) {
            if (mPlayingTransitions.get(i).isTransientLaunch(ar)) return true;
        }
        return false;
    }

    @WindowManager.TransitionType
    @WindowManager.TransitionType
    int getCollectingTransitionType() {
    int getCollectingTransitionType() {
        return mCollectingTransition != null ? mCollectingTransition.mType : TRANSIT_NONE;
        return mCollectingTransition != null ? mCollectingTransition.mType : TRANSIT_NONE;
@@ -331,14 +346,19 @@ class TransitionController {
    }
    }


    /**
    /**
     * Explicitly mark the collectingTransition as being part of recents gesture. Used for legacy
     * Record that the launch of {@param activity} is transient (meaning its lifecycle is currently
     * behaviors.
     * tied to the transition).
     * TODO(b/188669821): Remove once legacy recents behavior is moved to shell.
     */
     */
    void setIsLegacyRecents() {
    void setTransientLaunch(@NonNull ActivityRecord activity) {
        if (mCollectingTransition == null) return;
        if (mCollectingTransition == null) return;
        mCollectingTransition.setTransientLaunch(activity);

        // TODO(b/188669821): Remove once legacy recents behavior is moved to shell.
        // Also interpret HOME transient launch as recents
        if (activity.getActivityType() == ACTIVITY_TYPE_HOME) {
            mCollectingTransition.addFlag(TRANSIT_FLAG_IS_RECENTS);
            mCollectingTransition.addFlag(TRANSIT_FLAG_IS_RECENTS);
        }
        }
    }


    void legacyDetachNavigationBarFromApp(@NonNull IBinder token) {
    void legacyDetachNavigationBarFromApp(@NonNull IBinder token) {
        final Transition transition = Transition.fromBinder(token);
        final Transition transition = Transition.fromBinder(token);
Loading