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

Commit d6941c1e authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Add api for app provided summarizations" into main

parents 65930069 444d951c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6494,6 +6494,7 @@ package android.app {
    method public long getTimeoutAfter();
    method public boolean hasImage();
    method @FlaggedApi("android.app.api_rich_ongoing") public boolean hasPromotableCharacteristics();
    method @FlaggedApi("android.app.nm_summarization") public boolean hasSummarizedContent();
    method public void writeToParcel(android.os.Parcel, int);
    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
    field public static final int BADGE_ICON_LARGE = 2; // 0x2
@@ -6800,6 +6801,7 @@ package android.app {
    method @NonNull public android.app.Notification.Builder setGroup(String);
    method @NonNull public android.app.Notification.Builder setGroupAlertBehavior(int);
    method @NonNull public android.app.Notification.Builder setGroupSummary(boolean);
    method @FlaggedApi("android.app.nm_summarization") @NonNull public android.app.Notification.Builder setHasSummarizedContent(boolean);
    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.drawable.Icon);
    method @Deprecated public android.app.Notification.Builder setLights(@ColorInt int, int, int);
+27 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;
import static android.annotation.Dimension.DP;
import static android.app.Flags.FLAG_NM_SUMMARIZATION;
import static android.app.Flags.evenlyDividedCallStyleActionLayout;
import static android.app.Flags.notificationsRedesignTemplates;
import static android.app.admin.DevicePolicyResources.Drawables.Source.NOTIFICATION;
@@ -1241,6 +1242,12 @@ public class Notification implements Parcelable
     */
    static public IBinder processAllowlistToken;
    /**
     * @hide
     */
    public static final String EXTRA_CONTAINS_SUMMARIZATION
            = "android.app.extra.contains_summarization";
    /**
     * {@link #extras} key: this is the title of the notification,
     * as supplied to {@link Builder#setContentTitle(CharSequence)}.
@@ -4647,6 +4654,18 @@ public class Notification implements Parcelable
            }
        }
        /**
         * Sets whether this notification contains text that was computationally summarized from
         * other sources. The OS may choose to display this notification with different styling or
         * choose not to summarize this content if this is true.
         */
        @FlaggedApi(Flags.FLAG_NM_SUMMARIZATION)
        @NonNull
        public Builder setHasSummarizedContent(boolean hasSummarizedContent) {
            mN.extras.putBoolean(EXTRA_CONTAINS_SUMMARIZATION, hasSummarizedContent);
            return this;
        }
        private ContrastColorUtil getColorUtil() {
            if (mColorUtil == null) {
                mColorUtil = ContrastColorUtil.getInstance(mContext);
@@ -8187,6 +8206,14 @@ public class Notification implements Parcelable
        return mLargeIcon != null || largeIcon != null;
    }
    /**
     * Returns whether this notification contains computationally summarized text.
     */
    @FlaggedApi(FLAG_NM_SUMMARIZATION)
    public boolean hasSummarizedContent() {
        return extras != null && extras.getBoolean(EXTRA_CONTAINS_SUMMARIZATION);
    }
    /**
     * Returns #when, unless it's set to 0, which should be shown as/treated as a 'current'
     * notification. 0 is treated as a special value because it was special in an old version of