diff options
| author | Selim Cinek <cinek@google.com> | 2018-02-27 17:35:47 -0800 |
|---|---|---|
| committer | Selim Cinek <cinek@google.com> | 2018-03-20 15:36:17 -0700 |
| commit | aa9db1f34fe8b4a2d143c1379ec6c0c304bbd40b (patch) | |
| tree | 1a33e4ec1ed8f8cf98f5181705f5714c2e2946bb /core/java/android | |
| parent | 29aab967bac9e82884fc834d334b69722da07bd4 (diff) | |
Insetting heads up notifications
Heads up notifications are now corretly respecting insets.
instead of overlapping with any possible notches, we're
insetting heads up notifications and splitting the main
content from the header.
Fixes: 72748440
Test: runtest systemui
Change-Id: Ie53ea31fef4e468239c4346f9d1f192bcb26e11d
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/Notification.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index d8e1c895a6eb..c6568e16086c 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5577,6 +5577,24 @@ public class Notification implements Parcelable public void setRebuildStyledRemoteViews(boolean rebuild) { mRebuildStyledRemoteViews = rebuild; } + + /** + * Get the text that should be displayed in the statusBar when heads upped. This is + * usually just the app name, but may be different depending on the style. + * + * @param publicMode If true, return a text that is safe to display in public. + * + * @hide + */ + public CharSequence getHeadsUpStatusBarText(boolean publicMode) { + if (mStyle != null && !publicMode) { + CharSequence text = mStyle.getHeadsUpStatusBarText(); + if (!TextUtils.isEmpty(text)) { + return text; + } + } + return loadHeaderAppName(); + } } /** @@ -5954,6 +5972,16 @@ public class Notification implements Parcelable * @hide */ public abstract boolean areNotificationsVisiblyDifferent(Style other); + + /** + * @return the the text that should be displayed in the statusBar when heads-upped. + * If {@code null} is returned, the default implementation will be used. + * + * @hide + */ + public CharSequence getHeadsUpStatusBarText() { + return null; + } } /** @@ -6403,6 +6431,23 @@ public class Notification implements Parcelable } /** + * @return the the text that should be displayed in the statusBar when heads upped. + * If {@code null} is returned, the default implementation will be used. + * + * @hide + */ + @Override + public CharSequence getHeadsUpStatusBarText() { + CharSequence conversationTitle = !TextUtils.isEmpty(super.mBigContentTitle) + ? super.mBigContentTitle + : mConversationTitle; + if (!TextUtils.isEmpty(conversationTitle) && !hasOnlyWhiteSpaceSenders()) { + return conversationTitle; + } + return null; + } + + /** * @return the user to be displayed for any replies sent by the user */ public Person getUser() { |
