Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5de0583 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Apps targeting S can't be exempt from having an expanded view.

Also fixes a small bug that this revealed where right_icon needs to be explicitly cleared.

Test: manual
Fixes: 173550917
Change-Id: Idbbf71ab92876c8cbcfecfac29eaad9d5e6ac485
parent 2ce46560
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -5147,6 +5147,11 @@ public class Notification implements Parcelable
                contentView.setViewVisibility(R.id.right_icon, View.VISIBLE);
                contentView.setImageViewIcon(R.id.right_icon, mN.mLargeIcon);
                processLargeLegacyIcon(mN.mLargeIcon, contentView, p);
            } else {
                // The "reset" doesn't clear the drawable, so we do it here.  This clear is
                // important because the presence of a drawable in this view (regardless of the
                // visibility) is used by NotificationGroupingUtil to set the visibility.
                contentView.setImageViewIcon(R.id.right_icon, null);
            }
            return showLargeIcon;
        }
@@ -5526,9 +5531,17 @@ public class Notification implements Parcelable
            return result;
        }

        // This code is executed on behalf of other apps' notifications, sometimes even by 3p apps,
        // a use case that is not supported by the Compat Framework library.  Workarounds to resolve
        // the change's state in NotificationManagerService were very complex. While it's possible
        // apps can detect the change, it's most likely that the changes will simply result in
        // visual regressions.
        @SuppressWarnings("AndroidFrameworkCompatChange")
        private boolean bigContentViewRequired() {
            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.
            // TODO(b/173550917): add an UNDO style then force this requirement on apps targeting S
            boolean exempt = mN.contentView != null && mN.bigContentView == null
                    && mStyle == null && mActions.size() == 0
                    && mN.extras.getCharSequence(EXTRA_TITLE) == null