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

Commit e0f778e6 authored by Solti Ho's avatar Solti Ho
Browse files

Revert "Dismiss freeform tasks occluding keyguard in folded transitions"

This reverts commit eff35145.

Reason for revert: build failures on udc-qpr-dev, sample: https://android-build.corp.google.com/builds/quarterdeck?branch=git_udc-qpr-dev&target=bluejay-userdebug&lkgb=10710915&lkbb=10711176&fkbb=10711176

Bug: 261765739
Bug: 293219242
Change-Id: I8e501dfc354ed97272813a32a08d21b32eba967f
parent eff35145
Loading
Loading
Loading
Loading
+13 −39
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.window;

import static android.view.WindowManager.transitTypeToString;

import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.WindowConfiguration;
@@ -49,26 +51,14 @@ public final class TransitionRequestInfo implements Parcelable {
     * The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
     * (if size is changing).
     */
    private @Nullable TransitionRequestInfo.DisplayChange mDisplayChange;

    /** The transition flags known at the time of the request. These may not be complete. */
    private final int mFlags;
    private @Nullable DisplayChange mDisplayChange;

    /** constructor override */
    public TransitionRequestInfo(
            @WindowManager.TransitionType int type,
            @Nullable ActivityManager.RunningTaskInfo triggerTask,
            @Nullable RemoteTransition remoteTransition) {
        this(type, triggerTask, remoteTransition, null /* displayChange */, 0 /* flags */);
    }

    /** constructor override */
    public TransitionRequestInfo(
            @WindowManager.TransitionType int type,
            @Nullable ActivityManager.RunningTaskInfo triggerTask,
            @Nullable RemoteTransition remoteTransition,
            int flags) {
        this(type, triggerTask, remoteTransition, null /* displayChange */, flags);
        this(type, triggerTask, remoteTransition, null /* displayChange */);
    }

    /** Requested change to a display. */
@@ -246,7 +236,7 @@ public final class TransitionRequestInfo implements Parcelable {
        };

        @DataClass.Generated(
                time = 1691627678294L,
                time = 1648141181315L,
                codegenVersion = "1.0.23",
                sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java",
                inputSignatures = "private final  int mDisplayId\nprivate @android.annotation.Nullable android.graphics.Rect mStartAbsBounds\nprivate @android.annotation.Nullable android.graphics.Rect mEndAbsBounds\nprivate  int mStartRotation\nprivate  int mEndRotation\nprivate  boolean mPhysicalDisplayChanged\nclass DisplayChange extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genBuilder=false, genConstructor=false)")
@@ -289,23 +279,19 @@ public final class TransitionRequestInfo implements Parcelable {
     *   If non-null, this request was triggered by this display change. This will not be complete:
     *   The reliable parts should be flags, rotation start/end (if rotating), and start/end bounds
     *   (if size is changing).
     * @param flags
     *   The transition flags known at the time of the request. These may not be complete.
     */
    @DataClass.Generated.Member
    public TransitionRequestInfo(
            @WindowManager.TransitionType int type,
            @Nullable ActivityManager.RunningTaskInfo triggerTask,
            @Nullable RemoteTransition remoteTransition,
            @Nullable TransitionRequestInfo.DisplayChange displayChange,
            int flags) {
            @Nullable DisplayChange displayChange) {
        this.mType = type;
        com.android.internal.util.AnnotationValidations.validate(
                WindowManager.TransitionType.class, null, mType);
        this.mTriggerTask = triggerTask;
        this.mRemoteTransition = remoteTransition;
        this.mDisplayChange = displayChange;
        this.mFlags = flags;

        // onConstructed(); // You can define this method to get a callback
    }
@@ -341,18 +327,10 @@ public final class TransitionRequestInfo implements Parcelable {
     * (if size is changing).
     */
    @DataClass.Generated.Member
    public @Nullable TransitionRequestInfo.DisplayChange getDisplayChange() {
    public @Nullable DisplayChange getDisplayChange() {
        return mDisplayChange;
    }

    /**
     * The transition flags known at the time of the request. These may not be complete.
     */
    @DataClass.Generated.Member
    public int getFlags() {
        return mFlags;
    }

    /**
     * If non-null, If non-null, the task containing the activity whose lifecycle change (start or
     * finish) has caused this transition to occur.
@@ -378,7 +356,7 @@ public final class TransitionRequestInfo implements Parcelable {
     * (if size is changing).
     */
    @DataClass.Generated.Member
    public @android.annotation.NonNull TransitionRequestInfo setDisplayChange(@android.annotation.NonNull TransitionRequestInfo.DisplayChange value) {
    public @android.annotation.NonNull TransitionRequestInfo setDisplayChange(@android.annotation.NonNull DisplayChange value) {
        mDisplayChange = value;
        return this;
    }
@@ -390,11 +368,10 @@ public final class TransitionRequestInfo implements Parcelable {
        // String fieldNameToString() { ... }

        return "TransitionRequestInfo { " +
                "type = " + mType + ", " +
                "type = " + transitTypeToString(mType) + ", " +
                "triggerTask = " + mTriggerTask + ", " +
                "remoteTransition = " + mRemoteTransition + ", " +
                "displayChange = " + mDisplayChange + ", " +
                "flags = " + mFlags +
                "displayChange = " + mDisplayChange +
        " }";
    }

@@ -413,7 +390,6 @@ public final class TransitionRequestInfo implements Parcelable {
        if (mTriggerTask != null) dest.writeTypedObject(mTriggerTask, flags);
        if (mRemoteTransition != null) dest.writeTypedObject(mRemoteTransition, flags);
        if (mDisplayChange != null) dest.writeTypedObject(mDisplayChange, flags);
        dest.writeInt(mFlags);
    }

    @Override
@@ -431,8 +407,7 @@ public final class TransitionRequestInfo implements Parcelable {
        int type = in.readInt();
        ActivityManager.RunningTaskInfo triggerTask = (flg & 0x2) == 0 ? null : (ActivityManager.RunningTaskInfo) in.readTypedObject(ActivityManager.RunningTaskInfo.CREATOR);
        RemoteTransition remoteTransition = (flg & 0x4) == 0 ? null : (RemoteTransition) in.readTypedObject(RemoteTransition.CREATOR);
        TransitionRequestInfo.DisplayChange displayChange = (flg & 0x8) == 0 ? null : (TransitionRequestInfo.DisplayChange) in.readTypedObject(TransitionRequestInfo.DisplayChange.CREATOR);
        int flags = in.readInt();
        DisplayChange displayChange = (flg & 0x8) == 0 ? null : (DisplayChange) in.readTypedObject(DisplayChange.CREATOR);

        this.mType = type;
        com.android.internal.util.AnnotationValidations.validate(
@@ -440,7 +415,6 @@ public final class TransitionRequestInfo implements Parcelable {
        this.mTriggerTask = triggerTask;
        this.mRemoteTransition = remoteTransition;
        this.mDisplayChange = displayChange;
        this.mFlags = flags;

        // onConstructed(); // You can define this method to get a callback
    }
@@ -460,10 +434,10 @@ public final class TransitionRequestInfo implements Parcelable {
    };

    @DataClass.Generated(
            time = 1691627678327L,
            time = 1639445520938L,
            codegenVersion = "1.0.23",
            sourceFile = "frameworks/base/core/java/android/window/TransitionRequestInfo.java",
            inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.window.TransitionRequestInfo.DisplayChange mDisplayChange\nprivate final  int mFlags\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)")
            inputSignatures = "private final @android.view.WindowManager.TransitionType int mType\nprivate @android.annotation.Nullable android.app.ActivityManager.RunningTaskInfo mTriggerTask\nprivate @android.annotation.Nullable android.window.RemoteTransition mRemoteTransition\nprivate @android.annotation.Nullable android.window.TransitionRequestInfo.DisplayChange mDisplayChange\nclass TransitionRequestInfo extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genSetters=true, genAidl=true)")
    @Deprecated
    private void __metadata() {}

+1 −31
Original line number Diff line number Diff line
@@ -16,10 +16,7 @@

package com.android.wm.shell.keyguard;

import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowManager.KEYGUARD_VISIBILITY_TRANSIT_FLAGS;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING;
@@ -30,7 +27,6 @@ import static com.android.wm.shell.util.TransitionUtil.isOpeningType;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
@@ -169,16 +165,10 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
                            if (sct != null) {
                                finishTransaction.merge(sct);
                            }
                            final WindowContainerTransaction mergedWct =
                                    new WindowContainerTransaction();
                            if (wct != null) {
                                mergedWct.merge(wct, true);
                            }
                            maybeDismissFreeformOccludingKeyguard(mergedWct, info);
                            // Post our finish callback to let startAnimation finish first.
                            mMainExecutor.executeDelayed(() -> {
                                mStartedTransitions.remove(transition);
                                finishCallback.onTransitionFinished(mergedWct);
                                finishCallback.onTransitionFinished(wct);
                            }, 0);
                        }
                    });
@@ -270,26 +260,6 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
        }
    }

    private void maybeDismissFreeformOccludingKeyguard(
            WindowContainerTransaction wct, TransitionInfo info) {
        if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_OCCLUDING) == 0) {
            return;
        }
        // There's a window occluding the Keyguard, find it and if it's in freeform mode, change it
        // to fullscreen.
        for (int i = 0; i < info.getChanges().size(); i++) {
            final TransitionInfo.Change change = info.getChanges().get(i);
            final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
            if (taskInfo != null && taskInfo.taskId != INVALID_TASK_ID
                    && taskInfo.getWindowingMode() == WINDOWING_MODE_FREEFORM
                    && taskInfo.isFocused && change.getContainer() != null) {
                wct.setWindowingMode(change.getContainer(), WINDOWING_MODE_FULLSCREEN);
                wct.setBounds(change.getContainer(), null);
                return;
            }
        }
    }

    private static class FakeFinishCallback extends IRemoteTransitionFinishedCallback.Stub {
        @Override
        public void onTransitionFinished(
+1 −4
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FIRST_CUSTOM;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING;
import static android.view.WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_SLEEP;
@@ -1105,9 +1104,7 @@ public class Transitions implements RemoteCallable<Transitions>,
                }
            }
        }
        final boolean isOccludingKeyguard = request.getType() == TRANSIT_KEYGUARD_OCCLUDE
                || ((request.getFlags() & TRANSIT_FLAG_KEYGUARD_OCCLUDING) != 0);
        if (isOccludingKeyguard && request.getTriggerTask() != null
        if (request.getType() == TRANSIT_KEYGUARD_OCCLUDE && request.getTriggerTask() != null
                && request.getTriggerTask().getWindowingMode() == WINDOWING_MODE_FREEFORM) {
            // This freeform task is on top of keyguard, so its windowing mode should be changed to
            // fullscreen.
+1 −1
Original line number Diff line number Diff line
@@ -711,7 +711,7 @@ class TransitionController {
                startTask.fillTaskInfo(info);
            }
            final TransitionRequestInfo request = new TransitionRequestInfo(
                    transition.mType, info, remoteTransition, displayChange, transition.getFlags());
                    transition.mType, info, remoteTransition, displayChange);
            transition.mLogger.mRequestTimeNs = SystemClock.elapsedRealtimeNanos();
            transition.mLogger.mRequest = request;
            mTransitionPlayer.requestStartTransition(transition.getToken(), request);