summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Graciela Wissen Putri <gracielawputri@google.com> 2024-07-04 11:32:23 +0000
committer Graciela Wissen Putri <gracielawputri@google.com> 2024-07-22 14:35:34 +0000
commitbbca8a9cc9d666e0cf6d85fe5c62270bf745021c (patch)
tree0e82431d33a2057e988b6f822cea869f4e9c3706
parent187ee73b96e8cf0d2403de4636480815d5bb900d (diff)
Add taskbarFrameHeight getters to SystemBarUtils
Add shared utils to get taskbarFrameHeight accessible from both core and shell. This is required to predict desktop windowing mode insets when current display is using gesture navbar outside of desktop windowing. Flag: EXEMPT adding getters Test: None Bug: 280496681 Change-Id: Id4104280a3a085b8c67382e6802b4d1b97723c9a
-rw-r--r--core/java/com/android/internal/policy/SystemBarUtils.java7
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java19
-rw-r--r--services/core/java/com/android/server/wm/DisplayContent.java1
3 files changed, 24 insertions, 3 deletions
diff --git a/core/java/com/android/internal/policy/SystemBarUtils.java b/core/java/com/android/internal/policy/SystemBarUtils.java
index efa369715373..4ed15faf8b89 100644
--- a/core/java/com/android/internal/policy/SystemBarUtils.java
+++ b/core/java/com/android/internal/policy/SystemBarUtils.java
@@ -92,4 +92,11 @@ public final class SystemBarUtils {
// Equals to status bar height if status bar height is bigger.
return Math.max(defaultSize, statusBarHeight);
}
+
+ /**
+ * Gets the taskbar frame height.
+ */
+ public static int getTaskbarHeight(Resources res) {
+ return res.getDimensionPixelSize(R.dimen.taskbar_frame_height);
+ }
}
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java
index 86cec02ab138..84e32a229f9e 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayLayout.java
@@ -81,6 +81,7 @@ public class DisplayLayout {
private boolean mHasNavigationBar = false;
private boolean mHasStatusBar = false;
private int mNavBarFrameHeight = 0;
+ private int mTaskbarFrameHeight = 0;
private boolean mAllowSeamlessRotationDespiteNavBarMoving = false;
private boolean mNavigationBarCanMove = false;
private boolean mReverseDefaultRotation = false;
@@ -119,6 +120,7 @@ public class DisplayLayout {
&& mNavigationBarCanMove == other.mNavigationBarCanMove
&& mReverseDefaultRotation == other.mReverseDefaultRotation
&& mNavBarFrameHeight == other.mNavBarFrameHeight
+ && mTaskbarFrameHeight == other.mTaskbarFrameHeight
&& Objects.equals(mInsetsState, other.mInsetsState);
}
@@ -126,7 +128,7 @@ public class DisplayLayout {
public int hashCode() {
return Objects.hash(mUiMode, mWidth, mHeight, mCutout, mRotation, mDensityDpi,
mNonDecorInsets, mStableInsets, mHasNavigationBar, mHasStatusBar,
- mNavBarFrameHeight, mAllowSeamlessRotationDespiteNavBarMoving,
+ mNavBarFrameHeight, mTaskbarFrameHeight, mAllowSeamlessRotationDespiteNavBarMoving,
mNavigationBarCanMove, mReverseDefaultRotation, mInsetsState);
}
@@ -176,6 +178,7 @@ public class DisplayLayout {
mNavigationBarCanMove = dl.mNavigationBarCanMove;
mReverseDefaultRotation = dl.mReverseDefaultRotation;
mNavBarFrameHeight = dl.mNavBarFrameHeight;
+ mTaskbarFrameHeight = dl.mTaskbarFrameHeight;
mNonDecorInsets.set(dl.mNonDecorInsets);
mStableInsets.set(dl.mStableInsets);
mInsetsState.set(dl.mInsetsState, true /* copySources */);
@@ -214,7 +217,8 @@ public class DisplayLayout {
if (mHasStatusBar) {
convertNonDecorInsetsToStableInsets(res, mStableInsets, mCutout, mHasStatusBar);
}
- mNavBarFrameHeight = getNavigationBarFrameHeight(res, mWidth > mHeight);
+ mNavBarFrameHeight = getNavigationBarFrameHeight(res, /* landscape */ mWidth > mHeight);
+ mTaskbarFrameHeight = SystemBarUtils.getTaskbarHeight(res);
}
/**
@@ -321,6 +325,17 @@ public class DisplayLayout {
outBounds.inset(mStableInsets);
}
+ /** Predicts the calculated stable bounds when in Desktop Mode. */
+ public void getStableBoundsForDesktopMode(Rect outBounds) {
+ getStableBounds(outBounds);
+
+ if (mNavBarFrameHeight != mTaskbarFrameHeight) {
+ // Currently not in pinned taskbar mode, exclude taskbar insets instead of current
+ // navigation insets from bounds.
+ outBounds.bottom = mHeight - mTaskbarFrameHeight;
+ }
+ }
+
/**
* Gets navigation bar position for this layout
* @return Navigation bar position for this layout.
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index fa603682bc40..4d8d3712a0e7 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -550,7 +550,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
/** Save allocating when calculating rects */
private final Rect mTmpRect = new Rect();
- private final Rect mTmpRect2 = new Rect();
private final Region mTmpRegion = new Region();
private final Configuration mTmpConfiguration = new Configuration();