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

Commit d878909a authored by Tiger Huang's avatar Tiger Huang
Browse files

Add BEHAVIOR_DEFAULT for visual immersive mode

BEHAVIOR_DEFAULT lets the user can use single gesture to navigate while
system bars are hidden in gesture navigation mode. The user doesn't
need to make navigation bar visible before performing navigation.

BEHAVIOR_DEFAULT will be the default behavior, which means if there is
no system bar behavior (or any legacy sysui flag about immersive)
specified, the behavior will be BEHAVIOR_DEFAULT instead of
BEHAVIOR_SHOW_BARS_BY_TOUCH.

BEHAVIOR_SHOW_BARS_BY_TOUCH and BEHAVIOR_SHOW_BARS_BY_SWIPE are
deprecated. Their behavior is equivalent to BEHAVIOR_DEFAULT now. The
logic about HideNavInputEventReceiver is removed.

Bug: 168913586
Test: atest WindowInsetsControllerTests ViewRootImplTest
            DisplayPolicyTests CommandQueueTest
            LightsOutNotifControllerTest RegisterStatusBarResultTest
Change-Id: Ic818e323abbb38b57bef9fc36fb1afef2a007f1b
parent bfcc7e5f
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -49378,8 +49378,9 @@ package android.view {
    method public void show(int);
    field public static final int APPEARANCE_LIGHT_NAVIGATION_BARS = 16; // 0x10
    field public static final int APPEARANCE_LIGHT_STATUS_BARS = 8; // 0x8
    field public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; // 0x1
    field public static final int BEHAVIOR_SHOW_BARS_BY_TOUCH = 0; // 0x0
    field public static final int BEHAVIOR_DEFAULT = 1; // 0x1
    field @Deprecated public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; // 0x1
    field @Deprecated public static final int BEHAVIOR_SHOW_BARS_BY_TOUCH = 0; // 0x0
    field public static final int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE = 2; // 0x2
  }
+5 −5
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE;
import static android.view.WindowInsetsController.BEHAVIOR_DEFAULT;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;

import android.view.WindowInsetsController.Appearance;
@@ -60,13 +60,13 @@ public class InsetsFlags {

    @ViewDebug.ExportedProperty(flagMapping = {
            @ViewDebug.FlagToString(
                    mask = BEHAVIOR_SHOW_BARS_BY_SWIPE,
                    equals = BEHAVIOR_SHOW_BARS_BY_SWIPE,
                    name = "SHOW_BARS_BY_SWIPE"),
                    mask = BEHAVIOR_DEFAULT,
                    equals = BEHAVIOR_DEFAULT,
                    name = "DEFAULT"),
            @ViewDebug.FlagToString(
                    mask = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE,
                    equals = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE,
                    name = "SHOW_TRANSIENT_BARS_BY_SWIPE")
    })
    public @Behavior int behavior;
    public @Behavior int behavior = BEHAVIOR_DEFAULT;
}
+3 −0
Original line number Diff line number Diff line
@@ -100,6 +100,9 @@ public class PendingInsetsController implements WindowInsetsController {
        if (mReplayedInsetsController != null) {
            return mReplayedInsetsController.getSystemBarsBehavior();
        }
        if (mBehavior == KEEP_BEHAVIOR) {
            return BEHAVIOR_DEFAULT;
        }
        return mBehavior;
    }

+1 −1
Original line number Diff line number Diff line
@@ -3790,7 +3790,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * <p>Since this flag is a modifier for {@link #SYSTEM_UI_FLAG_HIDE_NAVIGATION}, it only
     * has an effect when used in combination with that flag.</p>
     *
     * @deprecated Use {@link WindowInsetsController#BEHAVIOR_SHOW_BARS_BY_SWIPE} instead.
     * @deprecated Use {@link WindowInsetsController#BEHAVIOR_DEFAULT} instead.
     */
    @Deprecated
    public static final int SYSTEM_UI_FLAG_IMMERSIVE = 0x00000800;
+2 −6
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.view.InsetsState.SIZE;
import static android.view.View.PFLAG_DRAW_ANIMATION;
import static android.view.View.SYSTEM_UI_FLAG_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
import static android.view.View.SYSTEM_UI_FLAG_IMMERSIVE;
import static android.view.View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
import static android.view.View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
@@ -55,8 +54,7 @@ import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;
import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_TOUCH;
import static android.view.WindowInsetsController.BEHAVIOR_DEFAULT;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN;
@@ -2167,10 +2165,8 @@ public final class ViewRootImpl implements ViewParent,
            if ((sysUiVis & SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0
                    || (flags & FLAG_FULLSCREEN) != 0) {
                inOutParams.insetsFlags.behavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
            } else if ((sysUiVis & SYSTEM_UI_FLAG_IMMERSIVE) != 0) {
                inOutParams.insetsFlags.behavior = BEHAVIOR_SHOW_BARS_BY_SWIPE;
            } else {
                inOutParams.insetsFlags.behavior = BEHAVIOR_SHOW_BARS_BY_TOUCH;
                inOutParams.insetsFlags.behavior = BEHAVIOR_DEFAULT;
            }
        }

Loading