Loading core/java/android/view/InsetsFrameProvider.java +10 −6 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ public class InsetsFrameProvider implements Parcelable { public static void calculateInsetsFrame(Rect displayFrame, Rect containerBounds, Rect displayCutoutSafe, Rect inOutFrame, int source, Insets insetsSize, @WindowManager.LayoutParams.PrivateFlags int privateFlags, Insets displayCutoutSafeInsetsSize) { Insets displayCutoutSafeInsetsSize, Rect givenContentInsets) { boolean extendByCutout = false; if (source == InsetsFrameProvider.SOURCE_DISPLAY) { inOutFrame.set(displayFrame); Loading @@ -301,16 +301,20 @@ public class InsetsFrameProvider implements Parcelable { inOutFrame.set(containerBounds); } else { extendByCutout = (privateFlags & PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT) != 0; if (givenContentInsets != null) { inOutFrame.inset(givenContentInsets); } if (insetsSize == null) { return; } if (displayCutoutSafeInsetsSize != null) { sTmpRect2.set(inOutFrame); } if (insetsSize != null) { calculateInsetsFrame(inOutFrame, insetsSize); } if (extendByCutout) { if (extendByCutout && insetsSize != null) { // Only extend if the insets size is not null. Otherwise, the frame has already been // extended by the display cutout during layout process. WindowLayout.extendFrameByCutout(displayCutoutSafe, displayFrame, inOutFrame, sTmpRect); } Loading packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +4 −11 Original line number Diff line number Diff line Loading @@ -159,6 +159,8 @@ import com.android.systemui.util.ViewController; import com.android.wm.shell.back.BackAnimation; import com.android.wm.shell.pip.Pip; import dagger.Lazy; import java.io.PrintWriter; import java.util.Locale; import java.util.Map; Loading @@ -167,8 +169,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import dagger.Lazy; /** * Contains logic for a navigation bar view. */ Loading Loading @@ -245,12 +245,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private boolean mTransientShown; private boolean mTransientShownFromGestureOnSystemBar; /** * This is to indicate whether the navigation bar button is forced visible. This is true * when the setup wizard is on display. When that happens, the window frame should be provided * as insets size directly. */ private boolean mIsButtonForceVisible; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; private LightBarController mLightBarController; private final LightBarController mMainLightBarController; Loading Loading @@ -679,8 +673,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mView.setTouchHandler(mTouchHandler); setNavBarMode(mNavBarMode); mEdgeBackGestureHandler.setStateChangeCallback(mView::updateStates); mEdgeBackGestureHandler.setButtonForceVisibleChangeCallback((forceVisible) -> { mIsButtonForceVisible = forceVisible; mEdgeBackGestureHandler.setButtonForcedVisibleChangeCallback((forceVisible) -> { repositionNavigationBar(mCurrentRotation); }); mNavigationBarTransitions.addListener(this::onBarTransition); Loading Loading @@ -1721,7 +1714,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements .setInsetsSizeOverrides(new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride( TYPE_INPUT_METHOD, null)}); if (insetsHeight != -1 && !mIsButtonForceVisible) { if (insetsHeight != -1 && !mEdgeBackGestureHandler.isButtonForcedVisible()) { navBarProvider.setInsetsSize(Insets.of(0, 0, 0, insetsHeight)); } Loading packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +14 −9 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private final OverviewProxyService mOverviewProxyService; private final SysUiState mSysUiState; private Runnable mStateChangeCallback; private Consumer<Boolean> mButtonForceVisibleCallback; private Consumer<Boolean> mButtonForcedVisibleCallback; private final PluginManager mPluginManager; private final ProtoTracer mProtoTracer; Loading Loading @@ -245,7 +245,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private boolean mGestureBlockingActivityRunning; private boolean mIsNewBackAffordanceEnabled; private boolean mIsTrackpadGestureFeaturesEnabled; private boolean mIsButtonForceVisible; private boolean mIsButtonForcedVisible; private InputMonitor mInputMonitor; private InputChannelCompat.InputEventReceiver mInputEventReceiver; Loading Loading @@ -412,8 +412,8 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mStateChangeCallback = callback; } public void setButtonForceVisibleChangeCallback(Consumer<Boolean> callback) { mButtonForceVisibleCallback = callback; public void setButtonForcedVisibleChangeCallback(Consumer<Boolean> callback) { mButtonForcedVisibleCallback = callback; } public int getEdgeWidthLeft() { Loading @@ -428,13 +428,14 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack Resources res = mNavigationModeController.getCurrentUserContext().getResources(); mEdgeWidthLeft = mGestureNavigationSettingsObserver.getLeftSensitivity(res); mEdgeWidthRight = mGestureNavigationSettingsObserver.getRightSensitivity(res); final boolean previousForceVisible = mIsButtonForceVisible; mIsButtonForceVisible = final boolean previousForcedVisible = mIsButtonForcedVisible; mIsButtonForcedVisible = mGestureNavigationSettingsObserver.areNavigationButtonForcedVisible(); if (previousForceVisible != mIsButtonForceVisible && mButtonForceVisibleCallback != null) { mButtonForceVisibleCallback.accept(mIsButtonForceVisible); if (previousForcedVisible != mIsButtonForcedVisible && mButtonForcedVisibleCallback != null) { mButtonForcedVisibleCallback.accept(mIsButtonForcedVisible); } mIsBackGestureAllowed = !mIsButtonForceVisible; mIsBackGestureAllowed = !mIsButtonForcedVisible; final DisplayMetrics dm = res.getDisplayMetrics(); final float defaultGestureHeight = res.getDimension( Loading Loading @@ -635,6 +636,10 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack return mIsEnabled && mIsBackGestureAllowed; } public boolean isButtonForcedVisible() { return mIsButtonForcedVisible; } /** * Update the PiP bounds, used for exclusion calculation. */ Loading services/core/java/com/android/server/wm/DisplayPolicy.java +5 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.view.Display.TYPE_INTERNAL; import static android.view.InsetsFrameProvider.SOURCE_FRAME; 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; Loading Loading @@ -1069,7 +1068,7 @@ public class DisplayPolicy { // runtime as ensured in WMS. Make use of the index in the provider directly // to access the latest provided size at runtime. final TriConsumer<DisplayFrames, WindowContainer, Rect> frameProvider = getFrameProvider(win, provider, i); getFrameProvider(win, i); final InsetsFrameProvider.InsetsSizeOverride[] overrides = provider.getInsetsSizeOverrides(); final SparseArray<TriConsumer<DisplayFrames, WindowContainer, Rect>> Loading @@ -1095,19 +1094,15 @@ public class DisplayPolicy { } } @Nullable private TriConsumer<DisplayFrames, WindowContainer, Rect> getFrameProvider(WindowState win, InsetsFrameProvider provider, int index) { if (provider.getInsetsSize() == null && provider.getSource() == SOURCE_FRAME) { return null; } int index) { return (displayFrames, windowContainer, inOutFrame) -> { final LayoutParams lp = win.mAttrs.forRotation(displayFrames.mRotation); final InsetsFrameProvider ifp = lp.providedInsets[index]; InsetsFrameProvider.calculateInsetsFrame(displayFrames.mUnrestricted, windowContainer.getBounds(), displayFrames.mDisplayCutoutSafe, inOutFrame, ifp.getSource(), ifp.getInsetsSize(), lp.privateFlags, ifp.getMinimalInsetsSizeInDisplayCutoutSafe()); ifp.getMinimalInsetsSizeInDisplayCutoutSafe(), win.mGivenContentInsets); }; } Loading @@ -1120,7 +1115,8 @@ public class DisplayPolicy { InsetsFrameProvider.calculateInsetsFrame(displayFrames.mUnrestricted, windowContainer.getBounds(), displayFrames.mDisplayCutoutSafe, inOutFrame, ifp.getSource(), ifp.getInsetsSizeOverrides()[overrideIndex].getInsetsSize(), lp.privateFlags, null /* displayCutoutSafeInsetsSize */); lp.privateFlags, null /* displayCutoutSafeInsetsSize */, null /* givenContentInsets */); }; } Loading Loading
core/java/android/view/InsetsFrameProvider.java +10 −6 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ public class InsetsFrameProvider implements Parcelable { public static void calculateInsetsFrame(Rect displayFrame, Rect containerBounds, Rect displayCutoutSafe, Rect inOutFrame, int source, Insets insetsSize, @WindowManager.LayoutParams.PrivateFlags int privateFlags, Insets displayCutoutSafeInsetsSize) { Insets displayCutoutSafeInsetsSize, Rect givenContentInsets) { boolean extendByCutout = false; if (source == InsetsFrameProvider.SOURCE_DISPLAY) { inOutFrame.set(displayFrame); Loading @@ -301,16 +301,20 @@ public class InsetsFrameProvider implements Parcelable { inOutFrame.set(containerBounds); } else { extendByCutout = (privateFlags & PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT) != 0; if (givenContentInsets != null) { inOutFrame.inset(givenContentInsets); } if (insetsSize == null) { return; } if (displayCutoutSafeInsetsSize != null) { sTmpRect2.set(inOutFrame); } if (insetsSize != null) { calculateInsetsFrame(inOutFrame, insetsSize); } if (extendByCutout) { if (extendByCutout && insetsSize != null) { // Only extend if the insets size is not null. Otherwise, the frame has already been // extended by the display cutout during layout process. WindowLayout.extendFrameByCutout(displayCutoutSafe, displayFrame, inOutFrame, sTmpRect); } Loading
packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +4 −11 Original line number Diff line number Diff line Loading @@ -159,6 +159,8 @@ import com.android.systemui.util.ViewController; import com.android.wm.shell.back.BackAnimation; import com.android.wm.shell.pip.Pip; import dagger.Lazy; import java.io.PrintWriter; import java.util.Locale; import java.util.Map; Loading @@ -167,8 +169,6 @@ import java.util.concurrent.Executor; import javax.inject.Inject; import dagger.Lazy; /** * Contains logic for a navigation bar view. */ Loading Loading @@ -245,12 +245,6 @@ public class NavigationBar extends ViewController<NavigationBarView> implements private boolean mTransientShown; private boolean mTransientShownFromGestureOnSystemBar; /** * This is to indicate whether the navigation bar button is forced visible. This is true * when the setup wizard is on display. When that happens, the window frame should be provided * as insets size directly. */ private boolean mIsButtonForceVisible; private int mNavBarMode = NAV_BAR_MODE_3BUTTON; private LightBarController mLightBarController; private final LightBarController mMainLightBarController; Loading Loading @@ -679,8 +673,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements mView.setTouchHandler(mTouchHandler); setNavBarMode(mNavBarMode); mEdgeBackGestureHandler.setStateChangeCallback(mView::updateStates); mEdgeBackGestureHandler.setButtonForceVisibleChangeCallback((forceVisible) -> { mIsButtonForceVisible = forceVisible; mEdgeBackGestureHandler.setButtonForcedVisibleChangeCallback((forceVisible) -> { repositionNavigationBar(mCurrentRotation); }); mNavigationBarTransitions.addListener(this::onBarTransition); Loading Loading @@ -1721,7 +1714,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements .setInsetsSizeOverrides(new InsetsFrameProvider.InsetsSizeOverride[] { new InsetsFrameProvider.InsetsSizeOverride( TYPE_INPUT_METHOD, null)}); if (insetsHeight != -1 && !mIsButtonForceVisible) { if (insetsHeight != -1 && !mEdgeBackGestureHandler.isButtonForcedVisible()) { navBarProvider.setInsetsSize(Insets.of(0, 0, 0, insetsHeight)); } Loading
packages/SystemUI/src/com/android/systemui/navigationbar/gestural/EdgeBackGestureHandler.java +14 −9 Original line number Diff line number Diff line Loading @@ -177,7 +177,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private final OverviewProxyService mOverviewProxyService; private final SysUiState mSysUiState; private Runnable mStateChangeCallback; private Consumer<Boolean> mButtonForceVisibleCallback; private Consumer<Boolean> mButtonForcedVisibleCallback; private final PluginManager mPluginManager; private final ProtoTracer mProtoTracer; Loading Loading @@ -245,7 +245,7 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack private boolean mGestureBlockingActivityRunning; private boolean mIsNewBackAffordanceEnabled; private boolean mIsTrackpadGestureFeaturesEnabled; private boolean mIsButtonForceVisible; private boolean mIsButtonForcedVisible; private InputMonitor mInputMonitor; private InputChannelCompat.InputEventReceiver mInputEventReceiver; Loading Loading @@ -412,8 +412,8 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack mStateChangeCallback = callback; } public void setButtonForceVisibleChangeCallback(Consumer<Boolean> callback) { mButtonForceVisibleCallback = callback; public void setButtonForcedVisibleChangeCallback(Consumer<Boolean> callback) { mButtonForcedVisibleCallback = callback; } public int getEdgeWidthLeft() { Loading @@ -428,13 +428,14 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack Resources res = mNavigationModeController.getCurrentUserContext().getResources(); mEdgeWidthLeft = mGestureNavigationSettingsObserver.getLeftSensitivity(res); mEdgeWidthRight = mGestureNavigationSettingsObserver.getRightSensitivity(res); final boolean previousForceVisible = mIsButtonForceVisible; mIsButtonForceVisible = final boolean previousForcedVisible = mIsButtonForcedVisible; mIsButtonForcedVisible = mGestureNavigationSettingsObserver.areNavigationButtonForcedVisible(); if (previousForceVisible != mIsButtonForceVisible && mButtonForceVisibleCallback != null) { mButtonForceVisibleCallback.accept(mIsButtonForceVisible); if (previousForcedVisible != mIsButtonForcedVisible && mButtonForcedVisibleCallback != null) { mButtonForcedVisibleCallback.accept(mIsButtonForcedVisible); } mIsBackGestureAllowed = !mIsButtonForceVisible; mIsBackGestureAllowed = !mIsButtonForcedVisible; final DisplayMetrics dm = res.getDisplayMetrics(); final float defaultGestureHeight = res.getDimension( Loading Loading @@ -635,6 +636,10 @@ public class EdgeBackGestureHandler implements PluginListener<NavigationEdgeBack return mIsEnabled && mIsBackGestureAllowed; } public boolean isButtonForcedVisible() { return mIsButtonForcedVisible; } /** * Update the PiP bounds, used for exclusion calculation. */ Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +5 −9 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.wm; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.view.Display.TYPE_INTERNAL; import static android.view.InsetsFrameProvider.SOURCE_FRAME; 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; Loading Loading @@ -1069,7 +1068,7 @@ public class DisplayPolicy { // runtime as ensured in WMS. Make use of the index in the provider directly // to access the latest provided size at runtime. final TriConsumer<DisplayFrames, WindowContainer, Rect> frameProvider = getFrameProvider(win, provider, i); getFrameProvider(win, i); final InsetsFrameProvider.InsetsSizeOverride[] overrides = provider.getInsetsSizeOverrides(); final SparseArray<TriConsumer<DisplayFrames, WindowContainer, Rect>> Loading @@ -1095,19 +1094,15 @@ public class DisplayPolicy { } } @Nullable private TriConsumer<DisplayFrames, WindowContainer, Rect> getFrameProvider(WindowState win, InsetsFrameProvider provider, int index) { if (provider.getInsetsSize() == null && provider.getSource() == SOURCE_FRAME) { return null; } int index) { return (displayFrames, windowContainer, inOutFrame) -> { final LayoutParams lp = win.mAttrs.forRotation(displayFrames.mRotation); final InsetsFrameProvider ifp = lp.providedInsets[index]; InsetsFrameProvider.calculateInsetsFrame(displayFrames.mUnrestricted, windowContainer.getBounds(), displayFrames.mDisplayCutoutSafe, inOutFrame, ifp.getSource(), ifp.getInsetsSize(), lp.privateFlags, ifp.getMinimalInsetsSizeInDisplayCutoutSafe()); ifp.getMinimalInsetsSizeInDisplayCutoutSafe(), win.mGivenContentInsets); }; } Loading @@ -1120,7 +1115,8 @@ public class DisplayPolicy { InsetsFrameProvider.calculateInsetsFrame(displayFrames.mUnrestricted, windowContainer.getBounds(), displayFrames.mDisplayCutoutSafe, inOutFrame, ifp.getSource(), ifp.getInsetsSizeOverrides()[overrideIndex].getInsetsSize(), lp.privateFlags, null /* displayCutoutSafeInsetsSize */); lp.privateFlags, null /* displayCutoutSafeInsetsSize */, null /* givenContentInsets */); }; } Loading