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

Commit e42c74d5 authored by Ben Lin's avatar Ben Lin Committed by Android (Google) Code Review
Browse files

Merge "Calculate Occulusion base on TDA status." into main

parents 5bc9af9d 26e46b53
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -169,8 +169,11 @@ public final class TransitionInfo implements Parcelable {
    /** This change represents its start configuration for the duration of the animation. */
    public static final int FLAG_CONFIG_AT_END = 1 << 22;

    /** This change represents one of a Task Display Area. */
    public static final int FLAG_IS_TASK_DISPLAY_AREA = 1 << 23;

    /** 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 << 23;
    public static final int FLAG_FIRST_CUSTOM = 1 << 24;

    /** The change belongs to a window that won't contain activities. */
    public static final int FLAGS_IS_NON_APP_WINDOW =
@@ -205,6 +208,7 @@ public final class TransitionInfo implements Parcelable {
            FLAG_MOVED_TO_TOP,
            FLAG_SYNC,
            FLAG_CONFIG_AT_END,
            FLAG_IS_TASK_DISPLAY_AREA,
            FLAG_FIRST_CUSTOM
    }, flag = true)
    public @interface ChangeFlags {}
@@ -553,6 +557,9 @@ public final class TransitionInfo implements Parcelable {
        if ((flags & FLAG_MOVED_TO_TOP) != 0) {
            sb.append(sb.length() == 0 ? "" : "|").append("MOVE_TO_TOP");
        }
        if ((flags & FLAG_IS_TASK_DISPLAY_AREA) != 0) {
            sb.append(sb.length() == 0 ? "" : "|").append("FLAG_IS_TASK_DISPLAY_AREA");
        }
        return sb.toString();
    }

+24 −3
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_APPEARING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_OCCLUDING;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_UNOCCLUDING;
import static android.view.WindowManager.TRANSIT_SLEEP;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
@@ -194,7 +193,7 @@ public class KeyguardTransitionHandler

        // Occlude/unocclude animations are only played if the keyguard is locked.
        if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0) {
            if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_OCCLUDING) != 0) {
            if (isKeyguardOccluding(info)) {
                if (hasOpeningDream(info)) {
                    return startAnimation(mOccludeByDreamTransition, "occlude-by-dream",
                            transition, info, startTransaction, finishTransaction, finishCallback);
@@ -202,7 +201,7 @@ public class KeyguardTransitionHandler
                    return startAnimation(mOccludeTransition, "occlude",
                            transition, info, startTransaction, finishTransaction, finishCallback);
                }
            } else if ((info.getFlags() & TRANSIT_FLAG_KEYGUARD_UNOCCLUDING) != 0) {
            } else if (isKeyguardUnoccluding(info)) {
                return startAnimation(mUnoccludeTransition, "unocclude",
                        transition, info, startTransaction, finishTransaction, finishCallback);
            }
@@ -325,6 +324,28 @@ public class KeyguardTransitionHandler
        return false;
    }

    private static boolean isKeyguardOccluding(@NonNull TransitionInfo info) {
        for (int i = 0; i < info.getChanges().size(); i++) {
            TransitionInfo.Change change = info.getChanges().get(i);
            if (change.hasFlags(TransitionInfo.FLAG_IS_TASK_DISPLAY_AREA)
                    && change.getMode() == TRANSIT_TO_FRONT) {
                return true;
            }
        }
        return false;
    }

    private static boolean isKeyguardUnoccluding(@NonNull TransitionInfo info) {
        for (int i = 0; i < info.getChanges().size(); i++) {
            TransitionInfo.Change change = info.getChanges().get(i);
            if (change.hasFlags(TransitionInfo.FLAG_IS_TASK_DISPLAY_AREA)
                    && change.getMode() == TRANSIT_TO_BACK) {
                return true;
            }
        }
        return false;
    }

    private void finishAnimationImmediately(IBinder transition, StartedTransition playing) {
        final IBinder fakeTransition = new Binder();
        final TransitionInfo fakeInfo = new TransitionInfo(TRANSIT_SLEEP, 0x0);
+4 −0
Original line number Diff line number Diff line
@@ -3586,6 +3586,10 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            if (wc.mWmService.mAtmService.mBackNavigationController.isMonitorTransitionTarget(wc)) {
                flags |= TransitionInfo.FLAG_BACK_GESTURE_ANIMATED;
            }
            final TaskDisplayArea tda = wc.asTaskDisplayArea();
            if (tda != null) {
                flags |= TransitionInfo.FLAG_IS_TASK_DISPLAY_AREA;
            }
            final Task task = wc.asTask();
            if (task != null) {
                final ActivityRecord topActivity = task.getTopNonFinishingActivity();