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

Commit d904ccfc authored by Alison Cichowlas's avatar Alison Cichowlas Committed by Android (Google) Code Review
Browse files

Merge "[RONs] Update promotion eligibility to match new product spec,...

Merge "[RONs] Update promotion eligibility to match new product spec, including new flag guarding behavior change and API." into main
parents a549fc17 3d50897c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6599,6 +6599,7 @@ package android.app {
    field public static final String EXTRA_PROGRESS_MAX = "android.progressMax";
    field public static final String EXTRA_REMOTE_INPUT_DRAFT = "android.remoteInputDraft";
    field public static final String EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory";
    field @FlaggedApi("android.app.opt_in_rich_ongoing") public static final String EXTRA_REQUEST_PROMOTED_ONGOING = "android.REQUEST_PROMOTED_ONGOING";
    field @Deprecated public static final String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName";
    field public static final String EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED = "android.showBigPictureWhenCollapsed";
    field public static final String EXTRA_SHOW_CHRONOMETER = "android.showChronometer";
+34 −8
Original line number Diff line number Diff line
@@ -234,6 +234,13 @@ public class Notification implements Parcelable
     */
    public static final String EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID";
    /**
     * Optional extra for {@link Notification}. If provided, should contain a boolean indicating
     * whether the notification is requesting promoted treatment.
     */
    @FlaggedApi(Flags.FLAG_OPT_IN_RICH_ONGOING)
    public static final String EXTRA_REQUEST_PROMOTED_ONGOING = "android.REQUEST_PROMOTED_ONGOING";
    /**
     * Use all default values (where applicable).
     */
@@ -3302,6 +3309,24 @@ public class Notification implements Parcelable
     */
    @FlaggedApi(Flags.FLAG_API_RICH_ONGOING)
    public boolean hasPromotableCharacteristics() {
        if (Flags.optInRichOngoing()) {
            // New promotable specs:
            // Must explicitly request promotion
            if (!extras.getBoolean(EXTRA_REQUEST_PROMOTED_ONGOING, false)) {
                return false;
            }
            // Must not have disqualifying characteristics
            if (!isOngoingEvent() || isGroupSummary() || containsCustomViews() || !hasTitle()) {
                return false;
            }
            // "Ongoing CallStyle" notifications may be promoted regardless of style
            if (isOngoingCallStyle()) {
                return true;
            }
            // Otherwise, promote if styled correctly and NOT colorized
            return hasPromotableStyle() && !isColorizedRequested();
        } else {
            // Original promotable specs:
            if (!isOngoingEvent() || isGroupSummary() || containsCustomViews() || !hasTitle()) {
                return false;
            }
@@ -3311,6 +3336,7 @@ public class Notification implements Parcelable
            }
            return isColorizedRequested() && hasPromotableStyle();
        }
    }
    /** Returns whether the notification is CallStyle.forOngoingCall(). */
    private boolean isOngoingCallStyle() {
@@ -7127,7 +7153,7 @@ 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()) {
            if (mN.isPromotedOngoing() && !Flags.optInRichOngoing()) {
                publicExtras.putBoolean(EXTRA_COLORIZED,
                        savedBundle.getBoolean(EXTRA_COLORIZED));
            }
+8 −0
Original line number Diff line number Diff line
@@ -247,6 +247,14 @@ flag {
  bug: "337261753"
}

flag {
  name: "opt_in_rich_ongoing"
  namespace: "systemui"
  is_exported: true
  description: "[RONs] v0.2 promotion logic: explicit opt-in and no colorization"
  bug: "410621769"
}

flag {
  name: "ui_rich_ongoing"
  is_exported: true