From 8733c512480b93553af2e9697d2aa1ccc81d984c Mon Sep 17 00:00:00 2001 From: Jeff DeCew Date: Tue, 9 Mar 2021 21:47:32 -0500 Subject: [PATCH] Fix rules for exempting notifications from the expanded state. Bug: 175207142 Test: Post a notification with a customContentView, but not a bigCustomContentView; note that it is no longer expandable. Change-Id: I9bf41f3313e68ddbb43485cee37911bc8cfeb012 --- core/java/android/app/Notification.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java index 4ebed7a6cf430..f395f3d9111c0 100644 --- a/core/java/android/app/Notification.java +++ b/core/java/android/app/Notification.java @@ -5773,11 +5773,11 @@ public class Notification implements Parcelable if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.S) { return true; } - // If the big content view has no content, we can exempt the app from having to show it. + // Notifications with contentView and without a bigContentView, style, or actions would + // not have an expanded state before S, so showing the standard template expanded state + // usually looks wrong, so we keep it simple and don't show the expanded state. boolean exempt = mN.contentView != null && mN.bigContentView == null - && mStyle == null && mActions.size() == 0 - && mN.extras.getCharSequence(EXTRA_TITLE) == null - && mN.extras.getCharSequence(EXTRA_TEXT) == null; + && mStyle == null && mActions.size() == 0; return !exempt; }