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

Commit 39212e47 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[RONs] Colorize public version of RONs

We want RONs to stand out amoung other notifications on the lockscreen. Existing system does not support colorization for public contentview.
With this CL, we colorize them when they are RON.

Bug: 367705002
Flag: android.app.ui_rich_ongoing
Test: Enable "Don't show sensitive content on the lock screen", start screen recorder app, lock screen and check how this notification looks on the lock screen.
Change-Id: Iaf5dd44a09717395d693e2ad7f73db12b44dec1c
parent e18535d5
Loading
Loading
Loading
Loading
+25 −4
Original line number Diff line number Diff line
@@ -6096,6 +6096,21 @@ public class Notification implements Parcelable
            return mColors;
        }
        private void updateHeaderBackgroundColor(RemoteViews contentView,
                StandardTemplateParams p) {
            if (!Flags.uiRichOngoing()) {
                return;
            }
            if (isBackgroundColorized(p)) {
                contentView.setInt(R.id.notification_header, "setBackgroundColor",
                        getBackgroundColor(p));
            } else {
                // Clear it!
                contentView.setInt(R.id.notification_header, "setBackgroundResource",
                        0);
            }
        }
        private void updateBackgroundColor(RemoteViews contentView,
                StandardTemplateParams p) {
            if (isBackgroundColorized(p)) {
@@ -6900,7 +6915,7 @@ public class Notification implements Parcelable
         * @hide
         */
        public RemoteViews makeNotificationGroupHeader() {
            return makeNotificationHeader(mParams.reset()
            return makeNotificationHeader(mParams.reset().disallowColorization()
                    .viewType(StandardTemplateParams.VIEW_TYPE_GROUP_HEADER)
                    .fillTextsFrom(this));
        }
@@ -6912,12 +6927,11 @@ public class Notification implements Parcelable
         * @param p the template params to inflate this with
         */
        private RemoteViews makeNotificationHeader(StandardTemplateParams p) {
            // Headers on their own are never colorized
            p.disallowColorization();
            RemoteViews header = new BuilderRemoteViews(mContext.getApplicationInfo(),
                    getHeaderLayoutResource());
            resetNotificationHeader(header);
            bindNotificationHeader(header, p);
            updateHeaderBackgroundColor(header, p);
            if (Flags.notificationsRedesignTemplates()
                    && (p.mViewType == StandardTemplateParams.VIEW_TYPE_MINIMIZED
                    || p.mViewType == StandardTemplateParams.VIEW_TYPE_PUBLIC)) {
@@ -7041,6 +7055,10 @@ public class Notification implements Parcelable
                    savedBundle.getBoolean(EXTRA_SHOW_CHRONOMETER));
            publicExtras.putBoolean(EXTRA_CHRONOMETER_COUNT_DOWN,
                    savedBundle.getBoolean(EXTRA_CHRONOMETER_COUNT_DOWN));
            if (mN.isPromotedOngoing()) {
                publicExtras.putBoolean(EXTRA_COLORIZED,
                        savedBundle.getBoolean(EXTRA_COLORIZED));
            }
            String appName = savedBundle.getString(EXTRA_SUBSTITUTE_APP_NAME);
            if (appName != null) {
                publicExtras.putString(EXTRA_SUBSTITUTE_APP_NAME, appName);
@@ -7053,6 +7071,9 @@ public class Notification implements Parcelable
            if (isLowPriority) {
                params.highlightExpander(false);
            }
            if (!mN.isPromotedOngoing()) {
                params.disallowColorization();
            }
            view = makeNotificationHeader(params);
            view.setBoolean(R.id.notification_header, "setExpandOnlyOnButton", true);
            mN.extras = savedBundle;
@@ -7072,7 +7093,7 @@ public class Notification implements Parcelable
         * @hide
         */
        public RemoteViews makeLowPriorityContentView(boolean useRegularSubtext) {
            StandardTemplateParams p = mParams.reset()
            StandardTemplateParams p = mParams.reset().disallowColorization()
                    .viewType(StandardTemplateParams.VIEW_TYPE_MINIMIZED)
                    .highlightExpander(false)
                    .fillTextsFrom(this);