Loading core/java/android/app/Notification.java +0 −156 Original line number Diff line number Diff line Loading @@ -1618,22 +1618,6 @@ public class Notification implements Parcelable */ public static final String EXTRA_DECLINE_COLOR = "android.declineColor"; /** * {@link #extras} key: {@link Icon} of an image used as an overlay Icon on * {@link Notification#mLargeIcon} for {@link EnRouteStyle} notifications. * This extra is an {@code Icon}. * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static final String EXTRA_ENROUTE_OVERLAY_ICON = "android.enrouteOverlayIcon"; /** * {@link #extras} key: text used as a sub-text for the largeIcon of * {@link EnRouteStyle} notification. This extra is a {@code CharSequence}. * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static final String EXTRA_ENROUTE_LARGE_ICON_SUBTEXT = "android.enrouteLargeIconSubText"; /** * {@link #extras} key: whether the notification should be colorized as * supplied to {@link Builder#setColorized(boolean)}. Loading Loading @@ -3152,7 +3136,6 @@ public class Notification implements Parcelable } if (Flags.apiRichOngoing()) { visitIconUri(visitor, extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_TRACKER_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_START_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_END_ICON, Icon.class)); Loading Loading @@ -11172,145 +11155,6 @@ public class Notification implements Parcelable } } /** * TODO(b/360827871): Make EnRouteStyle public. * A style used to represent the progress of a real-world journey with a known destination. * For example: * <ul> * <li>Delivery tracking</li> * <li>Ride progress</li> * <li>Flight tracking</li> * </ul> * * The exact fields from {@link Notification} that are shown with this style may vary by * the surface where this update appears, but the following fields are recommended: * <ul> * <li>{@link Notification.Builder#setContentTitle}</li> * <li>{@link Notification.Builder#setContentText}</li> * <li>{@link Notification.Builder#setSubText}</li> * <li>{@link Notification.Builder#setLargeIcon}</li> * <li>{@link Notification.Builder#setProgress}</li> * <li>{@link Notification.Builder#setWhen} - This should be the future time of the next, * final, or most important stop on this journey.</li> * </ul> * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static class EnRouteStyle extends Notification.Style { @Nullable private Icon mOverlayIcon = null; @Nullable private CharSequence mLargeIconSubText = null; public EnRouteStyle() { } /** * Returns the overlay icon to be displayed on {@link Notification#mLargeIcon}. * @see EnRouteStyle#setOverlayIcon */ @Nullable public Icon getOverlayIcon() { return mOverlayIcon; } /** * Optional icon to be displayed on {@link Notification#mLargeIcon}. * * This image will be cropped to a circle and will obscure * a semicircle of the right side of the large icon. */ @NonNull public EnRouteStyle setOverlayIcon(@Nullable Icon overlayIcon) { mOverlayIcon = overlayIcon; return this; } /** * Returns the sub-text for {@link Notification#mLargeIcon}. * @see EnRouteStyle#setLargeIconSubText */ @Nullable public CharSequence getLargeIconSubText() { return mLargeIconSubText; } /** * Optional text which generally related to * the {@link Notification.Builder#setLargeIcon} or {@link #setOverlayIcon} or both. */ @NonNull public EnRouteStyle setLargeIconSubText(@Nullable CharSequence largeIconSubText) { mLargeIconSubText = stripStyling(largeIconSubText); return this; } /** * @hide */ @Override public boolean areNotificationsVisiblyDifferent(Style other) { if (other == null || getClass() != other.getClass()) { return true; } final EnRouteStyle enRouteStyle = (EnRouteStyle) other; return !Objects.equals(mOverlayIcon, enRouteStyle.mOverlayIcon) || !Objects.equals(mLargeIconSubText, enRouteStyle.mLargeIconSubText); } /** * @hide */ @Override public void addExtras(Bundle extras) { super.addExtras(extras); extras.putParcelable(EXTRA_ENROUTE_OVERLAY_ICON, mOverlayIcon); extras.putCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT, mLargeIconSubText); } /** * @hide */ @Override protected void restoreFromExtras(Bundle extras) { super.restoreFromExtras(extras); mOverlayIcon = extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class); mLargeIconSubText = extras.getCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT); } /** * @hide */ @Override public void purgeResources() { super.purgeResources(); if (mOverlayIcon != null) { mOverlayIcon.convertToAshmem(); } } /** * @hide */ @Override public void reduceImageSizes(Context context) { super.reduceImageSizes(context); if (mOverlayIcon != null) { final Resources resources = context.getResources(); final boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); int rightIconSize = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); mOverlayIcon.scaleDownIfNecessary(rightIconSize, rightIconSize); } } } /** * A Notification Style used to to define a notification whose expanded state includes * a highly customizable progress bar with segments, steps, a custom tracker icon, Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RichOngoingNotificationContentExtractor.kt +8 −8 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface RichOngoingNotificationContentExtractor { entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? } Loading @@ -52,7 +52,7 @@ class NoOpRichOngoingNotificationContentExtractor : RichOngoingNotificationConte entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? = null } Loading @@ -68,7 +68,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? { val sbn = entry.sbn val notification = sbn.notification Loading @@ -89,7 +89,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : null } } } else if (builder.style is Notification.EnRouteStyle) { } else if (builder.style is Notification.ProgressStyle) { parseEnRouteNotification(notification, icon) } else null } catch (e: Exception) { Loading @@ -104,7 +104,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : */ private fun parseTimerNotification( notification: Notification, icon: IconModel icon: IconModel, ): TimerContentModel { // sortKey=1 0|↺7|RUNNING|▶16:21:58.523|Σ0:05:00|Δ0:00:03|⏳0:04:57 // sortKey=1 0|↺7|PAUSED|Σ0:05:00|Δ0:04:54|⏳0:00:06 Loading Loading @@ -132,7 +132,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : resumeIntent = notification.findStartIntent(), addMinuteAction = notification.findAddMinuteAction(), resetAction = notification.findResetAction(), ) ), ) } "RUNNING" -> { Loading @@ -149,7 +149,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : pauseIntent = notification.findPauseIntent(), addMinuteAction = notification.findAddMinuteAction(), resetAction = notification.findResetAction(), ) ), ) } else -> error("unknown state ($state) in sortKey=$sortKey") Loading Loading @@ -192,7 +192,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : val localDateTime = LocalDateTime.of( LocalDate.now(), LocalTime.of(hour.toInt(), minute.toInt(), second.toInt(), millis.toInt() * 1000000) LocalTime.of(hour.toInt(), minute.toInt(), second.toInt(), millis.toInt() * 1000000), ) val offset = ZoneId.systemDefault().rules.getOffset(localDateTime) return localDateTime.toInstant(offset).toEpochMilli() Loading Loading
core/java/android/app/Notification.java +0 −156 Original line number Diff line number Diff line Loading @@ -1618,22 +1618,6 @@ public class Notification implements Parcelable */ public static final String EXTRA_DECLINE_COLOR = "android.declineColor"; /** * {@link #extras} key: {@link Icon} of an image used as an overlay Icon on * {@link Notification#mLargeIcon} for {@link EnRouteStyle} notifications. * This extra is an {@code Icon}. * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static final String EXTRA_ENROUTE_OVERLAY_ICON = "android.enrouteOverlayIcon"; /** * {@link #extras} key: text used as a sub-text for the largeIcon of * {@link EnRouteStyle} notification. This extra is a {@code CharSequence}. * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static final String EXTRA_ENROUTE_LARGE_ICON_SUBTEXT = "android.enrouteLargeIconSubText"; /** * {@link #extras} key: whether the notification should be colorized as * supplied to {@link Builder#setColorized(boolean)}. Loading Loading @@ -3152,7 +3136,6 @@ public class Notification implements Parcelable } if (Flags.apiRichOngoing()) { visitIconUri(visitor, extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_TRACKER_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_START_ICON, Icon.class)); visitIconUri(visitor, extras.getParcelable(EXTRA_PROGRESS_END_ICON, Icon.class)); Loading Loading @@ -11172,145 +11155,6 @@ public class Notification implements Parcelable } } /** * TODO(b/360827871): Make EnRouteStyle public. * A style used to represent the progress of a real-world journey with a known destination. * For example: * <ul> * <li>Delivery tracking</li> * <li>Ride progress</li> * <li>Flight tracking</li> * </ul> * * The exact fields from {@link Notification} that are shown with this style may vary by * the surface where this update appears, but the following fields are recommended: * <ul> * <li>{@link Notification.Builder#setContentTitle}</li> * <li>{@link Notification.Builder#setContentText}</li> * <li>{@link Notification.Builder#setSubText}</li> * <li>{@link Notification.Builder#setLargeIcon}</li> * <li>{@link Notification.Builder#setProgress}</li> * <li>{@link Notification.Builder#setWhen} - This should be the future time of the next, * final, or most important stop on this journey.</li> * </ul> * @hide */ @FlaggedApi(Flags.FLAG_API_RICH_ONGOING) public static class EnRouteStyle extends Notification.Style { @Nullable private Icon mOverlayIcon = null; @Nullable private CharSequence mLargeIconSubText = null; public EnRouteStyle() { } /** * Returns the overlay icon to be displayed on {@link Notification#mLargeIcon}. * @see EnRouteStyle#setOverlayIcon */ @Nullable public Icon getOverlayIcon() { return mOverlayIcon; } /** * Optional icon to be displayed on {@link Notification#mLargeIcon}. * * This image will be cropped to a circle and will obscure * a semicircle of the right side of the large icon. */ @NonNull public EnRouteStyle setOverlayIcon(@Nullable Icon overlayIcon) { mOverlayIcon = overlayIcon; return this; } /** * Returns the sub-text for {@link Notification#mLargeIcon}. * @see EnRouteStyle#setLargeIconSubText */ @Nullable public CharSequence getLargeIconSubText() { return mLargeIconSubText; } /** * Optional text which generally related to * the {@link Notification.Builder#setLargeIcon} or {@link #setOverlayIcon} or both. */ @NonNull public EnRouteStyle setLargeIconSubText(@Nullable CharSequence largeIconSubText) { mLargeIconSubText = stripStyling(largeIconSubText); return this; } /** * @hide */ @Override public boolean areNotificationsVisiblyDifferent(Style other) { if (other == null || getClass() != other.getClass()) { return true; } final EnRouteStyle enRouteStyle = (EnRouteStyle) other; return !Objects.equals(mOverlayIcon, enRouteStyle.mOverlayIcon) || !Objects.equals(mLargeIconSubText, enRouteStyle.mLargeIconSubText); } /** * @hide */ @Override public void addExtras(Bundle extras) { super.addExtras(extras); extras.putParcelable(EXTRA_ENROUTE_OVERLAY_ICON, mOverlayIcon); extras.putCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT, mLargeIconSubText); } /** * @hide */ @Override protected void restoreFromExtras(Bundle extras) { super.restoreFromExtras(extras); mOverlayIcon = extras.getParcelable(EXTRA_ENROUTE_OVERLAY_ICON, Icon.class); mLargeIconSubText = extras.getCharSequence(EXTRA_ENROUTE_LARGE_ICON_SUBTEXT); } /** * @hide */ @Override public void purgeResources() { super.purgeResources(); if (mOverlayIcon != null) { mOverlayIcon.convertToAshmem(); } } /** * @hide */ @Override public void reduceImageSizes(Context context) { super.reduceImageSizes(context); if (mOverlayIcon != null) { final Resources resources = context.getResources(); final boolean isLowRam = ActivityManager.isLowRamDeviceStatic(); int rightIconSize = resources.getDimensionPixelSize(isLowRam ? R.dimen.notification_right_icon_size_low_ram : R.dimen.notification_right_icon_size); mOverlayIcon.scaleDownIfNecessary(rightIconSize, rightIconSize); } } } /** * A Notification Style used to to define a notification whose expanded state includes * a highly customizable progress bar with segments, steps, a custom tracker icon, Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RichOngoingNotificationContentExtractor.kt +8 −8 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ interface RichOngoingNotificationContentExtractor { entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? } Loading @@ -52,7 +52,7 @@ class NoOpRichOngoingNotificationContentExtractor : RichOngoingNotificationConte entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? = null } Loading @@ -68,7 +68,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : entry: NotificationEntry, builder: Notification.Builder, systemUIContext: Context, packageContext: Context packageContext: Context, ): RichOngoingContentModel? { val sbn = entry.sbn val notification = sbn.notification Loading @@ -89,7 +89,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : null } } } else if (builder.style is Notification.EnRouteStyle) { } else if (builder.style is Notification.ProgressStyle) { parseEnRouteNotification(notification, icon) } else null } catch (e: Exception) { Loading @@ -104,7 +104,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : */ private fun parseTimerNotification( notification: Notification, icon: IconModel icon: IconModel, ): TimerContentModel { // sortKey=1 0|↺7|RUNNING|▶16:21:58.523|Σ0:05:00|Δ0:00:03|⏳0:04:57 // sortKey=1 0|↺7|PAUSED|Σ0:05:00|Δ0:04:54|⏳0:00:06 Loading Loading @@ -132,7 +132,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : resumeIntent = notification.findStartIntent(), addMinuteAction = notification.findAddMinuteAction(), resetAction = notification.findResetAction(), ) ), ) } "RUNNING" -> { Loading @@ -149,7 +149,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : pauseIntent = notification.findPauseIntent(), addMinuteAction = notification.findAddMinuteAction(), resetAction = notification.findResetAction(), ) ), ) } else -> error("unknown state ($state) in sortKey=$sortKey") Loading Loading @@ -192,7 +192,7 @@ class RichOngoingNotificationContentExtractorImpl @Inject constructor() : val localDateTime = LocalDateTime.of( LocalDate.now(), LocalTime.of(hour.toInt(), minute.toInt(), second.toInt(), millis.toInt() * 1000000) LocalTime.of(hour.toInt(), minute.toInt(), second.toInt(), millis.toInt() * 1000000), ) val offset = ZoneId.systemDefault().rules.getOffset(localDateTime) return localDateTime.toInstant(offset).toEpochMilli() Loading