diff options
| author | Mariia Sandrikova <mariiasand@google.com> | 2021-01-28 15:46:34 +0000 |
|---|---|---|
| committer | Mariia Sandrikova <mariiasand@google.com> | 2021-01-29 17:28:15 +0000 |
| commit | 3b9da58ab559ca239fb6941e403b99f689e1fe2d (patch) | |
| tree | 2318c2d9ac01a511e2a1eac8569170e31b4f0c1b /core/java/android | |
| parent | db10b7cb566454d4ca8f95112359f5d5004c6a95 (diff) | |
Allow status and navigation bars to be semi-transparent in letterbox mode.
Before this change, opaque bars were drawn over letterboxed activities to prevent showing a transparent bar over them because that can make notification icons or navigation buttons unreadable due to contrast between letterbox background and an activity. For instance, this happens when letterbox background is solid black while activity is white. To imporve UI in this case, semi-transparent bars are now allowed to be drawn over letterboxed activities.
Test: atest SystemUITests + manual letterbox testing
Fix: 175482966
Fix: 170216100
Change-Id: I35e35d01df7d25a5d77eb64af4e6b800f5020487
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/InsetsFlags.java | 12 | ||||
| -rw-r--r-- | core/java/android/view/WindowInsetsController.java | 15 |
2 files changed, 25 insertions, 2 deletions
diff --git a/core/java/android/view/InsetsFlags.java b/core/java/android/view/InsetsFlags.java index a334907c04bc..3355252c4372 100644 --- a/core/java/android/view/InsetsFlags.java +++ b/core/java/android/view/InsetsFlags.java @@ -21,6 +21,8 @@ import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS; +import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS; +import static android.view.WindowInsetsController.APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS; import static android.view.WindowInsetsController.BEHAVIOR_DEFAULT; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; @@ -54,7 +56,15 @@ public class InsetsFlags { @ViewDebug.FlagToString( mask = APPEARANCE_LIGHT_NAVIGATION_BARS, equals = APPEARANCE_LIGHT_NAVIGATION_BARS, - name = "LIGHT_NAVIGATION_BARS") + name = "LIGHT_NAVIGATION_BARS"), + @ViewDebug.FlagToString( + mask = APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS, + equals = APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS, + name = "SEMI_TRANSPARENT_STATUS_BARS"), + @ViewDebug.FlagToString( + mask = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS, + equals = APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS, + name = "SEMI_TRANSPARENT_NAVIGATION_BARS") }) public @Appearance int appearance; diff --git a/core/java/android/view/WindowInsetsController.java b/core/java/android/view/WindowInsetsController.java index 991ed5518003..227b9f402bba 100644 --- a/core/java/android/view/WindowInsetsController.java +++ b/core/java/android/view/WindowInsetsController.java @@ -67,13 +67,26 @@ public interface WindowInsetsController { int APPEARANCE_LIGHT_NAVIGATION_BARS = 1 << 4; /** + * Makes status bars semi-transparent with dark background and light foreground. + * @hide + */ + int APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS = 1 << 5; + + /** + * Makes navigation bars semi-transparent with dark background and light foreground. + * @hide + */ + int APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS = 1 << 6; + + /** * Determines the appearance of system bars. * @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = {APPEARANCE_OPAQUE_STATUS_BARS, APPEARANCE_OPAQUE_NAVIGATION_BARS, APPEARANCE_LOW_PROFILE_BARS, APPEARANCE_LIGHT_STATUS_BARS, - APPEARANCE_LIGHT_NAVIGATION_BARS}) + APPEARANCE_LIGHT_NAVIGATION_BARS, APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS, + APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS}) @interface Appearance { } |
