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

Commit 22d09a38 authored by Johannes Gallmann's avatar Johannes Gallmann Committed by Android (Google) Code Review
Browse files

Merge "[API change] Add EDGE_NONE option for BackEvent#swipeEdge" into main

parents 6d335970 89feacb0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -61760,6 +61760,7 @@ package android.window {
    method public float getTouchX();
    method public float getTouchY();
    field public static final int EDGE_LEFT = 0; // 0x0
    field @FlaggedApi("com.android.window.flags.predictive_back_swipe_edge_none_api") public static final int EDGE_NONE = 2; // 0x2
    field public static final int EDGE_RIGHT = 1; // 0x1
  }
+8 −2
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ import static android.window.DesktopModeFlags.ENABLE_CAPTION_COMPAT_INSET_FORCE_
import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE;
import static com.android.text.flags.Flags.disableHandwritingInitiatorForIme;
import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay;
import static com.android.window.flags.Flags.predictiveBackSwipeEdgeNoneApi;
import static com.android.window.flags.Flags.setScPropertiesInClient;
import static com.android.window.flags.Flags.systemUiImmersiveConfirmationDialog;
@@ -7559,8 +7560,13 @@ public final class ViewRootImpl implements ViewParent,
                        // - 0 means the button was pressed.
                        // - 1 means the button continues to be pressed (long press).
                        if (keyEvent.getRepeatCount() == 0) {
                            animationCallback.onBackStarted(
                                    new BackEvent(0, 0, 0f, BackEvent.EDGE_LEFT));
                            BackEvent backEvent;
                            if (predictiveBackSwipeEdgeNoneApi()) {
                                backEvent = new BackEvent(0, 0, 0f, BackEvent.EDGE_NONE);
                            } else {
                                backEvent = new BackEvent(0, 0, 0f, BackEvent.EDGE_LEFT);
                            }
                            animationCallback.onBackStarted(backEvent);
                        }
                        break;
                    case KeyEvent.ACTION_UP:
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.window;

import static com.android.window.flags.Flags.FLAG_PREDICTIVE_BACK_SWIPE_EDGE_NONE_API;
import static com.android.window.flags.Flags.FLAG_PREDICTIVE_BACK_TIMESTAMP_API;
import static com.android.window.flags.Flags.predictiveBackTimestampApi;

@@ -37,11 +38,19 @@ public final class BackEvent {
    public static final int EDGE_LEFT = 0;
    /** Indicates that the edge swipe starts from the right edge of the screen */
    public static final int EDGE_RIGHT = 1;
    /**
     * Indicates that the back event was not triggered by an edge swipe back gesture. This applies
     * to cases like using the back button in 3-button navigation or pressing a hardware back
     * button.
     */
    @FlaggedApi(FLAG_PREDICTIVE_BACK_SWIPE_EDGE_NONE_API)
    public static final int EDGE_NONE = 2;

    /** @hide */
    @IntDef({
            EDGE_LEFT,
            EDGE_RIGHT,
            EDGE_NONE,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface SwipeEdge{}
+8 −0
Original line number Diff line number Diff line
@@ -332,3 +332,11 @@ flag {
    is_fixed_read_only: true
    bug: "362938401"
}

flag {
    name: "predictive_back_swipe_edge_none_api"
    namespace: "systemui"
    description: "EDGE_NONE swipeEdge option in BackEvent"
    is_fixed_read_only: true
    bug: "362938401"
}