Notification cleanup
- remove EXTRA_ORIGINATING_USER_ID
- deprecate two icon extra fields; use the getters instead
- rename badge icon methods
- update some unclear documentation
Test: make, cts
Fixes: 33666468
Fixes: 36128288
Change-Id: Ic477259aab5f267fb72ab715d72195d6364cedae
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 8d76930..c78b3cd 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -880,14 +880,20 @@
/**
* {@link #extras} key: this is the resource ID of the notification's main small icon, as
* supplied to {@link Builder#setSmallIcon(int)}.
+ *
+ * @deprecated Use {@link #getSmallIcon()}, which supports a wider variety of icon sources.
*/
+ @Deprecated
public static final String EXTRA_SMALL_ICON = "android.icon";
/**
* {@link #extras} key: this is a bitmap to be used instead of the small icon when showing the
* notification payload, as
* supplied to {@link Builder#setLargeIcon(android.graphics.Bitmap)}.
+ *
+ * @deprecated Use {@link #getLargeIcon()}, which supports a wider variety of icon sources.
*/
+ @Deprecated
public static final String EXTRA_LARGE_ICON = "android.largeIcon";
/**
@@ -1029,13 +1035,6 @@
public static final String EXTRA_COLORIZED = "android.colorized";
/**
- * {@link #extras} key: the user that built the notification.
- *
- * @hide
- */
- public static final String EXTRA_ORIGINATING_USERID = "android.originatingUserId";
-
- /**
* @hide
*/
public static final String EXTRA_BUILDER_APPLICATION_INFO = "android.appInfo";
@@ -2298,16 +2297,14 @@
* @hide
*/
public static void addFieldsFromContext(Context context, Notification notification) {
- addFieldsFromContext(context.getApplicationInfo(), context.getUserId(), notification);
+ addFieldsFromContext(context.getApplicationInfo(), notification);
}
/**
* @hide
*/
- public static void addFieldsFromContext(ApplicationInfo ai, int userId,
- Notification notification) {
+ public static void addFieldsFromContext(ApplicationInfo ai, Notification notification) {
notification.extras.putParcelable(EXTRA_BUILDER_APPLICATION_INFO, ai);
- notification.extras.putInt(EXTRA_ORIGINATING_USERID, userId);
}
@Override
@@ -2434,15 +2431,26 @@
}
/**
+ * @removed
* Returns what icon should be shown for this notification if it is being displayed in a
* Launcher that supports badging. Will be one of {@link #BADGE_ICON_NONE},
* {@link #BADGE_ICON_SMALL}, or {@link #BADGE_ICON_LARGE}.
*/
+ @Deprecated
public int getBadgeIcon() {
return mBadgeIcon;
}
/**
+ * Returns what icon should be shown for this notification if it is being displayed in a
+ * Launcher that supports badging. Will be one of {@link #BADGE_ICON_NONE},
+ * {@link #BADGE_ICON_SMALL}, or {@link #BADGE_ICON_LARGE}.
+ */
+ public int getBadgeIconType() {
+ return mBadgeIcon;
+ }
+
+ /**
* Returns the {@link ShortcutInfo#getId() id} that this notification supersedes, if any.
*/
public String getShortcutId() {
@@ -2684,6 +2692,7 @@
}
/**
+ * @removed
* Sets which icon to display as a badge for this notification.
*
* Must be one of {@link #BADGE_ICON_NONE}, {@link #BADGE_ICON_SMALL},
@@ -2691,12 +2700,26 @@
*
* Note: This value might be ignored, for launchers that don't support badge icons.
*/
+ @Deprecated
public Builder chooseBadgeIcon(int icon) {
mN.mBadgeIcon = icon;
return this;
}
/**
+ * Sets which icon to display as a badge for this notification.
+ *
+ * Must be one of {@link #BADGE_ICON_NONE}, {@link #BADGE_ICON_SMALL},
+ * {@link #BADGE_ICON_LARGE}.
+ *
+ * Note: This value might be ignored, for launchers that don't support badge icons.
+ */
+ public Builder chooseBadgeIconType(int icon) {
+ mN.mBadgeIcon = icon;
+ return this;
+ }
+
+ /**
* Specifies the channel the notification should be delivered on.
*/
public Builder setChannel(String channelId) {
@@ -3272,7 +3295,9 @@
*
* <P>
* Depending on user preferences, this annotation may allow the notification to pass
- * through interruption filters, and to appear more prominently in the user interface.
+ * through interruption filters, if this notification is of category {@link #CATEGORY_CALL}
+ * or {@link #CATEGORY_MESSAGE}. The addition of people may also cause this notification to
+ * appear more prominently in the user interface.
* </P>
*
* <P>