Merge "deprecate L_8, LA_88 and RGB_332 in sdk"
diff --git a/api/current.txt b/api/current.txt
index 44a97cd..e0dad49 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -3631,12 +3631,22 @@
field public static final int DEFAULT_VIBRATE = 2; // 0x2
field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
- field public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
+ field public static final deprecated int FLAG_HIGH_PRIORITY = 128; // 0x80
field public static final int FLAG_INSISTENT = 4; // 0x4
field public static final int FLAG_NO_CLEAR = 32; // 0x20
field public static final int FLAG_ONGOING_EVENT = 2; // 0x2
field public static final int FLAG_ONLY_ALERT_ONCE = 8; // 0x8
field public static final int FLAG_SHOW_LIGHTS = 1; // 0x1
+ field public static final java.lang.String KIND_CALL = "android.call";
+ field public static final java.lang.String KIND_EMAIL = "android.email";
+ field public static final java.lang.String KIND_EVENT = "android.event";
+ field public static final java.lang.String KIND_MESSAGE = "android.message";
+ field public static final java.lang.String KIND_PROMO = "android.promo";
+ field public static final int PRIORITY_DEFAULT = 0; // 0x0
+ field public static final int PRIORITY_HIGH = 1; // 0x1
+ field public static final int PRIORITY_LOW = -1; // 0xffffffff
+ field public static final int PRIORITY_MAX = 2; // 0x2
+ field public static final int PRIORITY_MIN = -2; // 0xfffffffe
field public static final int STREAM_DEFAULT = -1; // 0xffffffff
field public int audioStreamType;
field public android.app.PendingIntent contentIntent;
@@ -3647,11 +3657,13 @@
field public android.app.PendingIntent fullScreenIntent;
field public int icon;
field public int iconLevel;
+ field public java.lang.String[] kind;
field public android.graphics.Bitmap largeIcon;
field public int ledARGB;
field public int ledOffMS;
field public int ledOnMS;
field public int number;
+ field public int priority;
field public android.net.Uri sound;
field public java.lang.CharSequence tickerText;
field public android.widget.RemoteViews tickerView;
@@ -3661,6 +3673,7 @@
public static class Notification.Builder {
ctor public Notification.Builder(android.content.Context);
+ method public android.app.Notification.Builder addKind(java.lang.String);
method public android.app.Notification getNotification();
method public android.app.Notification.Builder setAutoCancel(boolean);
method public android.app.Notification.Builder setContent(android.widget.RemoteViews);
@@ -3676,6 +3689,7 @@
method public android.app.Notification.Builder setNumber(int);
method public android.app.Notification.Builder setOngoing(boolean);
method public android.app.Notification.Builder setOnlyAlertOnce(boolean);
+ method public android.app.Notification.Builder setPriority(int);
method public android.app.Notification.Builder setProgress(int, int, boolean);
method public android.app.Notification.Builder setSmallIcon(int);
method public android.app.Notification.Builder setSmallIcon(int, int);
diff --git a/cmds/stagefright/codec.cpp b/cmds/stagefright/codec.cpp
index ad246d2..1b01bd6 100644
--- a/cmds/stagefright/codec.cpp
+++ b/cmds/stagefright/codec.cpp
@@ -107,9 +107,8 @@
CHECK_EQ(err, (status_t)OK);
size_t j = 0;
- sp<RefBase> obj;
- while (format->findObject(StringPrintf("csd-%d", j).c_str(), &obj)) {
- sp<ABuffer> buffer = static_cast<ABuffer *>(obj.get());
+ sp<ABuffer> buffer;
+ while (format->findBuffer(StringPrintf("csd-%d", j).c_str(), &buffer)) {
state->mCSD.push_back(buffer);
++j;
diff --git a/cmds/stagefright/sf2.cpp b/cmds/stagefright/sf2.cpp
index 18e2532..6f0fb54 100644
--- a/cmds/stagefright/sf2.cpp
+++ b/cmds/stagefright/sf2.cpp
@@ -358,7 +358,7 @@
buffer->meta()->setInt32("csd", true);
mCSD.push(buffer);
- msg->setObject("csd", buffer);
+ msg->setBuffer("csd", buffer);
} else if (meta->findData(kKeyESDS, &type, &data, &size)) {
ESDS esds((const char *)data, size);
CHECK_EQ(esds.InitCheck(), (status_t)OK);
@@ -408,9 +408,8 @@
return;
}
- sp<RefBase> obj;
- CHECK(msg->findObject("buffer", &obj));
- sp<ABuffer> outBuffer = static_cast<ABuffer *>(obj.get());
+ sp<ABuffer> outBuffer;
+ CHECK(msg->findBuffer("buffer", &outBuffer));
if (mCSDIndex < mCSD.size()) {
outBuffer = mCSD.editItemAt(mCSDIndex++);
@@ -509,15 +508,14 @@
}
}
- reply->setObject("buffer", outBuffer);
+ reply->setBuffer("buffer", outBuffer);
reply->post();
}
void onDrainThisBuffer(const sp<AMessage> &msg) {
- sp<RefBase> obj;
- CHECK(msg->findObject("buffer", &obj));
+ sp<ABuffer> buffer;
+ CHECK(msg->findBuffer("buffer", &buffer));
- sp<ABuffer> buffer = static_cast<ABuffer *>(obj.get());
mTotalBytesReceived += buffer->size();
sp<AMessage> reply;
diff --git a/core/java/android/accessibilityservice/UiTestAutomationBridge.java b/core/java/android/accessibilityservice/UiTestAutomationBridge.java
index 9b3da53..a898c3f 100644
--- a/core/java/android/accessibilityservice/UiTestAutomationBridge.java
+++ b/core/java/android/accessibilityservice/UiTestAutomationBridge.java
@@ -74,6 +74,8 @@
private volatile boolean mUnprocessedEventAvailable;
+ private HandlerThread mHandlerThread;
+
/**
* Gets the last received {@link AccessibilityEvent}.
*
@@ -126,9 +128,10 @@
// is needed for making sure the binder calls are interleaved
// with check for the expected event and also to make sure the
// binder threads are allowed to proceed in the received order.
- HandlerThread handlerThread = new HandlerThread("UiTestAutomationBridge");
- handlerThread.start();
- Looper looper = handlerThread.getLooper();
+ mHandlerThread = new HandlerThread("UiTestAutomationBridge");
+ mHandlerThread.setDaemon(true);
+ mHandlerThread.start();
+ Looper looper = mHandlerThread.getLooper();
mListener = new IEventListenerWrapper(null, looper, new Callbacks() {
@Override
@@ -217,6 +220,8 @@
throw new IllegalStateException("Already disconnected.");
}
+ mHandlerThread.quit();
+
IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(
ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
diff --git a/core/java/android/app/INotificationManager.aidl b/core/java/android/app/INotificationManager.aidl
index 2420b84..4d5238c 100644
--- a/core/java/android/app/INotificationManager.aidl
+++ b/core/java/android/app/INotificationManager.aidl
@@ -33,7 +33,6 @@
void enqueueToast(String pkg, ITransientNotification callback, int duration);
void cancelToast(String pkg, ITransientNotification callback);
void enqueueNotificationWithTag(String pkg, String tag, int id, in Notification notification, inout int[] idReceived);
- void enqueueNotificationWithTagPriority(String pkg, String tag, int id, int priority, in Notification notification, inout int[] idReceived);
void cancelNotificationWithTag(String pkg, String tag, int id);
}
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index d569e20..5325af0 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -22,6 +22,7 @@
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
@@ -30,6 +31,7 @@
import android.widget.RemoteViews;
import java.text.NumberFormat;
+import java.util.ArrayList;
/**
* A class that represents how a persistent notification is to be presented to
@@ -51,36 +53,58 @@
* Use all default values (where applicable).
*/
public static final int DEFAULT_ALL = ~0;
-
+
/**
* Use the default notification sound. This will ignore any given
* {@link #sound}.
- *
+ *
+
* @see #defaults
- */
+ */
+
public static final int DEFAULT_SOUND = 1;
/**
* Use the default notification vibrate. This will ignore any given
- * {@link #vibrate}. Using phone vibration requires the
+ * {@link #vibrate}. Using phone vibration requires the
* {@link android.Manifest.permission#VIBRATE VIBRATE} permission.
- *
+ *
* @see #defaults
- */
+ */
+
public static final int DEFAULT_VIBRATE = 2;
-
+
/**
* Use the default notification lights. This will ignore the
* {@link #FLAG_SHOW_LIGHTS} bit, and {@link #ledARGB}, {@link #ledOffMS}, or
* {@link #ledOnMS}.
- *
+ *
* @see #defaults
- */
+ */
+
public static final int DEFAULT_LIGHTS = 4;
-
+
/**
- * The timestamp for the notification. The icons and expanded views
- * are sorted by this key.
+ * A timestamp related to this notification, in milliseconds since the epoch.
+ *
+ * Default value: {@link System#currentTimeMillis() Now}.
+ *
+ * Choose a timestamp that will be most relevant to the user. For most finite events, this
+ * corresponds to the time the event happened (or will happen, in the case of events that have
+ * yet to occur but about which the user is being informed). Indefinite events should be
+ * timestamped according to when the activity began.
+ *
+ * Some examples:
+ *
+ * <ul>
+ * <li>Notification of a new chat message should be stamped when the message was received.</li>
+ * <li>Notification of an ongoing file download (with a progress bar, for example) should be stamped when the download started.</li>
+ * <li>Notification of a completed file download should be stamped when the download finished.</li>
+ * <li>Notification of an upcoming meeting should be stamped with the time the meeting will begin (that is, in the future).</li>
+ * <li>Notification of an ongoing stopwatch (increasing timer) should be stamped with the watch's start time.
+ * <li>Notification of an ongoing countdown timer should be stamped with the timer's end time.
+ * </ul>
+ *
*/
public long when;
@@ -100,10 +124,16 @@
public int iconLevel;
/**
- * The number of events that this notification represents. For example, in a new mail
- * notification, this could be the number of unread messages. This number is superimposed over
- * the icon in the status bar. If the number is 0 or negative, it is not shown in the status
- * bar.
+ * The number of events that this notification represents. For example, in a new mail
+ * notification, this could be the number of unread messages.
+ *
+ * The system may or may not use this field to modify the appearance of the notification. For
+ * example, before {@link android.os.Build.VERSION_CODES#HONEYCOMB}, this number was
+ * superimposed over the icon in the status bar. Starting with
+ * {@link android.os.Build.VERSION_CODES#HONEYCOMB}, the template used by
+ * {@link Notification.Builder} has displayed the number in the expanded notification view.
+ *
+ * If the number is 0 or negative, it is never shown.
*/
public int number;
@@ -121,10 +151,11 @@
public PendingIntent contentIntent;
/**
- * The intent to execute when the status entry is deleted by the user
- * with the "Clear All Notifications" button. This probably shouldn't
- * be launching an activity since several of those will be sent at the
- * same time.
+ * The intent to execute when the notification is explicitly dismissed by the user, either with
+ * the "Clear All" button or by swiping it away individually.
+ *
+ * This probably shouldn't be launching an activity since several of those will be sent
+ * at the same time.
*/
public PendingIntent deleteIntent;
@@ -139,11 +170,6 @@
* Text to scroll across the screen when this item is added to
* the status bar on large and smaller devices.
*
- * <p>This field is provided separately from the other ticker fields
- * both for compatibility and to allow an application to choose different
- * text for when the text scrolls in and when it is displayed all at once
- * in conjunction with one or more icons.
- *
* @see #tickerView
*/
public CharSequence tickerText;
@@ -166,9 +192,9 @@
/**
* The sound to play.
- *
+ *
* <p>
- * To play the default notification sound, see {@link #defaults}.
+ * To play the default notification sound, see {@link #defaults}.
* </p>
*/
public Uri sound;
@@ -187,14 +213,13 @@
*/
public int audioStreamType = STREAM_DEFAULT;
-
/**
- * The pattern with which to vibrate.
- *
+ * The pattern with which to vibrate.
+ *
* <p>
* To vibrate the default pattern, see {@link #defaults}.
* </p>
- *
+ *
* @see android.os.Vibrator#vibrate(long[],int)
*/
public long[] vibrate;
@@ -235,7 +260,6 @@
*/
public int defaults;
-
/**
* Bit to be bitwise-ored into the {@link #flags} field that should be
* set if you want the LED on for this notification.
@@ -252,7 +276,7 @@
* because they will be set to values that work on any given hardware.
* <p>
* The alpha channel must be set for forward compatibility.
- *
+ *
*/
public static final int FLAG_SHOW_LIGHTS = 0x00000001;
@@ -282,7 +306,8 @@
/**
* Bit to be bitwise-ored into the {@link #flags} field that should be
* set if the notification should be canceled when it is clicked by the
- * user. On tablets, the
+ * user. On tablets, the
+
*/
public static final int FLAG_AUTO_CANCEL = 0x00000010;
@@ -301,22 +326,105 @@
public static final int FLAG_FOREGROUND_SERVICE = 0x00000040;
/**
- * Bit to be bitwise-ored into the {@link #flags} field that should be set if this notification
- * represents a high-priority event that may be shown to the user even if notifications are
- * otherwise unavailable (that is, when the status bar is hidden). This flag is ideally used
- * in conjunction with {@link #fullScreenIntent}.
+ * Obsolete flag indicating high-priority notifications; use the priority field instead.
+ *
+ * @deprecated Use {@link #priority} with a positive value.
*/
- public static final int FLAG_HIGH_PRIORITY = 0x00000080;
+ public static final int FLAG_HIGH_PRIORITY = 0x00000080;
public int flags;
/**
- * Constructs a Notification object with everything set to 0.
+ * Default notification {@link #priority}. If your application does not prioritize its own
+ * notifications, use this value for all notifications.
+ */
+ public static final int PRIORITY_DEFAULT = 0;
+
+ /**
+ * Lower {@link #priority}, for items that are less important. The UI may choose to show these
+ * items smaller, or at a different position in the list, compared with your app's
+ * {@link #PRIORITY_DEFAULT} items.
+ */
+ public static final int PRIORITY_LOW = -1;
+
+ /**
+ * Lowest {@link #priority}; these items might not be shown to the user except under special
+ * circumstances, such as detailed notification logs.
+ */
+ public static final int PRIORITY_MIN = -2;
+
+ /**
+ * Higher {@link #priority}, for more important notifications or alerts. The UI may choose to
+ * show these items larger, or at a different position in notification lists, compared with
+ * your app's {@link #PRIORITY_DEFAULT} items.
+ */
+ public static final int PRIORITY_HIGH = 1;
+
+ /**
+ * Highest {@link #priority}, for your application's most important items that require the
+ * user's prompt attention or input.
+ */
+ public static final int PRIORITY_MAX = 2;
+
+ /**
+ * Relative priority for this notification.
+ *
+ * Priority is an indication of how much of the user's valuable attention should be consumed by
+ * this notification. Low-priority notifications may be hidden from the user in certain
+ * situations, while the user might be interrupted for a higher-priority notification. The
+ * system will make a determination about how to interpret notification priority as described in
+ * MUMBLE MUMBLE.
+ */
+ public int priority;
+
+ /**
+ * Notification type: incoming call (voice or video) or similar synchronous communication request.
+ */
+ public static final String KIND_CALL = "android.call";
+
+ /**
+ * Notification type: incoming direct message (SMS, instant message, etc.).
+ */
+ public static final String KIND_MESSAGE = "android.message";
+
+ /**
+ * Notification type: asynchronous bulk message (email).
+ */
+ public static final String KIND_EMAIL = "android.email";
+
+ /**
+ * Notification type: calendar event.
+ */
+ public static final String KIND_EVENT = "android.event";
+
+ /**
+ * Notification type: promotion or advertisement.
+ */
+ public static final String KIND_PROMO = "android.promo";
+
+ /**
+ * If this notification matches of one or more special types (see the <code>KIND_*</code>
+ * constants), add them here, best match first.
+ */
+ public String[] kind;
+
+ /**
+ * Extra key for people values (type TBD).
+ *
+ * @hide
+ */
+ public static final String EXTRA_PEOPLE = "android.people";
+
+ private Bundle extras;
+
+ /**
+ * Constructs a Notification object with default values.
* You might want to consider using {@link Builder} instead.
*/
public Notification()
{
this.when = System.currentTimeMillis();
+ this.priority = PRIORITY_DEFAULT;
}
/**
@@ -396,6 +504,14 @@
if (parcel.readInt() != 0) {
fullScreenIntent = PendingIntent.CREATOR.createFromParcel(parcel);
}
+
+ priority = parcel.readInt();
+
+ kind = parcel.createStringArray(); // may set kind to null
+
+ if (parcel.readInt() != 0) {
+ extras = parcel.readBundle();
+ }
}
@Override
@@ -438,9 +554,23 @@
that.ledOnMS = this.ledOnMS;
that.ledOffMS = this.ledOffMS;
that.defaults = this.defaults;
-
+
that.flags = this.flags;
+ 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);
+ }
+
+ if (this.extras != null) {
+ that.extras = new Bundle(this.extras);
+
+ }
+
return that;
}
@@ -517,6 +647,17 @@
} else {
parcel.writeInt(0);
}
+
+ parcel.writeInt(priority);
+
+ parcel.writeStringArray(kind); // ok for null
+
+ if (extras != null) {
+ parcel.writeInt(1);
+ extras.writeToParcel(parcel, 0);
+ } else {
+ parcel.writeInt(0);
+ }
}
/**
@@ -551,7 +692,7 @@
* that you take care of task management as described in the
* <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back
* Stack</a> document.
- *
+ *
* @deprecated Use {@link Builder} instead.
*/
@Deprecated
@@ -579,7 +720,9 @@
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append("Notification(contentView=");
+ sb.append("Notification(pri=");
+ sb.append(priority);
+ sb.append(" contentView=");
if (contentView != null) {
sb.append(contentView.getPackage());
sb.append("/0x");
@@ -587,6 +730,7 @@
} else {
sb.append("null");
}
+ // TODO(dsandler): defaults take precedence over local values, so reorder the branches below
sb.append(" vibrate=");
if (this.vibrate != null) {
int N = this.vibrate.length-1;
@@ -604,7 +748,7 @@
} else {
sb.append("null");
}
- sb.append(",sound=");
+ sb.append(" sound=");
if (this.sound != null) {
sb.append(this.sound.toString());
} else if ((this.defaults & DEFAULT_SOUND) != 0) {
@@ -612,20 +756,39 @@
} else {
sb.append("null");
}
- sb.append(",defaults=0x");
+ sb.append(" defaults=0x");
sb.append(Integer.toHexString(this.defaults));
- sb.append(",flags=0x");
+ sb.append(" flags=0x");
sb.append(Integer.toHexString(this.flags));
- if ((this.flags & FLAG_HIGH_PRIORITY) != 0) {
- sb.append("!!!1!one!");
+ 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("])");
return sb.toString();
}
/**
- * Builder class for {@link Notification} objects. Allows easier control over
- * all the flags, as well as help constructing the typical notification layouts.
+ * Builder class for {@link Notification} objects.
+ *
+ * Provides a convenient way to set the various fields of a {@link Notification} and generate
+ * content views using the platform's notification layout template.
+ *
+ * Example:
+ *
+ * <pre class="prettyprint">
+ * Notification noti = new Notification.Builder()
+ * .setContentTitle("New mail from " + sender.toString())
+ * .setContentText(subject)
+ * .setSmallIcon(R.drawable.new_mail)
+ * .setLargeIcon(aBitmap)
+ * .getNotification();
+ * </pre>
*/
public static class Builder {
private Context mContext;
@@ -655,16 +818,28 @@
private int mProgressMax;
private int mProgress;
private boolean mProgressIndeterminate;
+ private ArrayList<String> mKindList = new ArrayList<String>(1);
+ private Bundle mExtras;
+ private int mPriority;
/**
- * Constructor.
+ * Constructs a new Builder with the defaults:
*
- * Automatically sets the when field to {@link System#currentTimeMillis()
- * System.currentTimeMllis()} and the audio stream to the {@link #STREAM_DEFAULT}.
+
+ * <table>
+ * <tr><th align=right>priority</th>
+ * <td>{@link #PRIORITY_DEFAULT}</td></tr>
+ * <tr><th align=right>when</th>
+ * <td>now ({@link System#currentTimeMillis()})</td></tr>
+ * <tr><th align=right>audio stream</th>
+ * <td>{@link #STREAM_DEFAULT}</td></tr>
+ * </table>
*
- * @param context A {@link Context} that will be used to construct the
- * RemoteViews. The Context will not be held past the lifetime of this
- * Builder object.
+
+ * @param context
+ * A {@link Context} that will be used by the Builder to construct the
+ * RemoteViews. The Context will not be held past the lifetime of this Builder
+ * object.
*/
public Builder(Context context) {
mContext = context;
@@ -672,11 +847,14 @@
// Set defaults to match the defaults of a Notification
mWhen = System.currentTimeMillis();
mAudioStreamType = STREAM_DEFAULT;
+ mPriority = PRIORITY_DEFAULT;
}
/**
- * Set the time that the event occurred. Notifications in the panel are
- * sorted by this time.
+ * Add a timestamp pertaining to the notification (usually the time the event occurred).
+ *
+
+ * @see Notification#when
*/
public Builder setWhen(long when) {
mWhen = when;
@@ -684,11 +862,18 @@
}
/**
- * Set the small icon to use in the notification layouts. Different classes of devices
- * may return different sizes. See the UX guidelines for more information on how to
- * design these icons.
+ * Set the small icon resource, which will be used to represent the notification in the
+ * status bar.
*
- * @param icon A resource ID in the application's package of the drawble to use.
+
+ * The platform template for the expanded view will draw this icon in the left, unless a
+ * {@link #setLargeIcon(Bitmap) large icon} has also been specified, in which case the small
+ * icon will be moved to the right-hand side.
+ *
+
+ * @param icon
+ * A resource ID in the application's package of the drawable to use.
+ * @see Notification#icon
*/
public Builder setSmallIcon(int icon) {
mSmallIcon = icon;
@@ -700,10 +885,11 @@
* level parameter for when the icon is a {@link android.graphics.drawable.LevelListDrawable
* LevelListDrawable}.
*
- * @param icon A resource ID in the application's package of the drawble to use.
+ * @param icon A resource ID in the application's package of the drawable to use.
* @param level The level to use for the icon.
*
- * @see android.graphics.drawable.LevelListDrawable
+ * @see Notification#icon
+ * @see Notification#iconLevel
*/
public Builder setSmallIcon(int icon, int level) {
mSmallIcon = icon;
@@ -712,7 +898,7 @@
}
/**
- * Set the title (first row) of the notification, in a standard notification.
+ * Set the first line of text in the platform notification template.
*/
public Builder setContentTitle(CharSequence title) {
mContentTitle = title;
@@ -720,7 +906,7 @@
}
/**
- * Set the text (second row) of the notification, in a standard notification.
+ * Set the second line of text in the platform notification template.
*/
public Builder setContentText(CharSequence text) {
mContentText = text;
@@ -738,7 +924,11 @@
}
/**
- * Set the large text at the right-hand side of the notification.
+ * A small piece of additional information pertaining to this notification.
+ *
+
+ * The platform template will draw this on the last line of the notification, at the far
+ * right (to the right of a smallIcon if it has been placed there).
*/
public Builder setContentInfo(CharSequence info) {
mContentInfo = info;
@@ -746,8 +936,10 @@
}
/**
- * Set the progress this notification represents, which may be
- * represented as a {@link ProgressBar}.
+ * Set the progress this notification represents.
+ *
+
+ * The platform template will represent this using a {@link ProgressBar}.
*/
public Builder setProgress(int max, int progress, boolean indeterminate) {
mProgressMax = max;
@@ -757,7 +949,10 @@
}
/**
- * Supply a custom RemoteViews to use instead of the standard one.
+ * Supply a custom RemoteViews to use instead of the platform template.
+ *
+
+ * @see Notification#contentView
*/
public Builder setContent(RemoteViews views) {
mContentView = views;
@@ -765,12 +960,20 @@
}
/**
- * Supply a {@link PendingIntent} to send when the notification is clicked.
- * If you do not supply an intent, you can now add PendingIntents to individual
- * views to be launched when clicked by calling {@link RemoteViews#setOnClickPendingIntent
- * RemoteViews.setOnClickPendingIntent(int,PendingIntent)}. Be sure to
- * read {@link Notification#contentIntent Notification.contentIntent} for
- * how to correctly use this.
+ * Supply a {@link PendingIntent} to be sent when the notification is clicked.
+ *
+
+ * As of {@link android.os.Build.VERSION_CODES#HONEYCOMB}, if this field is unset and you
+ * have specified a custom RemoteViews with {@link #setContent(RemoteViews)}, you can use
+ * {@link RemoteViews#setOnClickPendingIntent RemoteViews.setOnClickPendingIntent(int,PendingIntent)}
+
+ * to assign PendingIntents to individual views in that custom layout (i.e., to create
+
+ * clickable buttons inside the
+ * notification view).
+ *
+
+ * @see Notification#contentIntent Notification.contentIntent
*/
public Builder setContentIntent(PendingIntent intent) {
mContentIntent = intent;
@@ -778,11 +981,10 @@
}
/**
- * Supply a {@link PendingIntent} to send when the notification is cleared by the user
- * directly from the notification panel. For example, this intent is sent when the user
- * clicks the "Clear all" button, or the individual "X" buttons on notifications. This
- * intent is not sent when the application calls {@link NotificationManager#cancel
- * NotificationManager.cancel(int)}.
+ * Supply a {@link PendingIntent} to send when the notification is cleared explicitly by the user.
+ *
+
+ * @see Notification#deleteIntent
*/
public Builder setDeleteIntent(PendingIntent intent) {
mDeleteIntent = intent;
@@ -801,6 +1003,8 @@
* @param intent The pending intent to launch.
* @param highPriority Passing true will cause this notification to be sent
* even if other notifications are suppressed.
+ *
+ * @see Notification#fullScreenIntent
*/
public Builder setFullScreenIntent(PendingIntent intent, boolean highPriority) {
mFullScreenIntent = intent;
@@ -809,8 +1013,11 @@
}
/**
- * Set the text that is displayed in the status bar when the notification first
+ * Set the "ticker" text which is displayed in the status bar when the notification first
* arrives.
+ *
+
+ * @see Notification#tickerText
*/
public Builder setTicker(CharSequence tickerText) {
mTickerText = tickerText;
@@ -821,6 +1028,9 @@
* Set the text that is displayed in the status bar when the notification first
* arrives, and also a RemoteViews object that may be displayed instead on some
* devices.
+ *
+ * @see Notification#tickerText
+ * @see Notification#tickerView
*/
public Builder setTicker(CharSequence tickerText, RemoteViews views) {
mTickerText = tickerText;
@@ -829,7 +1039,12 @@
}
/**
- * Set the large icon that is shown in the ticker and notification.
+ * Add a large icon to the notification (and the ticker on some devices).
+ *
+ * In the platform template, this image will be shown on the left of the notification view
+ * in place of the {@link #setSmallIcon(int) small icon} (which will move to the right side).
+ *
+ * @see Notification#largeIcon
*/
public Builder setLargeIcon(Bitmap icon) {
mLargeIcon = icon;
@@ -837,7 +1052,11 @@
}
/**
- * Set the sound to play. It will play on the default stream.
+ * Set the sound to play.
+ *
+ * It will be played on the {@link #STREAM_DEFAULT default stream} for notifications.
+ *
+ * @see Notification#sound
*/
public Builder setSound(Uri sound) {
mSound = sound;
@@ -846,10 +1065,11 @@
}
/**
- * Set the sound to play. It will play on the stream you supply.
+ * Set the sound to play, along with a specific stream on which to play it.
*
- * @see #STREAM_DEFAULT
- * @see AudioManager for the <code>STREAM_</code> constants.
+ * See {@link android.media.AudioManager} for the <code>STREAM_</code> constants.
+ *
+ * @see Notification#sound
*/
public Builder setSound(Uri sound, int streamType) {
mSound = sound;
@@ -860,8 +1080,12 @@
/**
* Set the vibration pattern to use.
*
- * @see android.os.Vibrator for a discussion of the <code>pattern</code>
- * parameter.
+
+ * See {@link android.os.Vibrator#vibrate(long[], int)} for a discussion of the
+ * <code>pattern</code> parameter.
+ *
+
+ * @see Notification#vibrate
*/
public Builder setVibrate(long[] pattern) {
mVibrate = pattern;
@@ -869,9 +1093,16 @@
}
/**
- * Set the argb value that you would like the LED on the device to blnk, as well as the
- * rate. The rate is specified in terms of the number of milliseconds to be on
- * and then the number of milliseconds to be off.
+ * Set the desired color for the indicator LED on the device, as well as the
+ * blink duty cycle (specified in milliseconds).
+ *
+
+ * Not all devices will honor all (or even any) of these values.
+ *
+
+ * @see Notification#ledARGB
+ * @see Notification#ledOnMS
+ * @see Notification#ledOffMS
*/
public Builder setLights(int argb, int onMs, int offMs) {
mLedArgb = argb;
@@ -881,15 +1112,20 @@
}
/**
- * Set whether this is an ongoing notification.
+ * Set whether this is an "ongoing" notification.
*
- * <p>Ongoing notifications differ from regular notifications in the following ways:
- * <ul>
- * <li>Ongoing notifications are sorted above the regular notifications in the
- * notification panel.</li>
- * <li>Ongoing notifications do not have an 'X' close button, and are not affected
- * by the "Clear all" button.
- * </ul>
+
+ * Ongoing notifications cannot be dismissed by the user, so your application or service
+ * must take care of canceling them.
+ *
+
+ * They are typically used to indicate a background task that the user is actively engaged
+ * with (e.g., playing music) or is pending in some way and therefore occupying the device
+ * (e.g., a file download, sync operation, active network connection).
+ *
+
+ * @see Notification#FLAG_ONGOING_EVENT
+ * @see Service#setForeground(boolean)
*/
public Builder setOngoing(boolean ongoing) {
setFlag(FLAG_ONGOING_EVENT, ongoing);
@@ -899,6 +1135,8 @@
/**
* Set this flag if you would only like the sound, vibrate
* and ticker to be played if the notification is not already showing.
+ *
+ * @see Notification#FLAG_ONLY_ALERT_ONCE
*/
public Builder setOnlyAlertOnce(boolean onlyAlertOnce) {
setFlag(FLAG_ONLY_ALERT_ONCE, onlyAlertOnce);
@@ -906,10 +1144,10 @@
}
/**
- * Setting this flag will make it so the notification is automatically
- * canceled when the user clicks it in the panel. The PendingIntent
- * set with {@link #setDeleteIntent} will be broadcast when the notification
- * is canceled.
+ * Make this notification automatically dismissed when the user touches it. The
+ * PendingIntent set with {@link #setDeleteIntent} will be sent when this happens.
+ *
+ * @see Notification#FLAG_AUTO_CANCEL
*/
public Builder setAutoCancel(boolean autoCancel) {
setFlag(FLAG_AUTO_CANCEL, autoCancel);
@@ -917,7 +1155,7 @@
}
/**
- * Set the default notification options that will be used.
+ * Set which notification properties will be inherited from system defaults.
* <p>
* The value should be one or more of the following fields combined with
* bitwise-or:
@@ -930,6 +1168,41 @@
return this;
}
+ /**
+ * Set the priority of this notification.
+ *
+ * @see Notification#priority
+ */
+ public Builder setPriority(int pri) {
+ mPriority = pri;
+ return this;
+ }
+
+ /**
+ * Add a kind (category) to this notification. Optional.
+ *
+ * @see Notification#kind
+ */
+ public Builder addKind(String k) {
+ mKindList.add(k);
+ return this;
+ }
+
+ /**
+ * Add metadata to this notification.
+ *
+ * A reference to the Bundle is held for the lifetime of this Builder, and the Bundle's
+ * current contents are copied into the Notification each time {@link #getNotification()} is
+ * called.
+ *
+ * @see Notification#extras
+ * @hide
+ */
+ public Builder setExtras(Bundle bag) {
+ mExtras = bag;
+ return this;
+ }
+
private void setFlag(int mask, boolean value) {
if (value) {
mFlags |= mask;
@@ -1042,6 +1315,14 @@
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.priority = mPriority;
+ n.extras = mExtras != null ? new Bundle(mExtras) : null;
return n;
}
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 31d874f..e0d0763 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -381,6 +381,8 @@
mAccessibilityManager = AccessibilityManager.getInstance(context);
mAccessibilityInteractionConnectionManager =
new AccessibilityInteractionConnectionManager();
+ mAccessibilityManager.addAccessibilityStateChangeListener(
+ mAccessibilityInteractionConnectionManager);
mAttachInfo = new View.AttachInfo(sWindowSession, mWindow, this, mHandler, this);
mViewConfiguration = ViewConfiguration.get(context);
mDensity = context.getResources().getDisplayMetrics().densityDpi;
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
index 4fb0046..dfbfc70 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
@@ -16,7 +16,6 @@
package android.view.accessibility;
-import android.os.Process;
import android.util.Log;
import android.util.LongSparseArray;
@@ -81,14 +80,16 @@
public AccessibilityNodeInfo get(long accessibilityNodeId) {
if (ENABLED) {
synchronized(mLock) {
- if (DEBUG) {
- AccessibilityNodeInfo info = mCacheImpl.get(accessibilityNodeId);
- Log.i(LOG_TAG, "Process: " + Process.myPid() +
- " get(" + accessibilityNodeId + ") = " + info);
- return info;
- } else {
- return mCacheImpl.get(accessibilityNodeId);
+ AccessibilityNodeInfo info = mCacheImpl.get(accessibilityNodeId);
+ if (info != null) {
+ // Return a copy since the client calls to AccessibilityNodeInfo#recycle()
+ // will wipe the data of the cached info.
+ info = AccessibilityNodeInfo.obtain(info);
}
+ if (DEBUG) {
+ Log.i(LOG_TAG, "get(" + accessibilityNodeId + ") = " + info);
+ }
+ return info;
}
} else {
return null;
@@ -105,10 +106,12 @@
if (ENABLED) {
synchronized(mLock) {
if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid()
- + " put(" + accessibilityNodeId + ", " + info + ")");
+ Log.i(LOG_TAG, "put(" + accessibilityNodeId + ", " + info + ")");
}
- mCacheImpl.put(accessibilityNodeId, info);
+ // Cache a copy since the client calls to AccessibilityNodeInfo#recycle()
+ // will wipe the data of the cached info.
+ AccessibilityNodeInfo clone = AccessibilityNodeInfo.obtain(info);
+ mCacheImpl.put(accessibilityNodeId, clone);
}
}
}
@@ -138,8 +141,7 @@
if (ENABLED) {
synchronized(mLock) {
if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid()
- + " remove(" + accessibilityNodeId + ")");
+ Log.i(LOG_TAG, "remove(" + accessibilityNodeId + ")");
}
mCacheImpl.remove(accessibilityNodeId);
}
@@ -153,7 +155,13 @@
if (ENABLED) {
synchronized(mLock) {
if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid() + "clear()");
+ Log.i(LOG_TAG, "clear()");
+ }
+ // Recycle the nodes before clearing the cache.
+ final int nodeCount = mCacheImpl.size();
+ for (int i = 0; i < nodeCount; i++) {
+ AccessibilityNodeInfo info = mCacheImpl.valueAt(i);
+ info.recycle();
}
mCacheImpl.clear();
}
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 98d59c4..b9dfb2e 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -9238,6 +9238,30 @@
}
}
+ private void setHitTestTypeFromUrl(String url) {
+ String substr = null;
+ if (url.startsWith(SCHEME_GEO)) {
+ mInitialHitTestResult.mType = HitTestResult.GEO_TYPE;
+ substr = url.substring(SCHEME_GEO.length());
+ } else if (url.startsWith(SCHEME_TEL)) {
+ mInitialHitTestResult.mType = HitTestResult.PHONE_TYPE;
+ substr = url.substring(SCHEME_TEL.length());
+ } else if (url.startsWith(SCHEME_MAILTO)) {
+ mInitialHitTestResult.mType = HitTestResult.EMAIL_TYPE;
+ substr = url.substring(SCHEME_MAILTO.length());
+ } else {
+ mInitialHitTestResult.mType = HitTestResult.SRC_ANCHOR_TYPE;
+ mInitialHitTestResult.mExtra = url;
+ return;
+ }
+ try {
+ mInitialHitTestResult.mExtra = URLDecoder.decode(substr, "UTF-8");
+ } catch (Throwable e) {
+ Log.w(LOGTAG, "Failed to decode URL! " + substr, e);
+ mInitialHitTestResult.mType = HitTestResult.UNKNOWN_TYPE;
+ }
+ }
+
private void setHitTestResult(WebKitHitTest hit) {
if (hit == null) {
mInitialHitTestResult = null;
@@ -9245,9 +9269,9 @@
}
mInitialHitTestResult = new HitTestResult();
if (hit.mLinkUrl != null) {
- mInitialHitTestResult.mType = HitTestResult.SRC_ANCHOR_TYPE;
- mInitialHitTestResult.mExtra = hit.mLinkUrl;
- if (hit.mImageUrl != null) {
+ setHitTestTypeFromUrl(hit.mLinkUrl);
+ if (hit.mImageUrl != null
+ && mInitialHitTestResult.mType == HitTestResult.SRC_ANCHOR_TYPE) {
mInitialHitTestResult.mType = HitTestResult.SRC_IMAGE_ANCHOR_TYPE;
mInitialHitTestResult.mExtra = hit.mImageUrl;
}
@@ -9257,25 +9281,7 @@
} else if (hit.mEditable) {
mInitialHitTestResult.mType = HitTestResult.EDIT_TEXT_TYPE;
} else if (hit.mIntentUrl != null) {
- String substr = null;
- if (hit.mIntentUrl.startsWith(SCHEME_GEO)) {
- mInitialHitTestResult.mType = HitTestResult.GEO_TYPE;
- substr = hit.mIntentUrl.substring(SCHEME_GEO.length());
- } else if (hit.mIntentUrl.startsWith(SCHEME_TEL)) {
- mInitialHitTestResult.mType = HitTestResult.PHONE_TYPE;
- substr = hit.mIntentUrl.substring(SCHEME_TEL.length());
- } else if (hit.mIntentUrl.startsWith(SCHEME_MAILTO)) {
- mInitialHitTestResult.mType = HitTestResult.EMAIL_TYPE;
- substr = hit.mIntentUrl.substring(SCHEME_MAILTO.length());
- } else {
- return;
- }
- try {
- mInitialHitTestResult.mExtra = URLDecoder.decode(substr, "UTF-8");
- } catch (Throwable e) {
- Log.w(LOGTAG, "Failed to decode GEO URL!", e);
- mInitialHitTestResult.mType = HitTestResult.UNKNOWN_TYPE;
- }
+ setHitTestTypeFromUrl(hit.mIntentUrl);
}
}
@@ -9522,10 +9528,11 @@
}
}
nativeSetTextSelection(mNativeClass, data.mSelectTextPtr);
- if (data.mSelectTextPtr != 0) {
- mIsCaretSelection = (mFieldPointer == nodePointer)
- && (mFieldPointer != 0)
- && (data.mStart == data.mEnd);
+
+ if (data.mSelectTextPtr != 0 &&
+ (data.mStart != data.mEnd ||
+ (mFieldPointer == nodePointer && mFieldPointer != 0))) {
+ mIsCaretSelection = (data.mStart == data.mEnd);
if (!mSelectingText) {
setupWebkitSelect();
} else if (!mSelectionStarted) {
diff --git a/core/java/com/android/internal/statusbar/StatusBarNotification.java b/core/java/com/android/internal/statusbar/StatusBarNotification.java
index c03ff1a..d443523 100644
--- a/core/java/com/android/internal/statusbar/StatusBarNotification.java
+++ b/core/java/com/android/internal/statusbar/StatusBarNotification.java
@@ -34,25 +34,23 @@
}
*/
+/**
+ * Class encapsulating a Notification. Sent by the NotificationManagerService to the IStatusBar (in System UI).
+ */
public class StatusBarNotification implements Parcelable {
- public static int PRIORITY_JIFFY_EXPRESS = -100;
- public static int PRIORITY_NORMAL = 0;
- public static int PRIORITY_ONGOING = 100;
- public static int PRIORITY_SYSTEM = 200;
-
public String pkg;
public int id;
public String tag;
public int uid;
public int initialPid;
public Notification notification;
- public int priority = PRIORITY_NORMAL;
-
+ public int score;
+
public StatusBarNotification() {
}
public StatusBarNotification(String pkg, int id, String tag,
- int uid, int initialPid, Notification notification) {
+ int uid, int initialPid, int score, Notification notification) {
if (pkg == null) throw new NullPointerException();
if (notification == null) throw new NullPointerException();
@@ -61,9 +59,8 @@
this.tag = tag;
this.uid = uid;
this.initialPid = initialPid;
+ this.score = score;
this.notification = notification;
-
- this.priority = PRIORITY_NORMAL;
}
public StatusBarNotification(Parcel in) {
@@ -80,7 +77,7 @@
}
this.uid = in.readInt();
this.initialPid = in.readInt();
- this.priority = in.readInt();
+ this.score = in.readInt();
this.notification = new Notification(in);
}
@@ -95,7 +92,7 @@
}
out.writeInt(this.uid);
out.writeInt(this.initialPid);
- out.writeInt(this.priority);
+ out.writeInt(this.score);
this.notification.writeToParcel(out, flags);
}
@@ -119,12 +116,12 @@
public StatusBarNotification clone() {
return new StatusBarNotification(this.pkg, this.id, this.tag,
- this.uid, this.initialPid, this.notification.clone());
+ this.uid, this.initialPid, this.score, this.notification.clone());
}
public String toString() {
- return "StatusBarNotification(package=" + pkg + " id=" + id + " tag=" + tag
- + " notification=" + notification + " priority=" + priority + ")";
+ return "StatusBarNotification(pkg=" + pkg + " id=" + id + " tag=" + tag
+ + " score=" + score + " notn=" + notification + ")";
}
public boolean isOngoing() {
diff --git a/docs/html/guide/developing/projects/projects-eclipse.jd b/docs/html/guide/developing/projects/projects-eclipse.jd
index 40c17ed..90f7820 100644
--- a/docs/html/guide/developing/projects/projects-eclipse.jd
+++ b/docs/html/guide/developing/projects/projects-eclipse.jd
@@ -201,7 +201,7 @@
priority. The application itself has highest priority and its resources are always used in
preference to identical resource IDs defined in libraries.</p>
- <h3>Declaring library components in the the manifest file</h3>
+ <h3>Declaring library components in the manifest file</h3>
<p>In the manifest file of the application project, you must add declarations of all components
that the application will use that are imported from a library project. For example, you must
diff --git a/media/libstagefright/MediaCodec.cpp b/media/libstagefright/MediaCodec.cpp
index 4acbdbe..e14b1c4 100644
--- a/media/libstagefright/MediaCodec.cpp
+++ b/media/libstagefright/MediaCodec.cpp
@@ -577,7 +577,7 @@
{
/* size_t index = */updateBuffers(kPortIndexInput, msg);
- if (mState == FLUSHING) {
+ if (mState == FLUSHING || mState == STOPPING) {
returnBuffersToCodecOnPort(kPortIndexInput);
break;
}
@@ -596,7 +596,7 @@
{
/* size_t index = */updateBuffers(kPortIndexOutput, msg);
- if (mState == FLUSHING) {
+ if (mState == FLUSHING || mState == STOPPING) {
returnBuffersToCodecOnPort(kPortIndexOutput);
break;
}
@@ -673,9 +673,8 @@
int32_t nameIsType;
int32_t encoder = false;
- if (!msg->findInt32("nameIsType", &nameIsType)) {
- nameIsType = false;
- } else {
+ CHECK(msg->findInt32("nameIsType", &nameIsType));
+ if (nameIsType) {
CHECK(msg->findInt32("encoder", &encoder));
}
diff --git a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
index ef3c31b..e878bba 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/basic_op.h
@@ -228,7 +228,7 @@
__inline Word32 ASM_L_shr(Word32 L_var1, Word16 var2)
{
Word32 result;
- asm volatile(
+ asm (
"MOV %[result], %[L_var1], ASR %[var2] \n"
:[result]"=r"(result)
:[L_var1]"r"(L_var1), [var2]"r"(var2)
@@ -239,15 +239,12 @@
__inline Word32 ASM_L_shl(Word32 L_var1, Word16 var2)
{
Word32 result;
- asm volatile(
- "MOV r2, %[L_var1] \n"
- "MOV r3, #0x7fffffff\n"
+ asm (
"MOV %[result], %[L_var1], ASL %[var2] \n"
- "TEQ r2, %[result], ASR %[var2]\n"
- "EORNE %[result],r3,r2,ASR#31\n"
- :[result]"+r"(result)
- :[L_var1]"r"(L_var1), [var2]"r"(var2)
- :"r2", "r3"
+ "TEQ %[L_var1], %[result], ASR %[var2]\n"
+ "EORNE %[result], %[mask], %[L_var1], ASR #31\n"
+ :[result]"=&r"(result)
+ :[L_var1]"r"(L_var1), [var2]"r"(var2), [mask]"r"(0x7fffffff)
);
return result;
}
@@ -255,10 +252,10 @@
__inline Word32 ASM_shr(Word32 L_var1, Word16 var2)
{
Word32 result;
- asm volatile(
+ asm (
"CMP %[var2], #15\n"
- "MOVGE %[var2], #15\n"
- "MOV %[result], %[L_var1], ASR %[var2]\n"
+ "MOVLT %[result], %[L_var1], ASR %[var2]\n"
+ "MOVGE %[result], %[L_var1], ASR #15\n"
:[result]"=r"(result)
:[L_var1]"r"(L_var1), [var2]"r"(var2)
);
@@ -268,18 +265,16 @@
__inline Word32 ASM_shl(Word32 L_var1, Word16 var2)
{
Word32 result;
- asm volatile(
+ Word32 tmp;
+ asm (
"CMP %[var2], #16\n"
- "MOVGE %[var2], #16\n"
- "MOV %[result], %[L_var1], ASL %[var2]\n"
- "MOV r3, #1\n"
- "MOV r2, %[result], ASR #15\n"
- "RSB r3,r3,r3,LSL #15 \n"
- "TEQ r2, %[result], ASR #31 \n"
- "EORNE %[result], r3, %[result],ASR #31"
- :[result]"+r"(result)
- :[L_var1]"r"(L_var1), [var2]"r"(var2)
- :"r2", "r3"
+ "MOVLT %[result], %[L_var1], ASL %[var2]\n"
+ "MOVGE %[result], %[L_var1], ASL #16\n"
+ "MOV %[tmp], %[result], ASR #15\n"
+ "TEQ %[tmp], %[result], ASR #31 \n"
+ "EORNE %[result], %[mask], %[result],ASR #31"
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
+ :[L_var1]"r"(L_var1), [var2]"r"(var2), [mask]"r"(0x7fff)
);
return result;
}
@@ -295,16 +290,14 @@
{
#if ARMV5TE_SAT
Word16 result;
+ Word32 tmp;
asm volatile (
- "MOV %[result], %[L_var1]\n"
- "MOV r3, #1\n"
- "MOV r2,%[L_var1],ASR#15\n"
- "RSB r3, r3, r3, LSL #15\n"
- "TEQ r2,%[L_var1],ASR#31\n"
- "EORNE %[result],r3,%[L_var1],ASR#31\n"
- :[result]"+r"(result)
- :[L_var1]"r"(L_var1)
- :"r2", "r3"
+ "MOV %[tmp], %[L_var1],ASR#15\n"
+ "TEQ %[tmp], %[L_var1],ASR#31\n"
+ "EORNE %[result], %[mask],%[L_var1],ASR#31\n"
+ "MOVEQ %[result], %[L_var1]\n"
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
+ :[L_var1]"r"(L_var1), [mask]"r"(0x7fff)
);
return result;
@@ -420,10 +413,10 @@
{
#if ARMV5TE_L_MULT
Word32 result;
- asm volatile(
+ asm (
"SMULBB %[result], %[var1], %[var2] \n"
"QADD %[result], %[result], %[result] \n"
- :[result]"+r"(result)
+ :[result]"=r"(result)
:[var1]"r"(var1), [var2]"r"(var2)
);
return result;
@@ -450,11 +443,11 @@
{
#if ARMV5TE_L_MSU
Word32 result;
- asm volatile(
+ asm (
"SMULBB %[result], %[var1], %[var2] \n"
"QADD %[result], %[result], %[result] \n"
"QSUB %[result], %[L_var3], %[result]\n"
- :[result]"+r"(result)
+ :[result]"=&r"(result)
:[L_var3]"r"(L_var3), [var1]"r"(var1), [var2]"r"(var2)
);
return result;
@@ -474,9 +467,9 @@
{
#if ARMV5TE_L_SUB
Word32 result;
- asm volatile(
+ asm (
"QSUB %[result], %[L_var1], %[L_var2]\n"
- :[result]"+r"(result)
+ :[result]"=r"(result)
:[L_var1]"r"(L_var1), [L_var2]"r"(L_var2)
);
return result;
@@ -589,16 +582,14 @@
{
#if ARMV5TE_ADD
Word32 result;
- asm volatile(
+ Word32 tmp;
+ asm (
"ADD %[result], %[var1], %[var2] \n"
- "MOV r3, #0x1\n"
- "MOV r2, %[result], ASR #15\n"
- "RSB r3, r3, r3, LSL, #15\n"
- "TEQ r2, %[result], ASR #31\n"
- "EORNE %[result], r3, %[result], ASR #31"
- :[result]"+r"(result)
- :[var1]"r"(var1), [var2]"r"(var2)
- :"r2", "r3"
+ "MOV %[tmp], %[result], ASR #15 \n"
+ "TEQ %[tmp], %[result], ASR #31 \n"
+ "EORNE %[result], %[mask], %[result], ASR #31"
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
+ :[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
);
return result;
#else
@@ -619,16 +610,14 @@
{
#if ARMV5TE_SUB
Word32 result;
- asm volatile(
- "MOV r3, #1\n"
+ Word32 tmp;
+ asm (
"SUB %[result], %[var1], %[var2] \n"
- "RSB r3,r3,r3,LSL#15\n"
- "MOV r2, %[var1], ASR #15 \n"
- "TEQ r2, %[var1], ASR #31 \n"
- "EORNE %[result], r3, %[result], ASR #31 \n"
- :[result]"+r"(result)
- :[var1]"r"(var1), [var2]"r"(var2)
- :"r2", "r3"
+ "MOV %[tmp], %[var1], ASR #15 \n"
+ "TEQ %[tmp], %[var1], ASR #31 \n"
+ "EORNE %[result], %[mask], %[result], ASR #31 \n"
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
+ :[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
);
return result;
#else
@@ -683,18 +672,15 @@
__inline Word16 mult (Word16 var1, Word16 var2)
{
#if ARMV5TE_MULT
- Word32 result;
- asm volatile(
- "SMULBB r2, %[var1], %[var2] \n"
- "MOV r3, #1\n"
- "MOV %[result], r2, ASR #15\n"
- "RSB r3, r3, r3, LSL #15\n"
- "MOV r2, %[result], ASR #15\n"
- "TEQ r2, %[result], ASR #31\n"
- "EORNE %[result], r3, %[result], ASR #31 \n"
- :[result]"+r"(result)
- :[var1]"r"(var1), [var2]"r"(var2)
- :"r2", "r3"
+ Word32 result, tmp;
+ asm (
+ "SMULBB %[tmp], %[var1], %[var2] \n"
+ "MOV %[result], %[tmp], ASR #15\n"
+ "MOV %[tmp], %[result], ASR #15\n"
+ "TEQ %[tmp], %[result], ASR #31\n"
+ "EORNE %[result], %[mask], %[result], ASR #31 \n"
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
+ :[var1]"r"(var1), [var2]"r"(var2), [mask]"r"(0x7fff)
);
return result;
#else
@@ -719,18 +705,17 @@
{
#if ARMV5TE_NORM_S
Word16 result;
- asm volatile(
- "MOV r2,%[var1] \n"
- "CMP r2, #0\n"
- "RSBLT %[var1], %[var1], #0 \n"
- "CLZNE %[result], %[var1]\n"
+ Word32 tmp;
+ asm (
+ "RSBS %[tmp], %[var1], #0 \n"
+ "CLZLT %[result], %[var1]\n"
+ "CLZGT %[result], %[tmp]\n"
"SUBNE %[result], %[result], #17\n"
"MOVEQ %[result], #0\n"
- "CMP r2, #-1\n"
+ "CMP %[var1], #-1\n"
"MOVEQ %[result], #15\n"
- :[result]"+r"(result)
+ :[result]"=&r"(result), [tmp]"=&r"(tmp)
:[var1]"r"(var1)
- :"r2"
);
return result;
#else
@@ -774,7 +759,7 @@
"CLZNE %[result], %[L_var1]\n"
"SUBNE %[result], %[result], #1\n"
"MOVEQ %[result], #0\n"
- :[result]"+r"(result)
+ :[result]"=r"(result)
:[L_var1]"r"(L_var1)
);
return result;
@@ -979,13 +964,11 @@
{
#if ARMV5TE_ROUND
Word16 result;
- asm volatile(
- "MOV r1,#0x00008000\n"
- "QADD %[result], %[L_var1], r1\n"
+ asm (
+ "QADD %[result], %[L_var1], %[bias]\n"
"MOV %[result], %[result], ASR #16 \n"
- :[result]"+r"(result)
- :[L_var1]"r"(L_var1)
- :"r1"
+ :[result]"=r"(result)
+ :[L_var1]"r"(L_var1), [bias]"r"(0x8000)
);
return result;
#else
@@ -1005,11 +988,11 @@
{
#if ARMV5TE_L_MAC
Word32 result;
- asm volatile(
+ asm (
"SMULBB %[result], %[var1], %[var2]\n"
"QADD %[result], %[result], %[result]\n"
"QADD %[result], %[result], %[L_var3]\n"
- :[result]"+r"(result)
+ :[result]"=&r"(result)
: [L_var3]"r"(L_var3), [var1]"r"(var1), [var2]"r"(var2)
);
return result;
@@ -1029,9 +1012,9 @@
{
#if ARMV5TE_L_ADD
Word32 result;
- asm volatile(
+ asm (
"QADD %[result], %[L_var1], %[L_var2]\n"
- :[result]"+r"(result)
+ :[result]"=r"(result)
:[L_var1]"r"(L_var1), [L_var2]"r"(L_var2)
);
return result;
diff --git a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
index 9ebd1c2..6e5844f 100644
--- a/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
+++ b/media/libstagefright/codecs/aacenc/basic_op/oper_32b.h
@@ -63,7 +63,7 @@
Word32 result;
asm volatile(
"SMULWB %[result], %[L_var2], %[var1] \n"
- :[result]"+r"(result)
+ :[result]"=r"(result)
:[L_var2]"r"(L_var2), [var1]"r"(var1)
);
return result;
diff --git a/media/libstagefright/codecs/aacenc/inc/aacenc_core.h b/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
index 1acdbbc..bb75b6d 100644
--- a/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
+++ b/media/libstagefright/codecs/aacenc/inc/aacenc_core.h
@@ -102,7 +102,7 @@
const UWord8 *ancBytes, /*!< pointer to ancillary data bytes */
Word16 *numAncBytes, /*!< number of ancillary Data Bytes, send as fill element */
UWord8 *outBytes, /*!< pointer to output buffer */
- Word32 *numOutBytes /*!< number of bytes in output buffer */
+ VO_U32 *numOutBytes /*!< number of bytes in output buffer */
);
/*---------------------------------------------------------------------------
diff --git a/media/libstagefright/codecs/aacenc/inc/bitbuffer.h b/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
index e538064..7c79f07 100644
--- a/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
+++ b/media/libstagefright/codecs/aacenc/inc/bitbuffer.h
@@ -76,7 +76,7 @@
Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
- Word32 writeValue,
+ UWord32 writeValue,
Word16 noBitsToWrite);
void ResetBitBuf(HANDLE_BIT_BUF hBitBuf,
diff --git a/media/libstagefright/codecs/aacenc/inc/psy_configuration.h b/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
index 9abfc99..f6981fa 100644
--- a/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
+++ b/media/libstagefright/codecs/aacenc/inc/psy_configuration.h
@@ -31,7 +31,7 @@
Word16 sfbCnt;
Word16 sfbActive; /* number of sf bands containing energy after lowpass */
- Word16 *sfbOffset;
+ const Word16 *sfbOffset;
Word32 sfbThresholdQuiet[MAX_SFB_LONG];
@@ -61,7 +61,7 @@
Word16 sfbCnt;
Word16 sfbActive; /* number of sf bands containing energy after lowpass */
- Word16 *sfbOffset;
+ const Word16 *sfbOffset;
Word32 sfbThresholdQuiet[MAX_SFB_SHORT];
diff --git a/media/libstagefright/codecs/aacenc/src/aacenc_core.c b/media/libstagefright/codecs/aacenc/src/aacenc_core.c
index 2b3bd48..cecbc8f 100644
--- a/media/libstagefright/codecs/aacenc/src/aacenc_core.c
+++ b/media/libstagefright/codecs/aacenc/src/aacenc_core.c
@@ -146,7 +146,7 @@
const UWord8 *ancBytes, /*!< pointer to ancillary data bytes */
Word16 *numAncBytes, /*!< number of ancillary Data Bytes */
UWord8 *outBytes, /*!< pointer to output buffer (must be large MINBITS_COEF/8*MAX_CHANNELS bytes) */
- Word32 *numOutBytes /*!< number of bytes in output buffer after processing */
+ VO_U32 *numOutBytes /*!< number of bytes in output buffer after processing */
)
{
ELEMENT_INFO *elInfo = &aacEnc->elInfo;
diff --git a/media/libstagefright/codecs/aacenc/src/adj_thr.c b/media/libstagefright/codecs/aacenc/src/adj_thr.c
index a8ab809..373b063 100644
--- a/media/libstagefright/codecs/aacenc/src/adj_thr.c
+++ b/media/libstagefright/codecs/aacenc/src/adj_thr.c
@@ -26,6 +26,7 @@
#include "adj_thr.h"
#include "qc_data.h"
#include "line_pe.h"
+#include <string.h>
#define minSnrLimit 0x6666 /* 1 dB */
@@ -1138,6 +1139,7 @@
Word16 maxBitresBits = elBits->maxBits;
Word16 sideInfoBits = (qcOE->staticBitsUsed + qcOE->ancBitsUsed);
Word16 ch;
+ memset(&peData, 0, sizeof(peData));
prepareSfbPe(&peData, psyOutChannel, logSfbEnergy, sfbNRelevantLines, nChannels, AdjThrStateElement->peOffset);
diff --git a/media/libstagefright/codecs/aacenc/src/bitbuffer.c b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
index 5615ac3..a706893 100644
--- a/media/libstagefright/codecs/aacenc/src/bitbuffer.c
+++ b/media/libstagefright/codecs/aacenc/src/bitbuffer.c
@@ -138,7 +138,7 @@
*
*****************************************************************************/
Word16 WriteBits(HANDLE_BIT_BUF hBitBuf,
- Word32 writeValue,
+ UWord32 writeValue,
Word16 noBitsToWrite)
{
Word16 wBitPos;
diff --git a/media/libstagefright/codecs/aacenc/src/dyn_bits.c b/media/libstagefright/codecs/aacenc/src/dyn_bits.c
index 3d2efdc..7769188 100644
--- a/media/libstagefright/codecs/aacenc/src/dyn_bits.c
+++ b/media/libstagefright/codecs/aacenc/src/dyn_bits.c
@@ -281,7 +281,7 @@
const Word32 blockType)
{
Word32 grpNdx, i;
- Word16 *sideInfoTab = NULL;
+ const Word16 *sideInfoTab = NULL;
SECTION_INFO *sectionInfo;
/*
diff --git a/media/libstagefright/codecs/aacenc/src/interface.c b/media/libstagefright/codecs/aacenc/src/interface.c
index f2472d8..d0ad433 100644
--- a/media/libstagefright/codecs/aacenc/src/interface.c
+++ b/media/libstagefright/codecs/aacenc/src/interface.c
@@ -99,8 +99,8 @@
Word32 i;
Word32 accuSumMS=0;
Word32 accuSumLR=0;
- Word32 *pSumMS = sfbEnergySumMS.sfbShort;
- Word32 *pSumLR = sfbEnergySumLR.sfbShort;
+ const Word32 *pSumMS = sfbEnergySumMS.sfbShort;
+ const Word32 *pSumLR = sfbEnergySumLR.sfbShort;
for (i=TRANS_FAC; i; i--) {
accuSumLR = L_add(accuSumLR, *pSumLR); pSumLR++;
diff --git a/media/libstagefright/codecs/aacenc/src/psy_configuration.c b/media/libstagefright/codecs/aacenc/src/psy_configuration.c
index 02d92ab..dd40f9b 100644
--- a/media/libstagefright/codecs/aacenc/src/psy_configuration.c
+++ b/media/libstagefright/codecs/aacenc/src/psy_configuration.c
@@ -139,7 +139,7 @@
*
*****************************************************************************/
static void initThrQuiet(Word16 numPb,
- Word16 *pbOffset,
+ const Word16 *pbOffset,
Word16 *pbBarcVal,
Word32 *pbThresholdQuiet) {
Word16 i;
@@ -250,7 +250,7 @@
*
*****************************************************************************/
static void initBarcValues(Word16 numPb,
- Word16 *pbOffset,
+ const Word16 *pbOffset,
Word16 numLines,
Word32 samplingFrequency,
Word16 *pbBval)
diff --git a/media/libstagefright/codecs/aacenc/src/psy_main.c b/media/libstagefright/codecs/aacenc/src/psy_main.c
index 085acb8..4e9218c 100644
--- a/media/libstagefright/codecs/aacenc/src/psy_main.c
+++ b/media/libstagefright/codecs/aacenc/src/psy_main.c
@@ -658,7 +658,8 @@
Word32 normEnergyShift = (psyData->mdctScale + 1) << 1; /* in reference code, mdct spectrum must be multipied with 2, so +1 */
Word32 clipEnergy = hPsyConfShort->clipEnergy >> normEnergyShift;
Word32 wOffset = 0;
- Word32 *data0, *data1;
+ Word32 *data0;
+ const Word32 *data1;
for(w = 0; w < TRANS_FAC; w++) {
Word32 i, tdata;
diff --git a/media/libstagefright/codecs/aacenc/src/quantize.c b/media/libstagefright/codecs/aacenc/src/quantize.c
index 54add2f..0d0f550 100644
--- a/media/libstagefright/codecs/aacenc/src/quantize.c
+++ b/media/libstagefright/codecs/aacenc/src/quantize.c
@@ -110,7 +110,7 @@
Word32 m = gain&3;
Word32 g = (gain >> 2) + 4;
Word32 mdctSpeL;
- Word16 *pquat;
+ const Word16 *pquat;
/* gain&3 */
pquat = quantBorders[m];
@@ -333,7 +333,7 @@
Word32 m = gain&3;
Word32 g = (gain >> 2) + 4;
Word32 g2 = (g << 1) + 1;
- Word16 *pquat, *repquat;
+ const Word16 *pquat, *repquat;
/* gain&3 */
pquat = quantBorders[m];
diff --git a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
index bd99b30..4135f30 100644
--- a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
+++ b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp
@@ -299,7 +299,7 @@
t0 += (Word32) * (p_f) << 13;
- if ((UWord32)(t0 - 0xfe000000L) < 0x01ffffffL - 0xfe000000L)
+ if ((UWord32)(t0 - 0xfe000000L) < (UWord32)0x03ffffffL)
{
cheb = (Word16)(t0 >> 10);
}
diff --git a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
index dedf91a..d626de3 100644
--- a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
+++ b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp
@@ -552,10 +552,10 @@
else
{
*(p_sign--) = -32767; /* sign = -1 */
- cor = - (cor);
+ cor = negate(cor);
/* modify dn[] according to the fixed sign */
- dn[i] = - val;
+ dn[i] = negate(val);
}
*(p_en--) = cor;
diff --git a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
index cd8bd4e..14ce266 100644
--- a/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/SwipeHelper.java
@@ -236,10 +236,6 @@
public void onAnimationEnd(Animator animation) {
mCallback.onChildDismissed(view);
animView.setLayerType(View.LAYER_TYPE_NONE, null);
- // Restore the alpha/translation parameters to what they were before swiping
- // (for when these items are recycled)
- animView.setAlpha(1f);
- setTranslation(animView, 0f);
}
});
anim.addUpdateListener(new AnimatorUpdateListener() {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
index 4718a17..4dc3e33 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsHorizontalScrollView.java
@@ -181,6 +181,11 @@
mLinearLayout.removeView(v);
mCallback.handleSwipe(v);
v.setActivated(false);
+ // Restore the alpha/translation parameters to what they were before swiping
+ // (for when these items are recycled)
+ View contentView = getChildContentView(v);
+ contentView.setAlpha(1f);
+ contentView.setTranslationY(0);
}
public void onBeginDrag(View v) {
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
index 0605c4c..19fce37 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsVerticalScrollView.java
@@ -187,6 +187,11 @@
mLinearLayout.removeView(v);
mCallback.handleSwipe(v);
v.setActivated(false);
+ // Restore the alpha/translation parameters to what they were before swiping
+ // (for when these items are recycled)
+ View contentView = getChildContentView(v);
+ contentView.setAlpha(1f);
+ contentView.setTranslationX(0);
}
public void onBeginDrag(View v) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
index 3d904ee..6fbcd64 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationData.java
@@ -47,12 +47,13 @@
}
private final ArrayList<Entry> mEntries = new ArrayList<Entry>();
private final Comparator<Entry> mEntryCmp = new Comparator<Entry>() {
+ // sort first by score, then by when
public int compare(Entry a, Entry b) {
final StatusBarNotification na = a.notification;
final StatusBarNotification nb = b.notification;
- int priDiff = na.priority - nb.priority;
- return (priDiff != 0)
- ? priDiff
+ int d = na.score - nb.score;
+ return (d != 0)
+ ? d
: (int)(na.notification.when - nb.notification.when);
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index b3cef90..401553f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -232,6 +232,11 @@
private int mNavigationIconHints = 0;
+ // TODO(dsandler): codify this stuff in NotificationManager's header somewhere
+ private int mDisplayMinScore = Notification.PRIORITY_LOW * 10;
+ private int mIntruderMinScore = Notification.PRIORITY_HIGH * 10;
+ private int mIntruderInImmersiveMinScore = Notification.PRIORITY_HIGH * 10 + 5;
+
private class ExpandedDialog extends Dialog {
ExpandedDialog(Context context) {
super(context, com.android.internal.R.style.Theme_Translucent_NoTitleBar);
@@ -540,6 +545,7 @@
}
public void addNotification(IBinder key, StatusBarNotification notification) {
+ /* if (DEBUG) */ Slog.d(TAG, "addNotification score=" + notification.score);
StatusBarIconView iconView = addNotificationViews(key, notification);
if (iconView == null) return;
@@ -551,31 +557,30 @@
}
} catch (RemoteException ex) {
}
- if (immersive) {
- if ((notification.notification.flags & Notification.FLAG_HIGH_PRIORITY) != 0) {
- Slog.d(TAG, "Presenting high-priority notification in immersive activity");
- // special new transient ticker mode
- // 1. Populate mIntruderAlertView
+ if ((notification.score >= mIntruderInImmersiveMinScore)
+ || (!immersive && (notification.score > mIntruderMinScore))) {
+ Slog.d(TAG, "Presenting high-priority notification");
+ // special new transient ticker mode
+ // 1. Populate mIntruderAlertView
- ImageView alertIcon = (ImageView) mIntruderAlertView.findViewById(R.id.alertIcon);
- TextView alertText = (TextView) mIntruderAlertView.findViewById(R.id.alertText);
- alertIcon.setImageDrawable(StatusBarIconView.getIcon(
- alertIcon.getContext(),
- iconView.getStatusBarIcon()));
- alertText.setText(notification.notification.tickerText);
+ ImageView alertIcon = (ImageView) mIntruderAlertView.findViewById(R.id.alertIcon);
+ TextView alertText = (TextView) mIntruderAlertView.findViewById(R.id.alertText);
+ alertIcon.setImageDrawable(StatusBarIconView.getIcon(
+ alertIcon.getContext(),
+ iconView.getStatusBarIcon()));
+ alertText.setText(notification.notification.tickerText);
- View button = mIntruderAlertView.findViewById(R.id.intruder_alert_content);
- button.setOnClickListener(
- new NotificationClicker(notification.notification.contentIntent,
- notification.pkg, notification.tag, notification.id));
+ View button = mIntruderAlertView.findViewById(R.id.intruder_alert_content);
+ button.setOnClickListener(
+ new NotificationClicker(notification.notification.contentIntent,
+ notification.pkg, notification.tag, notification.id));
- // 2. Animate mIntruderAlertView in
- mHandler.sendEmptyMessage(MSG_SHOW_INTRUDER);
+ // 2. Animate mIntruderAlertView in
+ mHandler.sendEmptyMessage(MSG_SHOW_INTRUDER);
- // 3. Set alarm to age the notification off (TODO)
- mHandler.removeMessages(MSG_HIDE_INTRUDER);
- mHandler.sendEmptyMessageDelayed(MSG_HIDE_INTRUDER, INTRUDER_ALERT_DECAY_MS);
- }
+ // 3. Set alarm to age the notification off (TODO)
+ mHandler.removeMessages(MSG_HIDE_INTRUDER);
+ mHandler.sendEmptyMessageDelayed(MSG_HIDE_INTRUDER, INTRUDER_ALERT_DECAY_MS);
} else if (notification.notification.fullScreenIntent != null) {
// not immersive & a full-screen alert should be shown
Slog.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
@@ -632,8 +637,8 @@
&& oldContentView.getLayoutId() == contentView.getLayoutId();
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
- && notification.priority == oldNotification.priority;
- // priority now encompasses isOngoing()
+ && notification.score == oldNotification.score;
+ // score now encompasses/supersedes isOngoing()
boolean updateTicker = notification.notification.tickerText != null
&& !TextUtils.equals(notification.notification.tickerText,
@@ -725,69 +730,6 @@
}
- View[] makeNotificationView(StatusBarNotification notification, ViewGroup parent) {
- Notification n = notification.notification;
- RemoteViews remoteViews = n.contentView;
- if (remoteViews == null) {
- return null;
- }
-
- // create the row view
- LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
- View row = inflater.inflate(R.layout.status_bar_notification_row, parent, false);
-
- // wire up the veto button
- View vetoButton = updateNotificationVetoButton(row, notification);
- vetoButton.setContentDescription(mContext.getString(
- R.string.accessibility_remove_notification));
-
- // the large icon
- ImageView largeIcon = (ImageView)row.findViewById(R.id.large_icon);
- if (notification.notification.largeIcon != null) {
- largeIcon.setImageBitmap(notification.notification.largeIcon);
- } else {
- largeIcon.getLayoutParams().width = 0;
- largeIcon.setVisibility(View.INVISIBLE);
- }
-
- // bind the click event to the content area
- ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
- content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
- content.setOnFocusChangeListener(mFocusChangeListener);
- PendingIntent contentIntent = n.contentIntent;
- if (contentIntent != null) {
- final View.OnClickListener listener = new NotificationClicker(contentIntent,
- notification.pkg, notification.tag, notification.id);
- largeIcon.setOnClickListener(listener);
- content.setOnClickListener(listener);
- } else {
- largeIcon.setOnClickListener(null);
- content.setOnClickListener(null);
- }
-
- View expanded = null;
- Exception exception = null;
- try {
- expanded = remoteViews.apply(mContext, content);
- }
- catch (RuntimeException e) {
- exception = e;
- }
- if (expanded == null) {
- String ident = notification.pkg + "/0x" + Integer.toHexString(notification.id);
- Slog.e(TAG, "couldn't inflate view for notification " + ident, exception);
- return null;
- } else {
- content.addView(expanded);
- row.setDrawingCacheEnabled(true);
- }
-
- applyLegacyRowBackground(notification, content);
-
- return new View[] { row, content, expanded };
- }
-
StatusBarIconView addNotificationViews(IBinder key, StatusBarNotification notification) {
if (DEBUG) {
Slog.d(TAG, "addNotificationViews(key=" + key + ", notification=" + notification);
@@ -850,7 +792,7 @@
for (int i=0; i<toShow.size(); i++) {
View v = toShow.get(i);
if (v.getParent() == null) {
- mPile.addView(v, 0); // the notification shade has newest at the top
+ mPile.addView(v, i);
}
}
}
@@ -1807,7 +1749,7 @@
NotificationData.Entry e = mNotificationData.get(i);
pw.println(" [" + i + "] key=" + e.key + " icon=" + e.icon);
StatusBarNotification n = e.notification;
- pw.println(" pkg=" + n.pkg + " id=" + n.id + " priority=" + n.priority);
+ pw.println(" pkg=" + n.pkg + " id=" + n.id + " score=" + n.score);
pw.println(" notification=" + n.notification);
pw.println(" tickerText=\"" + n.notification.tickerText + "\"");
}
@@ -2317,6 +2259,30 @@
vib.vibrate(250);
}
+ public int getScoreThreshold() {
+ return mDisplayMinScore;
+ }
+
+ public void setScoreThreshold(int score) {
+ // XXX HAX
+ if (mDisplayMinScore != score) {
+ this.mDisplayMinScore = score;
+ applyScoreThreshold();
+ }
+ }
+
+ private void applyScoreThreshold() {
+ int N = mNotificationData.size();
+ for (int i=0; i<N; i++) {
+ NotificationData.Entry entry = mNotificationData.get(i);
+ int vis = (entry.notification.score < mDisplayMinScore)
+ ? View.GONE
+ : View.VISIBLE;
+ entry.row.setVisibility(vis);
+ entry.icon.setVisibility(vis);
+ }
+ }
+
Runnable mStartTracing = new Runnable() {
public void run() {
vibrate();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
index bb326fe..a60bba7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationController.java
@@ -99,13 +99,14 @@
// Notification.Builder will helpfully fill these out for you no matter what you do
n.tickerView = null;
n.tickerText = null;
+
+ n.priority = Notification.PRIORITY_HIGH;
int[] idOut = new int[1];
- mNotificationService.enqueueNotificationWithTagPriority(
+ mNotificationService.enqueueNotificationWithTag(
mContext.getPackageName(),
null,
GPS_NOTIFICATION_ID,
- StatusBarNotification.PRIORITY_SYSTEM, // !!!1!one!!!
n,
idOut);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
index 5151cad..6e56cd4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java
@@ -859,8 +859,8 @@
&& oldContentView.getLayoutId() == contentView.getLayoutId();
ViewGroup rowParent = (ViewGroup) oldEntry.row.getParent();
boolean orderUnchanged = notification.notification.when==oldNotification.notification.when
- && notification.priority == oldNotification.priority;
- // priority now encompasses isOngoing()
+ && notification.score == oldNotification.score;
+ // score now encompasses/supersedes isOngoing()
boolean updateTicker = notification.notification.tickerText != null
&& !TextUtils.equals(notification.notification.tickerText,
oldEntry.notification.notification.tickerText);
@@ -1688,7 +1688,7 @@
mNotificationDNDDummyEntry = new NotificationData.Entry(
null,
- new StatusBarNotification("", 0, "", 0, 0, dndNotification),
+ new StatusBarNotification("", 0, "", 0, 0, Notification.PRIORITY_MAX, dndNotification),
iconView);
mIconLayout.addView(iconView, params);
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 6256951..2c3329e 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -432,6 +432,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
+ // FIXME dead, remove from IAudioFlinger
uint32_t flags,
const sp<IMemory>& sharedBuffer,
audio_io_handle_t output,
@@ -1932,6 +1933,46 @@
delete mAudioMixer;
}
+class CpuStats {
+public:
+ void sample();
+#ifdef DEBUG_CPU_USAGE
+private:
+ ThreadCpuUsage mCpu;
+#endif
+};
+
+void CpuStats::sample() {
+#ifdef DEBUG_CPU_USAGE
+ const CentralTendencyStatistics& stats = mCpu.statistics();
+ mCpu.sampleAndEnable();
+ unsigned n = stats.n();
+ // mCpu.elapsed() is expensive, so don't call it every loop
+ if ((n & 127) == 1) {
+ long long elapsed = mCpu.elapsed();
+ if (elapsed >= DEBUG_CPU_USAGE * 1000000000LL) {
+ double perLoop = elapsed / (double) n;
+ double perLoop100 = perLoop * 0.01;
+ double mean = stats.mean();
+ double stddev = stats.stddev();
+ double minimum = stats.minimum();
+ double maximum = stats.maximum();
+ mCpu.resetStatistics();
+ ALOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
+ elapsed * .000000001, n, perLoop * .000001,
+ mean * .001,
+ stddev * .001,
+ minimum * .001,
+ maximum * .001,
+ mean / perLoop100,
+ stddev / perLoop100,
+ minimum / perLoop100,
+ maximum / perLoop100);
+ }
+ }
+#endif
+};
+
bool AudioFlinger::MixerThread::threadLoop()
{
Vector< sp<Track> > tracksToRemove;
@@ -1950,42 +1991,13 @@
uint32_t sleepTime = idleSleepTime;
uint32_t sleepTimeShift = 0;
Vector< sp<EffectChain> > effectChains;
-#ifdef DEBUG_CPU_USAGE
- ThreadCpuUsage cpu;
- const CentralTendencyStatistics& stats = cpu.statistics();
-#endif
+ CpuStats cpuStats;
acquireWakeLock();
while (!exitPending())
{
-#ifdef DEBUG_CPU_USAGE
- cpu.sampleAndEnable();
- unsigned n = stats.n();
- // cpu.elapsed() is expensive, so don't call it every loop
- if ((n & 127) == 1) {
- long long elapsed = cpu.elapsed();
- if (elapsed >= DEBUG_CPU_USAGE * 1000000000LL) {
- double perLoop = elapsed / (double) n;
- double perLoop100 = perLoop * 0.01;
- double mean = stats.mean();
- double stddev = stats.stddev();
- double minimum = stats.minimum();
- double maximum = stats.maximum();
- cpu.resetStatistics();
- ALOGI("CPU usage over past %.1f secs (%u mixer loops at %.1f mean ms per loop):\n us per mix loop: mean=%.0f stddev=%.0f min=%.0f max=%.0f\n %% of wall: mean=%.1f stddev=%.1f min=%.1f max=%.1f",
- elapsed * .000000001, n, perLoop * .000001,
- mean * .001,
- stddev * .001,
- minimum * .001,
- maximum * .001,
- mean / perLoop100,
- stddev / perLoop100,
- minimum / perLoop100,
- maximum / perLoop100);
- }
- }
-#endif
+ cpuStats.sample();
processConfigEvents();
mixerStatus = MIXER_IDLE;
@@ -3306,7 +3318,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
const sp<IMemory>& sharedBuffer,
int sessionId)
: RefBase(),
@@ -3318,7 +3329,7 @@
mFrameCount(0),
mState(IDLE),
mFormat(format),
- mFlags(flags & ~SYSTEM_FLAGS_MASK),
+ mStepServerFailed(false),
mSessionId(sessionId)
// mChannelCount
// mChannelMask
@@ -3413,7 +3424,7 @@
result = cblk->stepServer(mFrameCount);
if (!result) {
ALOGV("stepServer failed acquiring cblk mutex");
- mFlags |= STEPSERVER_FAILED;
+ mStepServerFailed = true;
}
return result;
}
@@ -3425,7 +3436,7 @@
cblk->server = 0;
cblk->userBase = 0;
cblk->serverBase = 0;
- mFlags &= (uint32_t)(~SYSTEM_FLAGS_MASK);
+ mStepServerFailed = false;
ALOGV("TrackBase::reset");
}
@@ -3465,7 +3476,7 @@
int frameCount,
const sp<IMemory>& sharedBuffer,
int sessionId)
- : TrackBase(thread, client, sampleRate, format, channelMask, frameCount, 0, sharedBuffer, sessionId),
+ : TrackBase(thread, client, sampleRate, format, channelMask, frameCount, sharedBuffer, sessionId),
mMute(false), mSharedBuffer(sharedBuffer), mName(-1), mMainBuffer(NULL), mAuxBuffer(NULL),
mAuxEffectId(0), mHasVolumeController(false)
{
@@ -3556,10 +3567,10 @@
uint32_t framesReq = buffer->frameCount;
// Check if last stepServer failed, try to step now
- if (mFlags & TrackBase::STEPSERVER_FAILED) {
+ if (mStepServerFailed) {
if (!step()) goto getNextBuffer_exit;
ALOGV("stepServer recovered");
- mFlags &= ~TrackBase::STEPSERVER_FAILED;
+ mStepServerFailed = false;
}
framesReady = cblk->framesReady();
@@ -4155,10 +4166,9 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
int sessionId)
: TrackBase(thread, client, sampleRate, format,
- channelMask, frameCount, flags, 0, sessionId),
+ channelMask, frameCount, 0 /*sharedBuffer*/, sessionId),
mOverflow(false)
{
if (mCblk != NULL) {
@@ -4188,10 +4198,10 @@
uint32_t framesReq = buffer->frameCount;
// Check if last stepServer failed, try to step now
- if (mFlags & TrackBase::STEPSERVER_FAILED) {
+ if (mStepServerFailed) {
if (!step()) goto getNextBuffer_exit;
ALOGV("stepServer recovered");
- mFlags &= ~TrackBase::STEPSERVER_FAILED;
+ mStepServerFailed = false;
}
framesAvail = cblk->framesAvailable_l();
@@ -4654,6 +4664,7 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
+ // FIXME dead, remove from IAudioFlinger
uint32_t flags,
int *sessionId,
status_t *status)
@@ -4698,7 +4709,6 @@
format,
channelMask,
frameCount,
- flags,
lSessionId,
&lStatus);
}
@@ -4992,7 +5002,6 @@
audio_format_t format,
int channelMask,
int frameCount,
- uint32_t flags,
int sessionId,
status_t *status)
{
@@ -5009,7 +5018,7 @@
Mutex::Autolock _l(mLock);
track = new RecordTrack(this, client, sampleRate,
- format, channelMask, frameCount, flags, sessionId);
+ format, channelMask, frameCount, sessionId);
if (track->getCblk() == 0) {
lStatus = NO_MEMORY;
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index 1a52de5..a2ab680 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -312,19 +312,12 @@
PAUSED
};
- enum track_flags {
- STEPSERVER_FAILED = 0x01, // StepServer could not acquire cblk->lock mutex
- SYSTEM_FLAGS_MASK = 0x0000ffffUL,
- // The upper 16 bits are used for track-specific flags.
- };
-
TrackBase(ThreadBase *thread,
const sp<Client>& client,
uint32_t sampleRate,
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
const sp<IMemory>& sharedBuffer,
int sessionId);
virtual ~TrackBase();
@@ -384,7 +377,7 @@
// we don't really need a lock for these
track_state mState;
const audio_format_t mFormat;
- uint32_t mFlags;
+ bool mStepServerFailed;
const int mSessionId;
uint8_t mChannelCount;
uint32_t mChannelMask;
@@ -1048,7 +1041,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
int sessionId);
virtual ~RecordTrack();
@@ -1094,7 +1086,6 @@
audio_format_t format,
int channelMask,
int frameCount,
- uint32_t flags,
int sessionId,
status_t *status);
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index b3eceb1..624ee98 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -146,19 +146,18 @@
final int id;
final int uid;
final int initialPid;
- final int priority;
final Notification notification;
+ final int score;
IBinder statusBarKey;
- NotificationRecord(String pkg, String tag, int id, int uid, int initialPid, int priority,
- Notification notification)
+ NotificationRecord(String pkg, String tag, int id, int uid, int initialPid, int score, Notification notification)
{
this.pkg = pkg;
this.tag = tag;
this.id = id;
this.uid = uid;
this.initialPid = initialPid;
- this.priority = priority;
+ this.score = score;
this.notification = notification;
}
@@ -166,6 +165,8 @@
pw.println(prefix + this);
pw.println(prefix + " icon=0x" + Integer.toHexString(notification.icon)
+ " / " + idDebugString(baseContext, this.pkg, notification.icon));
+ pw.println(prefix + " pri=" + notification.priority);
+ pw.println(prefix + " score=" + this.score);
pw.println(prefix + " contentIntent=" + notification.contentIntent);
pw.println(prefix + " deleteIntent=" + notification.deleteIntent);
pw.println(prefix + " tickerText=" + notification.tickerText);
@@ -187,7 +188,7 @@
+ " pkg=" + pkg
+ " id=" + Integer.toHexString(id)
+ " tag=" + tag
- + " pri=" + priority
+ + " score=" + score
+ "}";
}
}
@@ -660,28 +661,17 @@
enqueueNotificationInternal(pkg, Binder.getCallingUid(), Binder.getCallingPid(),
tag, id, notification, idOut);
}
-
- public void enqueueNotificationWithTagPriority(String pkg, String tag, int id, int priority,
- Notification notification, int[] idOut)
- {
- enqueueNotificationInternal(pkg, Binder.getCallingUid(), Binder.getCallingPid(),
- tag, id, priority, notification, idOut);
+
+ private final static int clamp(int x, int low, int high) {
+ return (x < low) ? low : ((x > high) ? high : x);
}
+
// Not exposed via Binder; for system use only (otherwise malicious apps could spoof the
// uid/pid of another application)
public void enqueueNotificationInternal(String pkg, int callingUid, int callingPid,
String tag, int id, Notification notification, int[] idOut)
{
- enqueueNotificationInternal(pkg, callingUid, callingPid, tag, id,
- ((notification.flags & Notification.FLAG_ONGOING_EVENT) != 0)
- ? StatusBarNotification.PRIORITY_ONGOING
- : StatusBarNotification.PRIORITY_NORMAL,
- notification, idOut);
- }
- public void enqueueNotificationInternal(String pkg, int callingUid, int callingPid,
- String tag, int id, int priority, Notification notification, int[] idOut)
- {
checkIncomingCall(pkg);
// Limit the number of notifications that any given package except the android
@@ -723,10 +713,35 @@
}
}
+ // === Scoring ===
+
+ // 0. Sanitize inputs
+ notification.priority = clamp(notification.priority, Notification.PRIORITY_MIN, Notification.PRIORITY_MAX);
+ // Migrate notification flags to scores
+ if (0 != (notification.flags & Notification.FLAG_HIGH_PRIORITY)) {
+ if (notification.priority < Notification.PRIORITY_MAX) notification.priority = Notification.PRIORITY_MAX;
+ } else if (0 != (notification.flags & Notification.FLAG_ONGOING_EVENT)) {
+ if (notification.priority < Notification.PRIORITY_HIGH) notification.priority = Notification.PRIORITY_HIGH;
+ }
+
+ // 1. initial score: buckets of 10, around the app
+ int score = notification.priority * 10; //[-20..20]
+
+ // 2. Consult oracles (external heuristics)
+ // TODO(dsandler): oracles
+
+ // 3. Apply local heuristics & overrides
+
+ // blocked apps
+ // TODO(dsandler): add block db
+ if (pkg.startsWith("com.test.spammer.")) {
+ score = -1000;
+ }
+
synchronized (mNotificationList) {
NotificationRecord r = new NotificationRecord(pkg, tag, id,
callingUid, callingPid,
- priority,
+ score,
notification);
NotificationRecord old = null;
@@ -752,9 +767,7 @@
if (notification.icon != 0) {
StatusBarNotification n = new StatusBarNotification(pkg, id, tag,
- r.uid, r.initialPid, notification);
- n.priority = r.priority;
-
+ r.uid, r.initialPid, score, notification);
if (old != null && old.statusBarKey != null) {
r.statusBarKey = old.statusBarKey;
long identity = Binder.clearCallingIdentity();
diff --git a/telephony/java/android/telephony/ServiceState.java b/telephony/java/android/telephony/ServiceState.java
index 32a6975..9d88a18 100644
--- a/telephony/java/android/telephony/ServiceState.java
+++ b/telephony/java/android/telephony/ServiceState.java
@@ -64,44 +64,47 @@
/**
* Available radio technologies for GSM, UMTS and CDMA.
+ * Duplicates the constants from hardware/radio/include/ril.h
+ * This should only be used by agents working with the ril. Others
+ * should use the equivalent TelephonyManager.NETWORK_TYPE_*
*/
/** @hide */
- public static final int RADIO_TECHNOLOGY_UNKNOWN = 0;
+ public static final int RIL_RADIO_TECHNOLOGY_UNKNOWN = 0;
/** @hide */
- public static final int RADIO_TECHNOLOGY_GPRS = 1;
+ public static final int RIL_RADIO_TECHNOLOGY_GPRS = 1;
/** @hide */
- public static final int RADIO_TECHNOLOGY_EDGE = 2;
+ public static final int RIL_RADIO_TECHNOLOGY_EDGE = 2;
/** @hide */
- public static final int RADIO_TECHNOLOGY_UMTS = 3;
+ public static final int RIL_RADIO_TECHNOLOGY_UMTS = 3;
/** @hide */
- public static final int RADIO_TECHNOLOGY_IS95A = 4;
+ public static final int RIL_RADIO_TECHNOLOGY_IS95A = 4;
/** @hide */
- public static final int RADIO_TECHNOLOGY_IS95B = 5;
+ public static final int RIL_RADIO_TECHNOLOGY_IS95B = 5;
/** @hide */
- public static final int RADIO_TECHNOLOGY_1xRTT = 6;
+ public static final int RIL_RADIO_TECHNOLOGY_1xRTT = 6;
/** @hide */
- public static final int RADIO_TECHNOLOGY_EVDO_0 = 7;
+ public static final int RIL_RADIO_TECHNOLOGY_EVDO_0 = 7;
/** @hide */
- public static final int RADIO_TECHNOLOGY_EVDO_A = 8;
+ public static final int RIL_RADIO_TECHNOLOGY_EVDO_A = 8;
/** @hide */
- public static final int RADIO_TECHNOLOGY_HSDPA = 9;
+ public static final int RIL_RADIO_TECHNOLOGY_HSDPA = 9;
/** @hide */
- public static final int RADIO_TECHNOLOGY_HSUPA = 10;
+ public static final int RIL_RADIO_TECHNOLOGY_HSUPA = 10;
/** @hide */
- public static final int RADIO_TECHNOLOGY_HSPA = 11;
+ public static final int RIL_RADIO_TECHNOLOGY_HSPA = 11;
/** @hide */
- public static final int RADIO_TECHNOLOGY_EVDO_B = 12;
+ public static final int RIL_RADIO_TECHNOLOGY_EVDO_B = 12;
/** @hide */
- public static final int RADIO_TECHNOLOGY_EHRPD = 13;
+ public static final int RIL_RADIO_TECHNOLOGY_EHRPD = 13;
/** @hide */
- public static final int RADIO_TECHNOLOGY_LTE = 14;
+ public static final int RIL_RADIO_TECHNOLOGY_LTE = 14;
/** @hide */
- public static final int RADIO_TECHNOLOGY_HSPAP = 15;
+ public static final int RIL_RADIO_TECHNOLOGY_HSPAP = 15;
/**
* GSM radio technology only supports voice. It does not support data.
* @hide
*/
- public static final int RADIO_TECHNOLOGY_GSM = 16;
+ public static final int RIL_RADIO_TECHNOLOGY_GSM = 16;
/**
* Available registration states for GSM, UMTS and CDMA.
@@ -400,59 +403,59 @@
*
* @hide
*/
- public static String radioTechnologyToString(int rt) {
+ public static String rilRadioTechnologyToString(int rt) {
String rtString;
switch(rt) {
- case 0:
+ case RIL_RADIO_TECHNOLOGY_UNKNOWN:
rtString = "Unknown";
break;
- case 1:
+ case RIL_RADIO_TECHNOLOGY_GPRS:
rtString = "GPRS";
break;
- case 2:
+ case RIL_RADIO_TECHNOLOGY_EDGE:
rtString = "EDGE";
break;
- case 3:
+ case RIL_RADIO_TECHNOLOGY_UMTS:
rtString = "UMTS";
break;
- case 4:
+ case RIL_RADIO_TECHNOLOGY_IS95A:
rtString = "CDMA-IS95A";
break;
- case 5:
+ case RIL_RADIO_TECHNOLOGY_IS95B:
rtString = "CDMA-IS95B";
break;
- case 6:
+ case RIL_RADIO_TECHNOLOGY_1xRTT:
rtString = "1xRTT";
break;
- case 7:
+ case RIL_RADIO_TECHNOLOGY_EVDO_0:
rtString = "EvDo-rev.0";
break;
- case 8:
+ case RIL_RADIO_TECHNOLOGY_EVDO_A:
rtString = "EvDo-rev.A";
break;
- case 9:
+ case RIL_RADIO_TECHNOLOGY_HSDPA:
rtString = "HSDPA";
break;
- case 10:
+ case RIL_RADIO_TECHNOLOGY_HSUPA:
rtString = "HSUPA";
break;
- case 11:
+ case RIL_RADIO_TECHNOLOGY_HSPA:
rtString = "HSPA";
break;
- case 12:
+ case RIL_RADIO_TECHNOLOGY_EVDO_B:
rtString = "EvDo-rev.B";
break;
- case 13:
+ case RIL_RADIO_TECHNOLOGY_EHRPD:
rtString = "eHRPD";
break;
- case 14:
+ case RIL_RADIO_TECHNOLOGY_LTE:
rtString = "LTE";
break;
- case 15:
+ case RIL_RADIO_TECHNOLOGY_HSPAP:
rtString = "HSPAP";
break;
- case 16:
+ case RIL_RADIO_TECHNOLOGY_GSM:
rtString = "GSM";
break;
default:
@@ -460,12 +463,12 @@
Log.w(LOG_TAG, "Unexpected radioTechnology=" + rt);
break;
}
- return rtString + ":" + rt;
+ return rtString;
}
@Override
public String toString() {
- String radioTechnology = radioTechnologyToString(mRadioTechnology);
+ String radioTechnology = rilRadioTechnologyToString(mRadioTechnology);
return (mState + " " + (mRoaming ? "roaming" : "home")
+ " " + mOperatorAlphaLong
@@ -644,11 +647,48 @@
}
/** @hide */
- public int getRadioTechnology() {
+ public int getRilRadioTechnology() {
return this.mRadioTechnology;
}
/** @hide */
+ public int getNetworkType() {
+ switch(mRadioTechnology) {
+ case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS:
+ return TelephonyManager.NETWORK_TYPE_GPRS;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_EDGE:
+ return TelephonyManager.NETWORK_TYPE_EDGE;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_UMTS:
+ return TelephonyManager.NETWORK_TYPE_UMTS;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA:
+ return TelephonyManager.NETWORK_TYPE_HSDPA;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA:
+ return TelephonyManager.NETWORK_TYPE_HSUPA;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_HSPA:
+ return TelephonyManager.NETWORK_TYPE_HSPA;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_IS95A:
+ case ServiceState.RIL_RADIO_TECHNOLOGY_IS95B:
+ return TelephonyManager.NETWORK_TYPE_CDMA;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT:
+ return TelephonyManager.NETWORK_TYPE_1xRTT;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0:
+ return TelephonyManager.NETWORK_TYPE_EVDO_0;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A:
+ return TelephonyManager.NETWORK_TYPE_EVDO_A;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B:
+ return TelephonyManager.NETWORK_TYPE_EVDO_B;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD:
+ return TelephonyManager.NETWORK_TYPE_EHRPD;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_LTE:
+ return TelephonyManager.NETWORK_TYPE_LTE;
+ case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP:
+ return TelephonyManager.NETWORK_TYPE_HSPAP;
+ default:
+ return TelephonyManager.NETWORK_TYPE_UNKNOWN;
+ }
+ }
+
+ /** @hide */
public int getCssIndicator() {
return this.mCssIndicator ? 1 : 0;
}
@@ -665,25 +705,25 @@
/** @hide */
public static boolean isGsm(int radioTechnology) {
- return radioTechnology == RADIO_TECHNOLOGY_GPRS
- || radioTechnology == RADIO_TECHNOLOGY_EDGE
- || radioTechnology == RADIO_TECHNOLOGY_UMTS
- || radioTechnology == RADIO_TECHNOLOGY_HSDPA
- || radioTechnology == RADIO_TECHNOLOGY_HSUPA
- || radioTechnology == RADIO_TECHNOLOGY_HSPA
- || radioTechnology == RADIO_TECHNOLOGY_LTE
- || radioTechnology == RADIO_TECHNOLOGY_HSPAP
- || radioTechnology == RADIO_TECHNOLOGY_GSM;
+ return radioTechnology == RIL_RADIO_TECHNOLOGY_GPRS
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_EDGE
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_UMTS
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_HSDPA
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_HSUPA
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_HSPA
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_HSPAP
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_GSM;
}
/** @hide */
public static boolean isCdma(int radioTechnology) {
- return radioTechnology == RADIO_TECHNOLOGY_IS95A
- || radioTechnology == RADIO_TECHNOLOGY_IS95B
- || radioTechnology == RADIO_TECHNOLOGY_1xRTT
- || radioTechnology == RADIO_TECHNOLOGY_EVDO_0
- || radioTechnology == RADIO_TECHNOLOGY_EVDO_A
- || radioTechnology == RADIO_TECHNOLOGY_EVDO_B
- || radioTechnology == RADIO_TECHNOLOGY_EHRPD;
+ return radioTechnology == RIL_RADIO_TECHNOLOGY_IS95A
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_IS95B
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_1xRTT
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_0
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_A
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B
+ || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD;
}
}
diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java
index d0e304f..238afbe 100644
--- a/telephony/java/com/android/internal/telephony/DataConnection.java
+++ b/telephony/java/com/android/internal/telephony/DataConnection.java
@@ -355,14 +355,14 @@
if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp);
}
- protected int getRadioTechnology(int defaultRadioTechnology) {
- int radioTechnology;
+ protected int getRilRadioTechnology(int defaultRilRadioTechnology) {
+ int rilRadioTechnology;
if (mRilVersion < 6) {
- radioTechnology = defaultRadioTechnology;
+ rilRadioTechnology = defaultRilRadioTechnology;
} else {
- radioTechnology = phone.getServiceState().getRadioTechnology() + 2;
+ rilRadioTechnology = phone.getServiceState().getRilRadioTechnology() + 2;
}
- return radioTechnology;
+ return rilRadioTechnology;
}
/*
diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
index 2b9fb91..fa90f1c 100644
--- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java
@@ -40,6 +40,7 @@
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.telephony.ServiceState;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
@@ -1167,15 +1168,14 @@
}
protected String getReryConfig(boolean forDefault) {
- int rt = mPhone.getServiceState().getRadioTechnology();
+ int nt = mPhone.getServiceState().getNetworkType();
- if ((rt == ServiceState.RADIO_TECHNOLOGY_IS95A) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_IS95B) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_1xRTT) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_EVDO_0) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_EVDO_A) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_EVDO_B) ||
- (rt == ServiceState.RADIO_TECHNOLOGY_EHRPD)) {
+ if ((nt == TelephonyManager.NETWORK_TYPE_CDMA) ||
+ (nt == TelephonyManager.NETWORK_TYPE_1xRTT) ||
+ (nt == TelephonyManager.NETWORK_TYPE_EVDO_0) ||
+ (nt == TelephonyManager.NETWORK_TYPE_EVDO_A) ||
+ (nt == TelephonyManager.NETWORK_TYPE_EVDO_B) ||
+ (nt == TelephonyManager.NETWORK_TYPE_EHRPD)) {
// CDMA variant
return SystemProperties.get("ro.cdma.data_retry_config");
} else {
diff --git a/telephony/java/com/android/internal/telephony/PhoneProxy.java b/telephony/java/com/android/internal/telephony/PhoneProxy.java
index 2931a02..1a8b3ca 100644
--- a/telephony/java/com/android/internal/telephony/PhoneProxy.java
+++ b/telephony/java/com/android/internal/telephony/PhoneProxy.java
@@ -149,7 +149,7 @@
logd("LTE ON CDMA property is set. Switch to CDMALTEPhone" +
" newVoiceRadioTech = " + newVoiceRadioTech +
" Active Phone = " + mActivePhone.getPhoneName());
- newVoiceRadioTech = ServiceState.RADIO_TECHNOLOGY_1xRTT;
+ newVoiceRadioTech = ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT;
}
} else {
if ((ServiceState.isCdma(newVoiceRadioTech) &&
@@ -165,7 +165,7 @@
}
}
- if (newVoiceRadioTech == ServiceState.RADIO_TECHNOLOGY_UNKNOWN) {
+ if (newVoiceRadioTech == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) {
// We need some voice phone object to be active always, so never
// delete the phone without anything to replace it with!
logd("Ignoring voice radio technology changed message. newVoiceRadioTech = Unknown."
diff --git a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
index 9c80de7..fd39e04 100644
--- a/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/ServiceStateTracker.java
@@ -54,10 +54,10 @@
protected boolean mDesiredPowerState;
/**
- * Values correspond to ServiceState.RADIO_TECHNOLOGY_ definitions.
+ * Values correspond to ServiceState.RIL_RADIO_TECHNOLOGY_ definitions.
*/
- protected int mRadioTechnology = 0;
- protected int mNewRadioTechnology = 0;
+ protected int mRilRadioTechnology = 0;
+ protected int mNewRilRadioTechnology = 0;
/**
* By default, strength polling is enabled. However, if we're
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
index a93d94f..64d018e 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java
@@ -86,7 +86,7 @@
Message msg = obtainMessage(EVENT_SETUP_DATA_CONNECTION_DONE, cp);
msg.obj = cp;
phone.mCM.setupDataCall(
- Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
+ Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_CDMA)),
Integer.toString(dataProfile),
null, null, null,
Integer.toString(RILConstants.SETUP_DATA_AUTH_PAP_CHAP),
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
index 7da23d0..cad2e22 100644
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaLteServiceStateTracker.java
@@ -185,19 +185,21 @@
@Override
protected void pollStateDone() {
- // determine data NetworkType from both LET and CDMA SS
+ // determine data RadioTechnology from both LET and CDMA SS
if (mLteSS.getState() == ServiceState.STATE_IN_SERVICE) {
//in LTE service
- newNetworkType = mLteSS.getRadioTechnology();
+ mNewRilRadioTechnology = mLteSS.getRilRadioTechnology();
mNewDataConnectionState = mLteSS.getState();
- newSS.setRadioTechnology(newNetworkType);
- log("pollStateDone LTE/eHRPD STATE_IN_SERVICE newNetworkType = " + newNetworkType);
+ newSS.setRadioTechnology(mNewRilRadioTechnology);
+ log("pollStateDone LTE/eHRPD STATE_IN_SERVICE mNewRilRadioTechnology = " +
+ mNewRilRadioTechnology);
} else {
// LTE out of service, get CDMA Service State
- newNetworkType = newSS.getRadioTechnology();
- mNewDataConnectionState = radioTechnologyToDataServiceState(newNetworkType);
- log("pollStateDone CDMA STATE_IN_SERVICE newNetworkType = " + newNetworkType +
- " mNewDataConnectionState = " + mNewDataConnectionState);
+ mNewRilRadioTechnology = newSS.getRilRadioTechnology();
+ mNewDataConnectionState = radioTechnologyToDataServiceState(mNewRilRadioTechnology);
+ log("pollStateDone CDMA STATE_IN_SERVICE mNewRilRadioTechnology = " +
+ mNewRilRadioTechnology + " mNewDataConnectionState = " +
+ mNewDataConnectionState);
}
// TODO: Add proper support for LTE Only, we should be looking at
@@ -239,7 +241,7 @@
boolean hasCdmaDataConnectionChanged =
mDataConnectionState != mNewDataConnectionState;
- boolean hasNetworkTypeChanged = networkType != newNetworkType;
+ boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@@ -251,20 +253,20 @@
boolean has4gHandoff =
mNewDataConnectionState == ServiceState.STATE_IN_SERVICE &&
- (((networkType == ServiceState.RADIO_TECHNOLOGY_LTE) &&
- (newNetworkType == ServiceState.RADIO_TECHNOLOGY_EHRPD)) ||
- ((networkType == ServiceState.RADIO_TECHNOLOGY_EHRPD) &&
- (newNetworkType == ServiceState.RADIO_TECHNOLOGY_LTE)));
+ (((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
+ (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) ||
+ ((mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD) &&
+ (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE)));
boolean hasMultiApnSupport =
- (((newNetworkType == ServiceState.RADIO_TECHNOLOGY_LTE) ||
- (newNetworkType == ServiceState.RADIO_TECHNOLOGY_EHRPD)) &&
- ((networkType != ServiceState.RADIO_TECHNOLOGY_LTE) &&
- (networkType != ServiceState.RADIO_TECHNOLOGY_EHRPD)));
+ (((mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
+ (mNewRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) &&
+ ((mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) &&
+ (mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)));
boolean hasLostMultiApnSupport =
- ((newNetworkType >= ServiceState.RADIO_TECHNOLOGY_IS95A) &&
- (newNetworkType <= ServiceState.RADIO_TECHNOLOGY_EVDO_A));
+ ((mNewRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_IS95A) &&
+ (mNewRilRadioTechnology <= ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A));
if (DBG) {
log("pollStateDone:"
@@ -273,7 +275,7 @@
+ " hasCdmaDataConnectionAttached=" + hasCdmaDataConnectionAttached
+ " hasCdmaDataConnectionDetached=" + hasCdmaDataConnectionDetached
+ " hasCdmaDataConnectionChanged=" + hasCdmaDataConnectionChanged
- + " hasNetworkTypeChanged = " + hasNetworkTypeChanged
+ + " hasRadioTechnologyChanged = " + hasRadioTechnologyChanged
+ " hasChanged=" + hasChanged
+ " hasRoamingOn=" + hasRoamingOn
+ " hasRoamingOff=" + hasRoamingOff
@@ -316,13 +318,14 @@
newCellLoc = tcl;
mDataConnectionState = mNewDataConnectionState;
- networkType = newNetworkType;
+ mRilRadioTechnology = mNewRilRadioTechnology;
+ mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
- if (hasNetworkTypeChanged) {
+ if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
- ServiceState.radioTechnologyToString(networkType));
+ ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@@ -404,7 +407,7 @@
mDetachedRegistrants.notifyRegistrants();
}
- if ((hasCdmaDataConnectionChanged || hasNetworkTypeChanged)) {
+ if ((hasCdmaDataConnectionChanged || hasRadioTechnologyChanged)) {
phone.notifyDataConnection(null);
}
@@ -446,7 +449,7 @@
int evdoSnr = ((ints[offset + 4] > 0) && (ints[offset + 4] <= 8)) ? ints[offset + 4]
: -1;
- if (networkType == ServiceState.RADIO_TECHNOLOGY_LTE) {
+ if (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
lteRssi = ints[offset+5];
lteRsrp = ints[offset+6];
lteRsrq = ints[offset+7];
@@ -454,7 +457,7 @@
lteCqi = ints[offset+9];
}
- if (networkType != ServiceState.RADIO_TECHNOLOGY_LTE) {
+ if (mRilRadioTechnology != ServiceState.RIL_RADIO_TECHNOLOGY_LTE) {
mSignalStrength = new SignalStrength(99, -1, cdmaDbm, cdmaEcio, evdoRssi, evdoEcio,
evdoSnr, false);
} else {
@@ -476,7 +479,7 @@
// Note: it needs to be confirmed which CDMA network types
// can support voice and data calls concurrently.
// For the time-being, the return value will be false.
- return (networkType == ServiceState.RADIO_TECHNOLOGY_LTE);
+ return (mRilRadioTechnology == ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
}
/**
diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
index 5115d76..75f5d47 100755
--- a/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/cdma/CdmaServiceStateTracker.java
@@ -86,12 +86,6 @@
private int mNitzUpdateDiff = SystemProperties.getInt("ro.nitz_update_diff",
NITZ_UPDATE_DIFF_DEFAULT);
- /**
- * Values correspond to ServiceState.RADIO_TECHNOLOGY_ definitions.
- */
- protected int networkType = 0;
- protected int newNetworkType = 0;
-
private boolean mCdmaRoaming = false;
private int mRoamingIndicator;
private boolean mIsInPrl;
@@ -556,10 +550,10 @@
/**
* Determine data network type based on radio technology.
*/
- protected void setCdmaTechnology(int radioTechnology){
- mNewDataConnectionState = radioTechnologyToDataServiceState(radioTechnology);
- newSS.setRadioTechnology(radioTechnology);
- newNetworkType = radioTechnology;
+ protected void setCdmaTechnology(int radioTech){
+ mNewDataConnectionState = radioTechnologyToDataServiceState(radioTech);
+ newSS.setRadioTechnology(radioTech);
+ mNewRilRadioTechnology = radioTech;
}
/**
@@ -925,7 +919,7 @@
boolean hasCdmaDataConnectionChanged =
mDataConnectionState != mNewDataConnectionState;
- boolean hasNetworkTypeChanged = networkType != newNetworkType;
+ boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@@ -955,15 +949,15 @@
newCellLoc = tcl;
mDataConnectionState = mNewDataConnectionState;
- networkType = newNetworkType;
+ mRilRadioTechnology = mNewRilRadioTechnology;
// this new state has been applied - forget it until we get a new new state
- newNetworkType = 0;
+ mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
- if (hasNetworkTypeChanged) {
+ if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
- ServiceState.radioTechnologyToString(networkType));
+ ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@@ -1030,7 +1024,7 @@
mDetachedRegistrants.notifyRegistrants();
}
- if (hasCdmaDataConnectionChanged || hasNetworkTypeChanged) {
+ if (hasCdmaDataConnectionChanged || hasRadioTechnologyChanged) {
phone.notifyDataConnection(null);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
index 1f28280..4956ef4 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java
@@ -100,7 +100,7 @@
}
phone.mCM.setupDataCall(
- Integer.toString(getRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
+ Integer.toString(getRilRadioTechnology(RILConstants.SETUP_DATA_TECH_GSM)),
Integer.toString(mProfileId),
mApn.apn, mApn.user, mApn.password,
Integer.toString(authType),
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
index 66e9487..d1873eb 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java
@@ -2318,7 +2318,7 @@
}
String operator = mPhone.mIccRecords.getOperatorNumeric();
- int radioTech = mPhone.getServiceState().getRadioTechnology();
+ int networkType = mPhone.getServiceState().getNetworkType();
if (requestedApnType.equals(Phone.APN_TYPE_DEFAULT)) {
if (canSetPreferApn && mPreferredApn != null) {
@@ -2327,7 +2327,7 @@
+ mPreferredApn.numeric + ":" + mPreferredApn);
}
if (mPreferredApn.numeric.equals(operator)) {
- if (mPreferredApn.bearer == 0 || mPreferredApn.bearer == radioTech) {
+ if (mPreferredApn.bearer == 0 || mPreferredApn.bearer == networkType) {
apnList.add(mPreferredApn);
if (DBG) log("buildWaitingApns: X added preferred apnList=" + apnList);
return apnList;
@@ -2346,7 +2346,7 @@
if (mAllApns != null) {
for (ApnSetting apn : mAllApns) {
if (apn.canHandleType(requestedApnType)) {
- if (apn.bearer == 0 || apn.bearer == radioTech) {
+ if (apn.bearer == 0 || apn.bearer == networkType) {
if (DBG) log("apn info : " +apn.toString());
apnList.add(apn);
}
diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
index 0ebeabe..a4fb1d8 100644
--- a/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
+++ b/telephony/java/com/android/internal/telephony/gsm/GsmServiceStateTracker.java
@@ -629,7 +629,7 @@
}
newGPRSState = regCodeToServiceState(regState);
mDataRoaming = regCodeIsRoaming(regState);
- mNewRadioTechnology = type;
+ mNewRilRadioTechnology = type;
newSS.setRadioTechnology(type);
break;
@@ -746,8 +746,8 @@
" mNewMaxDataCalls=" + mNewMaxDataCalls +
" oldReasonDataDenied=" + mReasonDataDenied +
" mNewReasonDataDenied=" + mNewReasonDataDenied +
- " oldType=" + ServiceState.radioTechnologyToString(mRadioTechnology) +
- " newType=" + ServiceState.radioTechnologyToString(mNewRadioTechnology));
+ " oldType=" + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
+ " newType=" + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology));
}
boolean hasRegistered =
@@ -766,7 +766,7 @@
gprsState == ServiceState.STATE_IN_SERVICE
&& newGPRSState != ServiceState.STATE_IN_SERVICE;
- boolean hasRadioTechnologyChanged = mRadioTechnology != mNewRadioTechnology;
+ boolean hasRadioTechnologyChanged = mRilRadioTechnology != mNewRilRadioTechnology;
boolean hasChanged = !newSS.equals(ss);
@@ -800,11 +800,11 @@
int cid = -1;
GsmCellLocation loc = ((GsmCellLocation)phone.getCellLocation());
if (loc != null) cid = loc.getCid();
- EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mRadioTechnology,
- mNewRadioTechnology);
+ EventLog.writeEvent(EventLogTags.GSM_RAT_SWITCHED, cid, mRilRadioTechnology,
+ mNewRilRadioTechnology);
if (DBG) {
- log("RAT switched " + ServiceState.radioTechnologyToString(mRadioTechnology) +
- " -> " + ServiceState.radioTechnologyToString(mNewRadioTechnology) +
+ log("RAT switched " + ServiceState.rilRadioTechnologyToString(mRilRadioTechnology) +
+ " -> " + ServiceState.rilRadioTechnologyToString(mNewRilRadioTechnology) +
" at cell " + cid);
}
}
@@ -812,16 +812,16 @@
gprsState = newGPRSState;
mReasonDataDenied = mNewReasonDataDenied;
mMaxDataCalls = mNewMaxDataCalls;
- mRadioTechnology = mNewRadioTechnology;
+ mRilRadioTechnology = mNewRilRadioTechnology;
// this new state has been applied - forget it until we get a new new state
- mNewRadioTechnology = 0;
+ mNewRilRadioTechnology = 0;
newSS.setStateOutOfService(); // clean slate for next time
if (hasRadioTechnologyChanged) {
phone.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
- ServiceState.radioTechnologyToString(mRadioTechnology));
+ ServiceState.rilRadioTechnologyToString(mRilRadioTechnology));
}
if (hasRegistered) {
@@ -1246,7 +1246,7 @@
* that could support voice and data simultaneously.
*/
public boolean isConcurrentVoiceAndDataAllowed() {
- return (mRadioTechnology >= ServiceState.RADIO_TECHNOLOGY_UMTS);
+ return (mRilRadioTechnology >= ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
}
/**
diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
index f463a19..ae01c75 100644
--- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
+++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java
@@ -765,22 +765,70 @@
}
},
- new Test("System priority notification") {
+ new Test("PRIORITY_HIGH") {
public void run() {
Notification n = new Notification.Builder(NotificationTestList.this)
- .setSmallIcon(R.drawable.notification1)
- .setContentTitle("System priority")
+ .setSmallIcon(R.drawable.notification5)
+ .setContentTitle("High priority")
.setContentText("This should appear before all others")
+ .setPriority(Notification.PRIORITY_HIGH)
.getNotification();
int[] idOut = new int[1];
try {
INotificationManager directLine = mNM.getService();
- directLine.enqueueNotificationWithTagPriority(
+ directLine.enqueueNotificationWithTag(
+ getPackageName(),
+ null,
+ 100,
+ n,
+ idOut);
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+ },
+
+ new Test("PRIORITY_MAX") {
+ public void run() {
+ Notification n = new Notification.Builder(NotificationTestList.this)
+ .setSmallIcon(R.drawable.notification9)
+ .setContentTitle("MAX priority")
+ .setContentText("This might appear as an intruder alert")
+ .setPriority(Notification.PRIORITY_MAX)
+ .getNotification();
+
+ int[] idOut = new int[1];
+ try {
+ INotificationManager directLine = mNM.getService();
+ directLine.enqueueNotificationWithTag(
+ getPackageName(),
+ null,
+ 200,
+ n,
+ idOut);
+ } catch (android.os.RemoteException ex) {
+ // oh well
+ }
+ }
+ },
+
+ new Test("PRIORITY_MIN") {
+ public void run() {
+ Notification n = new Notification.Builder(NotificationTestList.this)
+ .setSmallIcon(R.drawable.notification0)
+ .setContentTitle("MIN priority")
+ .setContentText("You should not see this")
+ .setPriority(Notification.PRIORITY_MIN)
+ .getNotification();
+
+ int[] idOut = new int[1];
+ try {
+ INotificationManager directLine = mNM.getService();
+ directLine.enqueueNotificationWithTag(
getPackageName(),
null,
1,
- StatusBarNotification.PRIORITY_SYSTEM,
n,
idOut);
} catch (android.os.RemoteException ex) {