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

Commit 44c04551 authored by Tiger Huang's avatar Tiger Huang
Browse files

Let getNavBarPosition() can take displayId

Navigation bar can show on non-default display now. So the caller
should specify which display the desired navigation bar is on.

Bug: 117474929
Test: atest QuickStepControllerTest
Change-Id: Ibe06a6c7778134204502e6456860d69bea2a9061
parent ff9d6ab6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ interface IWindowManager
    /**
     * Get the position of the nav bar
     */
    int getNavBarPosition();
    int getNavBarPosition(int displayId);

    /**
     * Lock the device immediately with the specified options (can be null).
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public interface WindowManagerPolicyConstants {
    int PRESENCE_EXTERNAL = 1 << 1;

    // Navigation bar position values
    int NAV_BAR_INVALID = -1;
    int NAV_BAR_LEFT = 1 << 0;
    int NAV_BAR_RIGHT = 1 << 1;
    int NAV_BAR_BOTTOM = 1 << 2;
+4 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.shared.system;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_BOTTOM;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_LEFT;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_RIGHT;

@@ -61,7 +62,7 @@ public class WindowManagerWrapper {
    public static final int TRANSIT_KEYGUARD_OCCLUDE = WindowManager.TRANSIT_KEYGUARD_OCCLUDE;
    public static final int TRANSIT_KEYGUARD_UNOCCLUDE = WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;

    public static final int NAV_BAR_POS_INVALID = -1;
    public static final int NAV_BAR_POS_INVALID = NAV_BAR_INVALID;
    public static final int NAV_BAR_POS_LEFT = NAV_BAR_LEFT;
    public static final int NAV_BAR_POS_RIGHT = NAV_BAR_RIGHT;
    public static final int NAV_BAR_POS_BOTTOM = NAV_BAR_BOTTOM;
@@ -178,10 +179,9 @@ public class WindowManagerWrapper {
     * @see #NAV_BAR_POS_BOTTOM
     * @see #NAV_BAR_POS_INVALID
     */
    public int getNavBarPosition() {
    public int getNavBarPosition(int displayId) {
        try {
            // TODO: Use WindowManagerService.getNavBarPosition(int displayId)
            return WindowManagerGlobal.getWindowManagerService().getNavBarPosition();
            return WindowManagerGlobal.getWindowManagerService().getNavBarPosition(displayId);
        } catch (RemoteException e) {
            Log.w(TAG, "Failed to get nav bar position");
        }
+4 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone;

import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;

import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_DISABLE_QUICK_SCRUB;
import static com.android.systemui.shared.system.NavigationBarCompat.FLAG_SHOW_OVERVIEW_BUTTON;
@@ -950,10 +951,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
    private void updateTaskSwitchHelper() {
        if (mGestureHelper == null) return;
        boolean isRtl = (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
        int navBarPos = 0;
        int navBarPos = NAV_BAR_INVALID;
        try {
            // TODO: Use WindowManagerService.getNavBarPosition(int displayId)
            navBarPos = WindowManagerGlobal.getWindowManagerService().getNavBarPosition();
            navBarPos = WindowManagerGlobal.getWindowManagerService().getNavBarPosition(
                    mDisplay.getDisplayId());
        } catch (RemoteException e) {
            Slog.e(TAG, "Failed to get nav bar position.", e);
        }
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar.phone;

import static android.view.WindowManagerPolicyConstants.NAV_BAR_BOTTOM;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_LEFT;
import static android.view.WindowManagerPolicyConstants.NAV_BAR_RIGHT;

@@ -421,6 +422,9 @@ public class QuickStepController implements GestureHelper {
                mDragHPositive = !isRTL;
                mDragVPositive = true;
                break;
            case NAV_BAR_INVALID:
                Log.e(TAG, "Invalid nav bar position");
                break;
        }

        for (NavigationGestureAction action: mGestureActions) {
Loading