Merge "[Status Bar] Set status bar window insets to status bar height always." into udc-dev am: fb4a3c341a
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24026547 Change-Id: I0fbf7deaa26ec6af85014654ff6cd8fc4469266e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -240,8 +240,10 @@ public class StatusBarWindowController {
|
|||||||
Insets.of(0, safeTouchRegionHeight, 0, 0));
|
Insets.of(0, safeTouchRegionHeight, 0, 0));
|
||||||
}
|
}
|
||||||
lp.providedInsets = new InsetsFrameProvider[] {
|
lp.providedInsets = new InsetsFrameProvider[] {
|
||||||
new InsetsFrameProvider(mInsetsSourceOwner, 0, statusBars()),
|
new InsetsFrameProvider(mInsetsSourceOwner, 0, statusBars())
|
||||||
new InsetsFrameProvider(mInsetsSourceOwner, 0, tappableElement()),
|
.setInsetsSize(getInsets(height)),
|
||||||
|
new InsetsFrameProvider(mInsetsSourceOwner, 0, tappableElement())
|
||||||
|
.setInsetsSize(getInsets(height)),
|
||||||
gestureInsetsProvider
|
gestureInsetsProvider
|
||||||
};
|
};
|
||||||
return lp;
|
return lp;
|
||||||
@@ -306,11 +308,36 @@ public class StatusBarWindowController {
|
|||||||
mLpChanged.height =
|
mLpChanged.height =
|
||||||
state.mIsLaunchAnimationRunning ? ViewGroup.LayoutParams.MATCH_PARENT : mBarHeight;
|
state.mIsLaunchAnimationRunning ? ViewGroup.LayoutParams.MATCH_PARENT : mBarHeight;
|
||||||
for (int rot = Surface.ROTATION_0; rot <= Surface.ROTATION_270; rot++) {
|
for (int rot = Surface.ROTATION_0; rot <= Surface.ROTATION_270; rot++) {
|
||||||
|
int height = SystemBarUtils.getStatusBarHeightForRotation(mContext, rot);
|
||||||
mLpChanged.paramsForRotation[rot].height =
|
mLpChanged.paramsForRotation[rot].height =
|
||||||
state.mIsLaunchAnimationRunning ? ViewGroup.LayoutParams.MATCH_PARENT :
|
state.mIsLaunchAnimationRunning ? ViewGroup.LayoutParams.MATCH_PARENT : height;
|
||||||
SystemBarUtils.getStatusBarHeightForRotation(mContext, rot);
|
// The status bar height could change at runtime if one display has a cutout while
|
||||||
|
// another doesn't (like some foldables). It could also change when using debug cutouts.
|
||||||
|
// So, we need to re-fetch the height and re-apply it to the insets each time to avoid
|
||||||
|
// bugs like b/290300359.
|
||||||
|
InsetsFrameProvider[] providers = mLpChanged.paramsForRotation[rot].providedInsets;
|
||||||
|
if (providers != null) {
|
||||||
|
for (InsetsFrameProvider provider : providers) {
|
||||||
|
provider.setInsetsSize(getInsets(height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the insets that should be applied to the status bar window given the current status bar
|
||||||
|
* height.
|
||||||
|
*
|
||||||
|
* The status bar window height can sometimes be full-screen (see {@link #applyHeight(State)}.
|
||||||
|
* However, the status bar *insets* should *not* be full-screen, because this would prevent apps
|
||||||
|
* from drawing any content and can cause animations to be cancelled (see b/283958440). Instead,
|
||||||
|
* the status bar insets should always be equal to the space occupied by the actual status bar
|
||||||
|
* content -- setting the insets correctly will prevent window manager from unnecessarily
|
||||||
|
* re-drawing this window and other windows. This method provides the correct insets.
|
||||||
|
*/
|
||||||
|
private Insets getInsets(int height) {
|
||||||
|
return Insets.of(0, height, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
private void apply(State state) {
|
private void apply(State state) {
|
||||||
if (!mIsAttached) {
|
if (!mIsAttached) {
|
||||||
|
|||||||
Reference in New Issue
Block a user