Merge "Reland "Use non-cached value when calculation button forced visible state"" into udc-dev
This commit is contained in:
@@ -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);
|
||||
@@ -301,16 +301,20 @@ public class InsetsFrameProvider implements Parcelable {
|
||||
inOutFrame.set(containerBounds);
|
||||
} else {
|
||||
extendByCutout = (privateFlags & PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT) != 0;
|
||||
}
|
||||
if (insetsSize == null) {
|
||||
return;
|
||||
if (givenContentInsets != null) {
|
||||
inOutFrame.inset(givenContentInsets);
|
||||
}
|
||||
}
|
||||
if (displayCutoutSafeInsetsSize != null) {
|
||||
sTmpRect2.set(inOutFrame);
|
||||
}
|
||||
calculateInsetsFrame(inOutFrame, insetsSize);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -167,8 +169,6 @@ import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.Lazy;
|
||||
|
||||
/**
|
||||
* Contains logic for a navigation bar view.
|
||||
*/
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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() {
|
||||
@@ -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(
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
@@ -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>>
|
||||
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 */);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user