Merge "Unhide notification category."
diff --git a/api/current.txt b/api/current.txt
index 09102fb..a3d39c8 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -4202,6 +4202,19 @@
method public int describeContents();
method public deprecated void setLatestEventInfo(android.content.Context, java.lang.CharSequence, java.lang.CharSequence, android.app.PendingIntent);
method public void writeToParcel(android.os.Parcel, int);
+ field public static final java.lang.String CATEGORY_ALARM = "alarm";
+ field public static final java.lang.String CATEGORY_CALL = "call";
+ field public static final java.lang.String CATEGORY_EMAIL = "email";
+ field public static final java.lang.String CATEGORY_ERROR = "err";
+ field public static final java.lang.String CATEGORY_EVENT = "event";
+ field public static final java.lang.String CATEGORY_MESSAGE = "msg";
+ field public static final java.lang.String CATEGORY_PROGRESS = "progress";
+ field public static final java.lang.String CATEGORY_PROMO = "promo";
+ field public static final java.lang.String CATEGORY_SERVICE = "service";
+ field public static final java.lang.String CATEGORY_SOCIAL = "social";
+ field public static final java.lang.String CATEGORY_STATUS = "status";
+ field public static final java.lang.String CATEGORY_SYSTEM = "sys";
+ field public static final java.lang.String CATEGORY_TRANSPORT = "transport";
field public static final android.os.Parcelable.Creator CREATOR;
field public static final int DEFAULT_ALL = -1; // 0xffffffff
field public static final int DEFAULT_LIGHTS = 4; // 0x4
@@ -4246,6 +4259,7 @@
field public android.app.Notification.Action[] actions;
field public int audioStreamType;
field public android.widget.RemoteViews bigContentView;
+ field public java.lang.String category;
field public android.app.PendingIntent contentIntent;
field public android.widget.RemoteViews contentView;
field public int defaults;
@@ -4306,6 +4320,7 @@
method public android.os.Bundle getExtras();
method public deprecated android.app.Notification getNotification();
method public android.app.Notification.Builder setAutoCancel(boolean);
+ method public android.app.Notification.Builder setCategory(java.lang.String);
method public android.app.Notification.Builder setContent(android.widget.RemoteViews);
method public android.app.Notification.Builder setContentInfo(java.lang.CharSequence);
method public android.app.Notification.Builder setContentIntent(android.app.PendingIntent);
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 12a8ff6..2e8fbb6 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -444,41 +444,75 @@
public static final int VISIBILITY_SECRET = -1;
/**
- * @hide
- * Notification type: incoming call (voice or video) or similar synchronous communication request.
+ * Notification category: incoming call (voice or video) or similar synchronous communication request.
*/
- public static final String KIND_CALL = "android.call";
+ public static final String CATEGORY_CALL = "call";
/**
- * @hide
- * Notification type: incoming direct message (SMS, instant message, etc.).
+ * Notification category: incoming direct message (SMS, instant message, etc.).
*/
- public static final String KIND_MESSAGE = "android.message";
+ public static final String CATEGORY_MESSAGE = "msg";
/**
- * @hide
- * Notification type: asynchronous bulk message (email).
+ * Notification category: asynchronous bulk message (email).
*/
- public static final String KIND_EMAIL = "android.email";
+ public static final String CATEGORY_EMAIL = "email";
/**
- * @hide
- * Notification type: calendar event.
+ * Notification category: calendar event.
*/
- public static final String KIND_EVENT = "android.event";
+ public static final String CATEGORY_EVENT = "event";
/**
- * @hide
- * Notification type: promotion or advertisement.
+ * Notification category: promotion or advertisement.
*/
- public static final String KIND_PROMO = "android.promo";
+ public static final String CATEGORY_PROMO = "promo";
/**
- * @hide
- * If this notification matches of one or more special types (see the <code>KIND_*</code>
- * constants), add them here, best match first.
+ * Notification category: alarm or timer.
*/
- public String[] kind;
+ public static final String CATEGORY_ALARM = "alarm";
+
+ /**
+ * Notification category: progress of a long-running background operation.
+ */
+ public static final String CATEGORY_PROGRESS = "progress";
+
+ /**
+ * Notification category: social network or sharing update.
+ */
+ public static final String CATEGORY_SOCIAL = "social";
+
+ /**
+ * Notification category: error in background operation or authentication status.
+ */
+ public static final String CATEGORY_ERROR = "err";
+
+ /**
+ * Notification category: media transport control for playback.
+ */
+ public static final String CATEGORY_TRANSPORT = "transport";
+
+ /**
+ * Notification category: system or device status update. Reserved for system use.
+ */
+ public static final String CATEGORY_SYSTEM = "sys";
+
+ /**
+ * Notification category: indication of running background service.
+ */
+ public static final String CATEGORY_SERVICE = "service";
+
+ /**
+ * Notification category: ongoing information about device or contextual status.
+ */
+ public static final String CATEGORY_STATUS = "status";
+
+ /**
+ * One of the predefined notification categories (see the <code>CATEGORY_*</code> constants)
+ * that best describes this Notification. May be used by the system for ranking and filtering.
+ */
+ public String category;
/**
* Additional semantic data to be carried around with this Notification.
@@ -619,6 +653,13 @@
public static final String EXTRA_BUILDER_REMOTE_VIEWS = "android.builderRemoteViews";
/**
+ * Allow certain system-generated notifications to appear before the device is provisioned.
+ * Only available to notifications coming from the android package.
+ * @hide
+ */
+ public static final String EXTRA_ALLOW_DURING_SETUP = "android.allowDuringSetup";
+
+ /**
* Value for {@link #EXTRA_AS_HEADS_UP}.
* @hide
*/
@@ -815,7 +856,7 @@
priority = parcel.readInt();
- kind = parcel.createStringArray(); // may set kind to null
+ category = parcel.readString();
extras = parcel.readBundle(); // may be null
@@ -890,12 +931,7 @@
that.priority = this.priority;
- final String[] thiskind = this.kind;
- if (thiskind != null) {
- final int N = thiskind.length;
- final String[] thatkind = that.kind = new String[N];
- System.arraycopy(thiskind, 0, thatkind, 0, N);
- }
+ that.category = this.category;
if (this.extras != null) {
try {
@@ -1044,7 +1080,7 @@
parcel.writeInt(priority);
- parcel.writeStringArray(kind); // ok for null
+ parcel.writeString(category);
parcel.writeBundle(extras); // null ok
@@ -1180,16 +1216,7 @@
sb.append(Integer.toHexString(this.defaults));
sb.append(" flags=0x");
sb.append(Integer.toHexString(this.flags));
- sb.append(" kind=[");
- if (this.kind == null) {
- sb.append("null");
- } else {
- for (int i=0; i<this.kind.length; i++) {
- if (i>0) sb.append(",");
- sb.append(this.kind[i]);
- }
- }
- sb.append("]");
+ sb.append(" category="); sb.append(this.category);
if (actions != null) {
sb.append(" ");
sb.append(actions.length);
@@ -1271,7 +1298,7 @@
private int mProgressMax;
private int mProgress;
private boolean mProgressIndeterminate;
- private ArrayList<String> mKindList = new ArrayList<String>(1);
+ private String mCategory;
private Bundle mExtras;
private int mPriority;
private ArrayList<Action> mActions = new ArrayList<Action>(MAX_ACTION_BUTTONS);
@@ -1679,14 +1706,12 @@
}
/**
- * @hide
+ * Set the notification category.
*
- * Add a kind (category) to this notification. Optional.
- *
- * @see Notification#kind
+ * @see Notification#category
*/
- public Builder addKind(String k) {
- mKindList.add(k);
+ public Builder setCategory(String category) {
+ mCategory = category;
return this;
}
@@ -2010,12 +2035,7 @@
if ((mDefaults & DEFAULT_LIGHTS) != 0) {
n.flags |= FLAG_SHOW_LIGHTS;
}
- if (mKindList.size() > 0) {
- n.kind = new String[mKindList.size()];
- mKindList.toArray(n.kind);
- } else {
- n.kind = null;
- }
+ n.category = mCategory;
n.priority = mPriority;
if (mActions.size() > 0) {
n.actions = new Action[mActions.size()];
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index bd36128..6eb2ebe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1521,17 +1521,8 @@
// A: Almost none! Only things coming from the system (package is "android") that also
// have special "kind" tags marking them as relevant for setup (see below).
protected boolean showNotificationEvenIfUnprovisioned(StatusBarNotification sbn) {
- if ("android".equals(sbn.getPackageName())) {
- if (sbn.getNotification().kind != null) {
- for (String aKind : sbn.getNotification().kind) {
- // IME switcher, created by InputMethodManagerService
- if ("android.system.imeswitcher".equals(aKind)) return true;
- // OTA availability & errors, created by SystemUpdateService
- if ("android.system.update".equals(aKind)) return true;
- }
- }
- }
- return false;
+ return "android".equals(sbn.getPackageName())
+ && sbn.getNotification().extras.getBoolean(Notification.EXTRA_ALLOW_DURING_SETUP);
}
public boolean inKeyguardRestrictedInputMode() {
diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java
index af8a6e7..31822e7 100644
--- a/services/core/java/com/android/server/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/InputMethodManagerService.java
@@ -637,7 +637,8 @@
mImeSwitcherNotification.vibrate = null;
// Tag this notification specially so SystemUI knows it's important
- mImeSwitcherNotification.kind = new String[] { "android.system.imeswitcher" };
+ mImeSwitcherNotification.extras.putBoolean(Notification.EXTRA_ALLOW_DURING_SETUP, true);
+ mImeSwitcherNotification.category = Notification.CATEGORY_SYSTEM;
Intent intent = new Intent(Settings.ACTION_SHOW_INPUT_METHOD_PICKER);
mImeSwitchPendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);