summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorshawnlin <shawnlin@google.com>2022-04-01 12:01:22 +0800
committerShawn Lin <shawnlin@google.com>2022-04-06 15:52:47 +0000
commitdf8300727f008c0b5ccafe604331668a2b60d6f7 (patch)
tree59c3420d113fc23e3c888d002376a4d7c10656e3 /core
parentb9573bc0958c1827ee5bfa5085f47eb0d1df4478 (diff)
[DO NOT MERGE] Fixed status bar glitch for apps that access internal res
In 12L, to support mulit-display devices, we changed the way to get the status bar height by adding an API to calculate instead of directly reading the resource of status_bar_height. However, some apps still using Resources.getIdentify() to get this internal resources dimen as status bar height to layout their UI which cause status bar glitch in their app. For compatibility purpose: 1. Create a new dimen res status_bar_height_default which will be used by framework to determine the status bar heigth 2. For status_bar_height - Set the value to the size which already consider the cutout size for defualt display as before so that it won't breaking existing app. - It is only used for apps using Resources.getIdentifier() Bug: 216782082 Test: verified on the apps with such issue. Change-Id: I306efa187ffa69223c06fd248cfe57d183f96c59 Merged-In: I306efa187ffa69223c06fd248cfe57d183f96c59
Diffstat (limited to 'core')
-rw-r--r--core/java/com/android/internal/policy/SystemBarUtils.java2
-rw-r--r--core/res/res/values-land/dimens.xml2
-rw-r--r--core/res/res/values/dimens.xml7
-rw-r--r--core/res/res/values/symbols.xml2
4 files changed, 10 insertions, 3 deletions
diff --git a/core/java/com/android/internal/policy/SystemBarUtils.java b/core/java/com/android/internal/policy/SystemBarUtils.java
index 6bf1333097f7..5358b96a0f97 100644
--- a/core/java/com/android/internal/policy/SystemBarUtils.java
+++ b/core/java/com/android/internal/policy/SystemBarUtils.java
@@ -43,7 +43,7 @@ public final class SystemBarUtils {
* Gets the status bar height with a specific display cutout.
*/
public static int getStatusBarHeight(Resources res, DisplayCutout cutout) {
- final int defaultSize = res.getDimensionPixelSize(R.dimen.status_bar_height);
+ final int defaultSize = res.getDimensionPixelSize(R.dimen.status_bar_height_default);
final int safeInsetTop = cutout == null ? 0 : cutout.getSafeInsetTop();
final int waterfallInsetTop = cutout == null ? 0 : cutout.getWaterfallInsets().top;
// The status bar height should be:
diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml
index f1e5888d61b9..ca549aeba1f5 100644
--- a/core/res/res/values-land/dimens.xml
+++ b/core/res/res/values-land/dimens.xml
@@ -27,6 +27,8 @@
<dimen name="password_keyboard_spacebar_vertical_correction">2dip</dimen>
<dimen name="preference_widget_width">72dp</dimen>
+ <!-- Height of the status bar -->
+ <dimen name="status_bar_height">@dimen/status_bar_height_landscape</dimen>
<!-- Height of area above QQS where battery/time go -->
<dimen name="quick_qs_offset_height">48dp</dimen>
<!-- Default height of an action bar. -->
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index f331f1ab720f..cafebcec454e 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -39,14 +39,17 @@
<!-- Elevation of toast view -->
<dimen name="toast_elevation">2dp</dimen>
+ <!-- The default height of the status bar used in {@link SystemBarUtils#getStatusBarHeight} to
+ calculate the status bar height. -->
+ <dimen name="status_bar_height_default">24dp</dimen>
<!-- Height of the status bar.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
- <dimen name="status_bar_height">24dp</dimen>
+ <dimen name="status_bar_height">@dimen/status_bar_height_portrait</dimen>
<!-- Height of the status bar in portrait.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
- <dimen name="status_bar_height_portrait">@dimen/status_bar_height</dimen>
+ <dimen name="status_bar_height_portrait">24dp</dimen>
<!-- Height of the status bar in landscape.
Do not read this dimen directly. Use {@link SystemBarUtils#getStatusBarHeight} instead.
-->
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 87a75da31850..af8472f9a90a 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -4492,4 +4492,6 @@
<java-symbol type="array" name="config_roundedCornerBottomRadiusAdjustmentArray" />
<java-symbol type="bool" name="config_secondaryBuiltInDisplayIsRound" />
<java-symbol type="array" name="config_builtInDisplayIsRoundArray" />
+
+ <java-symbol type="dimen" name="status_bar_height_default" />
</resources>