Merge "Make compute work without an app context."
diff --git a/api/current.txt b/api/current.txt
index 0a83fe0..c43c45f 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);
@@ -8615,14 +8629,14 @@
method public static void getPixelFormatInfo(int, android.graphics.PixelFormat);
field public static final int A_8 = 8; // 0x8
field public static final deprecated int JPEG = 256; // 0x100
- field public static final int LA_88 = 10; // 0xa
+ field public static final deprecated int LA_88 = 10; // 0xa
field public static final int L_8 = 9; // 0x9
field public static final int OPAQUE = -1; // 0xffffffff
- field public static final int RGBA_4444 = 7; // 0x7
- field public static final int RGBA_5551 = 6; // 0x6
+ field public static final deprecated int RGBA_4444 = 7; // 0x7
+ field public static final deprecated int RGBA_5551 = 6; // 0x6
field public static final int RGBA_8888 = 1; // 0x1
field public static final int RGBX_8888 = 2; // 0x2
- field public static final int RGB_332 = 11; // 0xb
+ field public static final deprecated int RGB_332 = 11; // 0xb
field public static final int RGB_565 = 4; // 0x4
field public static final int RGB_888 = 3; // 0x3
field public static final int TRANSLUCENT = -3; // 0xfffffffd
@@ -21921,12 +21935,14 @@
method public java.lang.Object getTag();
method public abstract java.lang.CharSequence getTitle();
method public abstract void invalidate();
+ method public boolean isTitleOptional();
method public abstract void setCustomView(android.view.View);
method public abstract void setSubtitle(java.lang.CharSequence);
method public abstract void setSubtitle(int);
method public void setTag(java.lang.Object);
method public abstract void setTitle(java.lang.CharSequence);
method public abstract void setTitle(int);
+ method public void setTitleOptionalHint(boolean);
}
public static abstract interface ActionMode.Callback {
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/IAccessibilityServiceConnection.aidl b/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
index 882dd6b..8d17325 100644
--- a/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
+++ b/core/java/android/accessibilityservice/IAccessibilityServiceConnection.aidl
@@ -42,11 +42,12 @@
* @param interactionId The id of the interaction for matching with the callback result.
* @param callback Callback which to receive the result.
* @param threadId The id of the calling thread.
+ * @param prefetchFlags flags to guide prefetching.
* @return The current window scale, where zero means a failure.
*/
float findAccessibilityNodeInfoByAccessibilityId(int accessibilityWindowId,
long accessibilityNodeId, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, long threadId);
+ IAccessibilityInteractionConnectionCallback callback, long threadId, int prefetchFlags);
/**
* Finds {@link android.view.accessibility.AccessibilityNodeInfo}s by View text.
diff --git a/core/java/android/accessibilityservice/UiTestAutomationBridge.java b/core/java/android/accessibilityservice/UiTestAutomationBridge.java
index 334981a..a898c3f 100644
--- a/core/java/android/accessibilityservice/UiTestAutomationBridge.java
+++ b/core/java/android/accessibilityservice/UiTestAutomationBridge.java
@@ -57,6 +57,11 @@
public static final int UNDEFINED = -1;
+ private static final int FIND_ACCESSIBILITY_NODE_INFO_PREFETCH_FLAGS =
+ AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS
+ | AccessibilityNodeInfo.FLAG_PREFETCH_SIBLINGS
+ | AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS;
+
private final Object mLock = new Object();
private volatile int mConnectionId = AccessibilityInteractionClient.NO_ID;
@@ -69,6 +74,8 @@
private volatile boolean mUnprocessedEventAvailable;
+ private HandlerThread mHandlerThread;
+
/**
* Gets the last received {@link AccessibilityEvent}.
*
@@ -121,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
@@ -212,6 +220,8 @@
throw new IllegalStateException("Already disconnected.");
}
+ mHandlerThread.quit();
+
IAccessibilityManager manager = IAccessibilityManager.Stub.asInterface(
ServiceManager.getService(Context.ACCESSIBILITY_SERVICE));
@@ -351,13 +361,15 @@
ensureValidConnection(connectionId);
return AccessibilityInteractionClient.getInstance()
.findAccessibilityNodeInfoByAccessibilityId(mConnectionId,
- accessibilityWindowId, accessibilityNodeId);
+ accessibilityWindowId, accessibilityNodeId,
+ FIND_ACCESSIBILITY_NODE_INFO_PREFETCH_FLAGS);
}
/**
* Finds an {@link AccessibilityNodeInfo} by View id in the active
* window. The search is performed from the root node.
*
+ * @param viewId The id of a View.
* @return The current window scale, where zero means a failure.
*/
public AccessibilityNodeInfo findAccessibilityNodeInfoByViewIdInActiveWindow(int viewId) {
@@ -373,6 +385,7 @@
* {@link #ACTIVE_WINDOW_ID} to query the currently active window.
* @param accessibilityNodeId A unique view id or virtual descendant id from
* where to start the search. Use {@link #ROOT_NODE_ID} to start from the root.
+ * @param viewId The id of a View.
* @return The current window scale, where zero means a failure.
*/
public AccessibilityNodeInfo findAccessibilityNodeInfoByViewId(int accessibilityWindowId,
@@ -460,7 +473,7 @@
ensureValidConnection(connectionId);
return AccessibilityInteractionClient.getInstance()
.findAccessibilityNodeInfoByAccessibilityId(connectionId, ACTIVE_WINDOW_ID,
- ROOT_NODE_ID);
+ ROOT_NODE_ID, AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS);
}
private void ensureValidConnection(int connectionId) {
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/inputmethodservice/ExtractEditLayout.java b/core/java/android/inputmethodservice/ExtractEditLayout.java
index 220214b..5696839 100644
--- a/core/java/android/inputmethodservice/ExtractEditLayout.java
+++ b/core/java/android/inputmethodservice/ExtractEditLayout.java
@@ -124,6 +124,12 @@
}
@Override
+ public boolean isTitleOptional() {
+ // Not only is it optional, it will *never* be shown.
+ return true;
+ }
+
+ @Override
public void setCustomView(View view) {
// Custom view is not supported here.
}
diff --git a/core/java/android/view/ActionMode.java b/core/java/android/view/ActionMode.java
index c1c7fe2..0ba5fdb 100644
--- a/core/java/android/view/ActionMode.java
+++ b/core/java/android/view/ActionMode.java
@@ -104,6 +104,32 @@
public abstract void setSubtitle(int resId);
/**
+ * Set whether or not the title/subtitle display for this action mode
+ * is optional.
+ *
+ * <p>In many cases the supplied title for an action mode is merely
+ * meant to add context and is not strictly required for the action
+ * mode to be useful. If the title is optional, the system may choose
+ * to hide the title entirely rather than truncate it due to a lack
+ * of available space.</p>
+ *
+ * <p>Note that this is merely a hint; the underlying implementation
+ * may choose to ignore this setting under some circumstances.</p>
+ *
+ * @param titleOptional true if the title only presents optional information.
+ */
+ public void setTitleOptionalHint(boolean titleOptional) {
+ }
+
+ /**
+ * @return true if this action mode considers the title and subtitle fields
+ * as optional. Optional titles may not be displayed to the user.
+ */
+ public boolean isTitleOptional() {
+ return false;
+ }
+
+ /**
* Set a custom view for this action mode. The custom view will take the place of
* the title and subtitle. Useful for things like search boxes.
*
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index f831d85f..e0d0763 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -54,12 +54,12 @@
import android.util.DisplayMetrics;
import android.util.EventLog;
import android.util.Log;
-import android.util.LongSparseArray;
import android.util.Pool;
import android.util.Poolable;
import android.util.PoolableManager;
import android.util.Pools;
import android.util.Slog;
+import android.util.SparseLongArray;
import android.util.TypedValue;
import android.view.View.AttachInfo;
import android.view.View.MeasureSpec;
@@ -87,7 +87,9 @@
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* The top of a view hierarchy, implementing the needed protocol between View
@@ -309,7 +311,7 @@
SendWindowContentChangedAccessibilityEvent mSendWindowContentChangedAccessibilityEvent;
- AccessibilityPrefetchStrategy mAccessibilityPrefetchStrategy;
+ AccessibilityNodePrefetcher mAccessibilityNodePrefetcher;
private final int mDensity;
@@ -3564,15 +3566,15 @@
return mAccessibilityInteractionController;
}
- public AccessibilityPrefetchStrategy getAccessibilityPrefetchStrategy() {
+ public AccessibilityNodePrefetcher getAccessibilityNodePrefetcher() {
if (mView == null) {
- throw new IllegalStateException("getAccessibilityPrefetchStrategy"
+ throw new IllegalStateException("getAccessibilityNodePrefetcher"
+ " called when there is no mView");
}
- if (mAccessibilityPrefetchStrategy == null) {
- mAccessibilityPrefetchStrategy = new AccessibilityPrefetchStrategy();
+ if (mAccessibilityNodePrefetcher == null) {
+ mAccessibilityNodePrefetcher = new AccessibilityNodePrefetcher();
}
- return mAccessibilityPrefetchStrategy;
+ return mAccessibilityNodePrefetcher;
}
private int relayoutWindow(WindowManager.LayoutParams params, int viewVisibility,
@@ -4118,7 +4120,6 @@
if (mView == null) {
return false;
}
- getAccessibilityPrefetchStrategy().onAccessibilityEvent(event);
mAccessibilityManager.sendAccessibilityEvent(event);
return true;
}
@@ -4690,12 +4691,12 @@
public void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId,
int interactionId, IAccessibilityInteractionConnectionCallback callback,
- int interrogatingPid, long interrogatingTid) {
+ int prefetchFlags, int interrogatingPid, long interrogatingTid) {
ViewRootImpl viewRootImpl = mViewRootImpl.get();
if (viewRootImpl != null && viewRootImpl.mView != null) {
viewRootImpl.getAccessibilityInteractionController()
.findAccessibilityNodeInfoByAccessibilityIdClientThread(accessibilityNodeId,
- interactionId, callback, interrogatingPid, interrogatingTid);
+ interactionId, callback, prefetchFlags, interrogatingPid, interrogatingTid);
} else {
// We cannot make the call and notify the caller so it does not wait.
try {
@@ -4830,11 +4831,11 @@
public void findAccessibilityNodeInfoByAccessibilityIdClientThread(
long accessibilityNodeId, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, int interrogatingPid,
- long interrogatingTid) {
+ IAccessibilityInteractionConnectionCallback callback, int prefetchFlags,
+ int interrogatingPid, long interrogatingTid) {
Message message = mHandler.obtainMessage();
message.what = MSG_FIND_ACCESSIBLITY_NODE_INFO_BY_ACCESSIBILITY_ID;
- message.arg1 = interrogatingPid;
+ message.arg1 = prefetchFlags;
SomeArgs args = mPool.acquire();
args.argi1 = AccessibilityNodeInfo.getAccessibilityViewId(accessibilityNodeId);
args.argi2 = AccessibilityNodeInfo.getVirtualDescendantId(accessibilityNodeId);
@@ -4855,8 +4856,8 @@
}
public void findAccessibilityNodeInfoByAccessibilityIdUiThread(Message message) {
+ final int prefetchFlags = message.arg1;
SomeArgs args = (SomeArgs) message.obj;
- final int interrogatingPid = message.arg1;
final int accessibilityViewId = args.argi1;
final int virtualDescendantId = args.argi2;
final int interactionId = args.argi3;
@@ -4866,22 +4867,15 @@
List<AccessibilityNodeInfo> infos = mTempAccessibilityNodeInfoList;
infos.clear();
try {
+ View target = null;
if (accessibilityViewId == AccessibilityNodeInfo.UNDEFINED) {
- View target = ViewRootImpl.this.mView;
- if (target != null && target.getVisibility() == View.VISIBLE) {
- infos.add(target.createAccessibilityNodeInfo());
- }
+ target = ViewRootImpl.this.mView;
} else {
- View target = findViewByAccessibilityId(accessibilityViewId);
- if (target != null && target.getVisibility() == View.VISIBLE) {
- AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider();
- if (provider != null) {
- infos.add(provider.createAccessibilityNodeInfo(virtualDescendantId));
- } else if (virtualDescendantId == AccessibilityNodeInfo.UNDEFINED) {
- getAccessibilityPrefetchStrategy().prefetchAccessibilityNodeInfos(
- interrogatingPid, target, infos);
- }
- }
+ target = findViewByAccessibilityId(accessibilityViewId);
+ }
+ if (target != null && target.getVisibility() == View.VISIBLE) {
+ getAccessibilityNodePrefetcher().prefetchAccessibilityNodeInfos(target,
+ virtualDescendantId, prefetchFlags, infos);
}
} finally {
try {
@@ -5142,83 +5136,216 @@
/**
* This class encapsulates a prefetching strategy for the accessibility APIs for
- * querying window content.It is responsible to prefetch a batch of
- * AccessibilityNodeInfos in addition to the one for a requested node. It caches
- * the ids of the prefeteched nodes such that they are fetched only once.
+ * querying window content. It is responsible to prefetch a batch of
+ * AccessibilityNodeInfos in addition to the one for a requested node.
*/
- class AccessibilityPrefetchStrategy {
- private static final int MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE = 100;
+ class AccessibilityNodePrefetcher {
- // We need to keep track of what we have sent for each interrogating
- // process. Usually there will be only one such process but we
- // should support the general case. Note that the accessibility event
- // stream will take care of clearing caches of querying processes that
- // are not longer alive, so we do not waste memory.
- private final LongSparseArray<AccessibilityNodeInfoCache> mAccessibilityNodeInfoCaches =
- new LongSparseArray<AccessibilityNodeInfoCache>();
+ private static final int MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE = 50;
- private AccessibilityNodeInfoCache getCacheForInterrogatingPid(long interrogatingPid) {
- AccessibilityNodeInfoCache cache = mAccessibilityNodeInfoCaches.get(interrogatingPid);
- if (cache == null) {
- cache = AccessibilityNodeInfoCache.newAccessibilityNodeInfoCache();
- mAccessibilityNodeInfoCaches.put(interrogatingPid, cache);
- }
- return cache;
- }
-
- public void onAccessibilityEvent(AccessibilityEvent event) {
- final int cacheCount = mAccessibilityNodeInfoCaches.size();
- for (int i = 0; i < cacheCount; i++) {
- AccessibilityNodeInfoCache cache = mAccessibilityNodeInfoCaches.valueAt(i);
- cache.onAccessibilityEvent(event);
- }
- }
-
- public void prefetchAccessibilityNodeInfos(long interrogatingPid, View root,
+ public void prefetchAccessibilityNodeInfos(View view, int virtualViewId, int prefetchFlags,
List<AccessibilityNodeInfo> outInfos) {
- addAndCacheNotCachedNodeInfo(interrogatingPid, root, outInfos);
- addAndCacheNotCachedPredecessorInfos(interrogatingPid, root, outInfos);
- addAndCacheNotCachedDescendantInfos(interrogatingPid, root, outInfos);
- }
-
- private void addAndCacheNotCachedNodeInfo(long interrogatingPid,
- View view, List<AccessibilityNodeInfo> outInfos) {
- final long accessibilityNodeId = AccessibilityNodeInfo.makeNodeId(
- view.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
- AccessibilityNodeInfoCache cache = getCacheForInterrogatingPid(interrogatingPid);
- if (!cache.containsKey(accessibilityNodeId)) {
- // Account for the ids of the fetched infos. The infos will be
- // cached in the window querying process. We just need to know
- // which infos are cached to avoid fetching a cached one again.
- cache.put(accessibilityNodeId, null);
- outInfos.add(view.createAccessibilityNodeInfo());
+ AccessibilityNodeProvider provider = view.getAccessibilityNodeProvider();
+ if (provider == null) {
+ AccessibilityNodeInfo root = view.createAccessibilityNodeInfo();
+ if (root != null) {
+ outInfos.add(root);
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS) != 0) {
+ prefetchPredecessorsOfRealNode(view, outInfos);
+ }
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_SIBLINGS) != 0) {
+ prefetchSiblingsOfRealNode(view, outInfos);
+ }
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS) != 0) {
+ prefetchDescendantsOfRealNode(view, outInfos);
+ }
+ }
+ } else {
+ AccessibilityNodeInfo root = provider.createAccessibilityNodeInfo(virtualViewId);
+ if (root != null) {
+ outInfos.add(root);
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS) != 0) {
+ prefetchPredecessorsOfVirtualNode(root, view, provider, outInfos);
+ }
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_SIBLINGS) != 0) {
+ prefetchSiblingsOfVirtualNode(root, view, provider, outInfos);
+ }
+ if ((prefetchFlags & AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS) != 0) {
+ prefetchDescendantsOfVirtualNode(root, provider, outInfos);
+ }
+ }
}
}
- private void addAndCacheNotCachedPredecessorInfos(long interrogatingPid, View view,
+ private void prefetchPredecessorsOfRealNode(View view,
List<AccessibilityNodeInfo> outInfos) {
- ViewParent predecessor = view.getParent();
- while (predecessor instanceof View
+ ViewParent parent = view.getParent();
+ while (parent instanceof View
&& outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
- View predecessorView = (View) predecessor;
- addAndCacheNotCachedNodeInfo(interrogatingPid, predecessorView, outInfos);
- predecessor = predecessor.getParent();
+ View parentView = (View) parent;
+ final long parentNodeId = AccessibilityNodeInfo.makeNodeId(
+ parentView.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
+ AccessibilityNodeInfo info = parentView.createAccessibilityNodeInfo();
+ if (info != null) {
+ outInfos.add(info);
+ }
+ parent = parent.getParent();
}
}
- private void addAndCacheNotCachedDescendantInfos(long interrogatingPid, View view,
+ private void prefetchSiblingsOfRealNode(View current,
List<AccessibilityNodeInfo> outInfos) {
- if (outInfos.size() > MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE
- || view.getAccessibilityNodeProvider() != null) {
- return;
+ ViewParent parent = current.getParent();
+ if (parent instanceof ViewGroup) {
+ ViewGroup parentGroup = (ViewGroup) parent;
+ final int childCount = parentGroup.getChildCount();
+ for (int i = 0; i < childCount; i++) {
+ View child = parentGroup.getChildAt(i);
+ if (outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE
+ && child.getAccessibilityViewId() != current.getAccessibilityViewId()
+ && child.getVisibility() == View.VISIBLE) {
+ final long childNodeId = AccessibilityNodeInfo.makeNodeId(
+ child.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
+ AccessibilityNodeInfo info = null;
+ AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider();
+ if (provider == null) {
+ info = child.createAccessibilityNodeInfo();
+ } else {
+ info = provider.createAccessibilityNodeInfo(
+ AccessibilityNodeInfo.UNDEFINED);
+ }
+ if (info != null) {
+ outInfos.add(info);
+ }
+ }
+ }
}
- addAndCacheNotCachedNodeInfo(interrogatingPid, view, outInfos);
- if (view instanceof ViewGroup) {
- ViewGroup rootGroup = (ViewGroup) view;
+ }
+
+ private void prefetchDescendantsOfRealNode(View root,
+ List<AccessibilityNodeInfo> outInfos) {
+ if (root instanceof ViewGroup) {
+ ViewGroup rootGroup = (ViewGroup) root;
+ HashMap<View, AccessibilityNodeInfo> addedChildren =
+ new HashMap<View, AccessibilityNodeInfo>();
final int childCount = rootGroup.getChildCount();
for (int i = 0; i < childCount; i++) {
- View child = rootGroup.getChildAt(i);
- addAndCacheNotCachedDescendantInfos(interrogatingPid, child, outInfos);
+ View child = rootGroup.getChildAt(i);
+ if (child.getVisibility() == View.VISIBLE
+ && outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
+ final long childNodeId = AccessibilityNodeInfo.makeNodeId(
+ child.getAccessibilityViewId(), AccessibilityNodeInfo.UNDEFINED);
+ AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider();
+ if (provider == null) {
+ AccessibilityNodeInfo info = child.createAccessibilityNodeInfo();
+ if (info != null) {
+ outInfos.add(info);
+ addedChildren.put(child, null);
+ }
+ } else {
+ AccessibilityNodeInfo info = provider.createAccessibilityNodeInfo(
+ AccessibilityNodeInfo.UNDEFINED);
+ if (info != null) {
+ outInfos.add(info);
+ addedChildren.put(child, info);
+ }
+ }
+ }
+ }
+ if (outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
+ for (Map.Entry<View, AccessibilityNodeInfo> entry : addedChildren.entrySet()) {
+ View addedChild = entry.getKey();
+ AccessibilityNodeInfo virtualRoot = entry.getValue();
+ if (virtualRoot == null) {
+ prefetchDescendantsOfRealNode(addedChild, outInfos);
+ } else {
+ AccessibilityNodeProvider provider =
+ addedChild.getAccessibilityNodeProvider();
+ prefetchDescendantsOfVirtualNode(virtualRoot, provider, outInfos);
+ }
+ }
+ }
+ }
+ }
+
+ private void prefetchPredecessorsOfVirtualNode(AccessibilityNodeInfo root,
+ View providerHost, AccessibilityNodeProvider provider,
+ List<AccessibilityNodeInfo> outInfos) {
+ long parentNodeId = root.getParentNodeId();
+ int accessibilityViewId = AccessibilityNodeInfo.getAccessibilityViewId(parentNodeId);
+ while (accessibilityViewId != AccessibilityNodeInfo.UNDEFINED) {
+ final int virtualDescendantId =
+ AccessibilityNodeInfo.getVirtualDescendantId(parentNodeId);
+ if (virtualDescendantId != AccessibilityNodeInfo.UNDEFINED
+ || accessibilityViewId == providerHost.getAccessibilityViewId()) {
+ AccessibilityNodeInfo parent = provider.createAccessibilityNodeInfo(
+ virtualDescendantId);
+ if (parent != null) {
+ outInfos.add(parent);
+ }
+ parentNodeId = parent.getParentNodeId();
+ accessibilityViewId = AccessibilityNodeInfo.getAccessibilityViewId(
+ parentNodeId);
+ } else {
+ prefetchPredecessorsOfRealNode(providerHost, outInfos);
+ return;
+ }
+ }
+ }
+
+ private void prefetchSiblingsOfVirtualNode(AccessibilityNodeInfo current, View providerHost,
+ AccessibilityNodeProvider provider, List<AccessibilityNodeInfo> outInfos) {
+ final long parentNodeId = current.getParentNodeId();
+ final int parentAccessibilityViewId =
+ AccessibilityNodeInfo.getAccessibilityViewId(parentNodeId);
+ final int parentVirtualDescendantId =
+ AccessibilityNodeInfo.getVirtualDescendantId(parentNodeId);
+ if (parentVirtualDescendantId != AccessibilityNodeInfo.UNDEFINED
+ || parentAccessibilityViewId == providerHost.getAccessibilityViewId()) {
+ AccessibilityNodeInfo parent =
+ provider.createAccessibilityNodeInfo(parentVirtualDescendantId);
+ if (parent != null) {
+ SparseLongArray childNodeIds = parent.getChildNodeIds();
+ final int childCount = childNodeIds.size();
+ for (int i = 0; i < childCount; i++) {
+ final long childNodeId = childNodeIds.get(i);
+ if (childNodeId != current.getSourceNodeId()
+ && outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
+ final int childVirtualDescendantId =
+ AccessibilityNodeInfo.getVirtualDescendantId(childNodeId);
+ AccessibilityNodeInfo child = provider.createAccessibilityNodeInfo(
+ childVirtualDescendantId);
+ if (child != null) {
+ outInfos.add(child);
+ }
+ }
+ }
+ }
+ } else {
+ prefetchSiblingsOfRealNode(providerHost, outInfos);
+ }
+ }
+
+ private void prefetchDescendantsOfVirtualNode(AccessibilityNodeInfo root,
+ AccessibilityNodeProvider provider, List<AccessibilityNodeInfo> outInfos) {
+ SparseLongArray childNodeIds = root.getChildNodeIds();
+ final int initialOutInfosSize = outInfos.size();
+ final int childCount = childNodeIds.size();
+ for (int i = 0; i < childCount; i++) {
+ if (outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
+ final long childNodeId = childNodeIds.get(i);
+ AccessibilityNodeInfo child = provider.createAccessibilityNodeInfo(
+ AccessibilityNodeInfo.getVirtualDescendantId(childNodeId));
+ if (child != null) {
+ outInfos.add(child);
+ }
+ }
+ }
+ if (outInfos.size() < MAX_ACCESSIBILITY_NODE_INFO_BATCH_SIZE) {
+ final int addedChildCount = outInfos.size() - initialOutInfosSize;
+ for (int i = 0; i < addedChildCount; i++) {
+ AccessibilityNodeInfo child = outInfos.get(initialOutInfosSize + i);
+ prefetchDescendantsOfVirtualNode(child, provider, outInfos);
}
}
}
diff --git a/core/java/android/view/accessibility/AccessibilityInteractionClient.java b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
index 105c010..be74b31 100644
--- a/core/java/android/view/accessibility/AccessibilityInteractionClient.java
+++ b/core/java/android/view/accessibility/AccessibilityInteractionClient.java
@@ -24,7 +24,6 @@
import android.util.Log;
import android.util.LongSparseArray;
import android.util.SparseArray;
-import android.view.AccessibilityNodeInfoCache;
import java.util.ArrayList;
import java.util.Collections;
@@ -102,7 +101,7 @@
// The connection cache is shared between all interrogating threads since
// at any given time there is only one window allowing querying.
private static final AccessibilityNodeInfoCache sAccessibilityNodeInfoCache =
- AccessibilityNodeInfoCache.newSynchronizedAccessibilityNodeInfoCache();
+ new AccessibilityNodeInfoCache();
/**
* @return The client for the current thread.
@@ -159,10 +158,11 @@
* where to start the search. Use
* {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID}
* to start from the root.
+ * @param prefetchFlags flags to guide prefetching.
* @return An {@link AccessibilityNodeInfo} if found, null otherwise.
*/
public AccessibilityNodeInfo findAccessibilityNodeInfoByAccessibilityId(int connectionId,
- int accessibilityWindowId, long accessibilityNodeId) {
+ int accessibilityWindowId, long accessibilityNodeId, int prefetchFlags) {
try {
IAccessibilityServiceConnection connection = getConnection(connectionId);
if (connection != null) {
@@ -174,7 +174,7 @@
final int interactionId = mInteractionIdCounter.getAndIncrement();
final float windowScale = connection.findAccessibilityNodeInfoByAccessibilityId(
accessibilityWindowId, accessibilityNodeId, interactionId, this,
- Thread.currentThread().getId());
+ Thread.currentThread().getId(), prefetchFlags);
// If the scale is zero the call has failed.
if (windowScale > 0) {
List<AccessibilityNodeInfo> infos = getFindAccessibilityNodeInfosResultAndClear(
diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
index 84ad268..c094fda 100644
--- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java
@@ -61,6 +61,15 @@
/** @hide */
public static final int ACTIVE_WINDOW_ID = UNDEFINED;
+ /** @hide */
+ public static final int FLAG_PREFETCH_PREDECESSORS = 0x00000001;
+
+ /** @hide */
+ public static final int FLAG_PREFETCH_SIBLINGS = 0x00000002;
+
+ /** @hide */
+ public static final int FLAG_PREFETCH_DESCENDANTS = 0x00000003;
+
// Actions.
/**
@@ -181,7 +190,7 @@
private CharSequence mText;
private CharSequence mContentDescription;
- private SparseLongArray mChildIds = new SparseLongArray();
+ private SparseLongArray mChildNodeIds = new SparseLongArray();
private int mActions;
private int mConnectionId = UNDEFINED;
@@ -244,12 +253,21 @@
}
/**
+ * @return The ids of the children.
+ *
+ * @hide
+ */
+ public SparseLongArray getChildNodeIds() {
+ return mChildNodeIds;
+ }
+
+ /**
* Gets the number of children.
*
* @return The child count.
*/
public int getChildCount() {
- return mChildIds.size();
+ return mChildNodeIds.size();
}
/**
@@ -271,9 +289,10 @@
if (!canPerformRequestOverConnection(mSourceNodeId)) {
return null;
}
- final long childId = mChildIds.get(index);
+ final long childId = mChildNodeIds.get(index);
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
- return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mWindowId, childId);
+ return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mWindowId,
+ childId, FLAG_PREFETCH_DESCENDANTS);
}
/**
@@ -308,11 +327,11 @@
*/
public void addChild(View root, int virtualDescendantId) {
enforceNotSealed();
- final int index = mChildIds.size();
+ final int index = mChildNodeIds.size();
final int rootAccessibilityViewId =
(root != null) ? root.getAccessibilityViewId() : UNDEFINED;
final long childNodeId = makeNodeId(rootAccessibilityViewId, virtualDescendantId);
- mChildIds.put(index, childNodeId);
+ mChildNodeIds.put(index, childNodeId);
}
/**
@@ -408,7 +427,16 @@
}
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId,
- mWindowId, mParentNodeId);
+ mWindowId, mParentNodeId, FLAG_PREFETCH_DESCENDANTS | FLAG_PREFETCH_SIBLINGS);
+ }
+
+ /**
+ * @return The parent node id.
+ *
+ * @hide
+ */
+ public long getParentNodeId() {
+ return mParentNodeId;
}
/**
@@ -1070,7 +1098,7 @@
parcel.writeLong(mParentNodeId);
parcel.writeInt(mConnectionId);
- SparseLongArray childIds = mChildIds;
+ SparseLongArray childIds = mChildNodeIds;
final int childIdsSize = childIds.size();
parcel.writeInt(childIdsSize);
for (int i = 0; i < childIdsSize; i++) {
@@ -1120,7 +1148,7 @@
mContentDescription = other.mContentDescription;
mActions= other.mActions;
mBooleanProperties = other.mBooleanProperties;
- mChildIds = other.mChildIds.clone();
+ mChildNodeIds = other.mChildNodeIds.clone();
}
/**
@@ -1135,7 +1163,7 @@
mParentNodeId = parcel.readLong();
mConnectionId = parcel.readInt();
- SparseLongArray childIds = mChildIds;
+ SparseLongArray childIds = mChildNodeIds;
final int childrenSize = parcel.readInt();
for (int i = 0; i < childrenSize; i++) {
final long childId = parcel.readLong();
@@ -1171,7 +1199,7 @@
mParentNodeId = ROOT_NODE_ID;
mWindowId = UNDEFINED;
mConnectionId = UNDEFINED;
- mChildIds.clear();
+ mChildNodeIds.clear();
mBoundsInParent.set(0, 0, 0, 0);
mBoundsInScreen.set(0, 0, 0, 0);
mBooleanProperties = 0;
@@ -1249,7 +1277,7 @@
builder.append("; accessibilityViewId: " + getAccessibilityViewId(mSourceNodeId));
builder.append("; virtualDescendantId: " + getVirtualDescendantId(mSourceNodeId));
builder.append("; mParentNodeId: " + mParentNodeId);
- SparseLongArray childIds = mChildIds;
+ SparseLongArray childIds = mChildNodeIds;
builder.append("; childAccessibilityIds: [");
for (int i = 0, count = childIds.size(); i < count; i++) {
builder.append(childIds.valueAt(i));
diff --git a/core/java/android/view/AccessibilityNodeInfoCache.java b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
similarity index 63%
rename from core/java/android/view/AccessibilityNodeInfoCache.java
rename to core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
index 84b510d..dfbfc70 100644
--- a/core/java/android/view/AccessibilityNodeInfoCache.java
+++ b/core/java/android/view/accessibility/AccessibilityNodeInfoCache.java
@@ -14,13 +14,10 @@
* limitations under the License.
*/
-package android.view;
+package android.view.accessibility;
-import android.os.Process;
import android.util.Log;
import android.util.LongSparseArray;
-import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityNodeInfo;
/**
* Simple cache for AccessibilityNodeInfos. The cache is mapping an
@@ -38,53 +35,11 @@
private static final boolean DEBUG = false;
- /**
- * @return A new <strong>not synchronized</strong> AccessibilityNodeInfoCache.
- */
- public static AccessibilityNodeInfoCache newAccessibilityNodeInfoCache() {
- return new AccessibilityNodeInfoCache();
- }
-
- /**
- * @return A new <strong>synchronized</strong> AccessibilityNodeInfoCache.
- */
- public static AccessibilityNodeInfoCache newSynchronizedAccessibilityNodeInfoCache() {
- return new AccessibilityNodeInfoCache() {
- private final Object mLock = new Object();
-
- @Override
- public void clear() {
- synchronized(mLock) {
- super.clear();
- }
- }
-
- @Override
- public AccessibilityNodeInfo get(long accessibilityNodeId) {
- synchronized(mLock) {
- return super.get(accessibilityNodeId);
- }
- }
-
- @Override
- public void put(long accessibilityNodeId, AccessibilityNodeInfo info) {
- synchronized(mLock) {
- super.put(accessibilityNodeId, info);
- }
- }
-
- @Override
- public void remove(long accessibilityNodeId) {
- synchronized(mLock) {
- super.remove(accessibilityNodeId);
- }
- }
- };
- }
+ private final Object mLock = new Object();
private final LongSparseArray<AccessibilityNodeInfo> mCacheImpl;
- private AccessibilityNodeInfoCache() {
+ public AccessibilityNodeInfoCache() {
if (ENABLED) {
mCacheImpl = new LongSparseArray<AccessibilityNodeInfo>();
} else {
@@ -124,13 +79,17 @@
*/
public AccessibilityNodeInfo get(long accessibilityNodeId) {
if (ENABLED) {
- if (DEBUG) {
+ synchronized(mLock) {
AccessibilityNodeInfo info = mCacheImpl.get(accessibilityNodeId);
- Log.i(LOG_TAG, "Process: " + Process.myPid() +
- " get(" + accessibilityNodeId + ") = " + info);
+ 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 mCacheImpl.get(accessibilityNodeId);
}
} else {
return null;
@@ -145,11 +104,15 @@
*/
public void put(long accessibilityNodeId, AccessibilityNodeInfo info) {
if (ENABLED) {
- if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid()
- + " put(" + accessibilityNodeId + ", " + info + ")");
+ synchronized(mLock) {
+ if (DEBUG) {
+ Log.i(LOG_TAG, "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);
}
- mCacheImpl.put(accessibilityNodeId, info);
}
}
@@ -161,7 +124,9 @@
*/
public boolean containsKey(long accessibilityNodeId) {
if (ENABLED) {
- return (mCacheImpl.indexOfKey(accessibilityNodeId) >= 0);
+ synchronized(mLock) {
+ return (mCacheImpl.indexOfKey(accessibilityNodeId) >= 0);
+ }
} else {
return false;
}
@@ -174,11 +139,12 @@
*/
public void remove(long accessibilityNodeId) {
if (ENABLED) {
- if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid()
- + " remove(" + accessibilityNodeId + ")");
+ synchronized(mLock) {
+ if (DEBUG) {
+ Log.i(LOG_TAG, "remove(" + accessibilityNodeId + ")");
+ }
+ mCacheImpl.remove(accessibilityNodeId);
}
- mCacheImpl.remove(accessibilityNodeId);
}
}
@@ -187,10 +153,18 @@
*/
public void clear() {
if (ENABLED) {
- if (DEBUG) {
- Log.i(LOG_TAG, "Process: " + Process.myPid() + "clear()");
+ synchronized(mLock) {
+ if (DEBUG) {
+ 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();
}
- mCacheImpl.clear();
}
}
}
diff --git a/core/java/android/view/accessibility/AccessibilityRecord.java b/core/java/android/view/accessibility/AccessibilityRecord.java
index b60f50e..23b235c 100644
--- a/core/java/android/view/accessibility/AccessibilityRecord.java
+++ b/core/java/android/view/accessibility/AccessibilityRecord.java
@@ -56,6 +56,11 @@
private static final int PROPERTY_FULL_SCREEN = 0x00000080;
private static final int PROPERTY_SCROLLABLE = 0x00000100;
+ private static final int GET_SOURCE_PREFETCH_FLAGS =
+ AccessibilityNodeInfo.FLAG_PREFETCH_PREDECESSORS
+ | AccessibilityNodeInfo.FLAG_PREFETCH_SIBLINGS
+ | AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS;
+
// Housekeeping
private static final int MAX_POOL_SIZE = 10;
private static final Object sPoolLock = new Object();
@@ -144,7 +149,7 @@
}
AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance();
return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, mSourceWindowId,
- mSourceNodeId);
+ mSourceNodeId, GET_SOURCE_PREFETCH_FLAGS);
}
/**
diff --git a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
index ae6869c..fc3651c 100644
--- a/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
+++ b/core/java/android/view/accessibility/IAccessibilityInteractionConnection.aidl
@@ -28,7 +28,7 @@
oneway interface IAccessibilityInteractionConnection {
void findAccessibilityNodeInfoByAccessibilityId(long accessibilityNodeId, int interactionId,
- IAccessibilityInteractionConnectionCallback callback,
+ IAccessibilityInteractionConnectionCallback callback, int prefetchFlags,
int interrogatingPid, long interrogatingTid);
void findAccessibilityNodeInfoByViewId(long accessibilityNodeId, int id, int interactionId,
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index c51d244..b6b27c1 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -26,7 +26,6 @@
import com.android.internal.view.InputBindResult;
import android.content.Context;
-import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Handler;
@@ -198,7 +197,31 @@
static final Object mInstanceSync = new Object();
static InputMethodManager mInstance;
-
+
+ /**
+ * @hide Flag for IInputMethodManager.windowGainedFocus: a view in
+ * the window has input focus.
+ */
+ public static final int CONTROL_WINDOW_VIEW_HAS_FOCUS = 1<<0;
+
+ /**
+ * @hide Flag for IInputMethodManager.windowGainedFocus: the focus
+ * is a text editor.
+ */
+ public static final int CONTROL_WINDOW_IS_TEXT_EDITOR = 1<<1;
+
+ /**
+ * @hide Flag for IInputMethodManager.windowGainedFocus: this is the first
+ * time the window has gotten focus.
+ */
+ public static final int CONTROL_WINDOW_FIRST = 1<<2;
+
+ /**
+ * @hide Flag for IInputMethodManager.startInput: this is the first
+ * time the window has gotten focus.
+ */
+ public static final int CONTROL_START_INITIAL = 1<<8;
+
final IInputMethodManager mService;
final Looper mMainLooper;
@@ -216,7 +239,7 @@
/**
* Set whenever this client becomes inactive, to know we need to reset
- * state with the IME then next time we receive focus.
+ * state with the IME the next time we receive focus.
*/
boolean mHasBeenInactive = true;
@@ -243,11 +266,6 @@
*/
View mNextServedView;
/**
- * True if we should restart input in the next served view, even if the
- * view hasn't actually changed from the current serve view.
- */
- boolean mNextServedNeedsStart;
- /**
* This is set when we are in the process of connecting, to determine
* when we have actually finished.
*/
@@ -331,7 +349,7 @@
mCurId = res.id;
mBindSequence = res.sequence;
}
- startInputInner();
+ startInputInner(null, 0, 0, 0);
return;
}
case MSG_UNBIND: {
@@ -362,7 +380,7 @@
}
}
if (startInput) {
- startInputInner();
+ startInputInner(null, 0, 0, 0);
}
return;
}
@@ -957,10 +975,11 @@
mServedConnecting = true;
}
- startInputInner();
+ startInputInner(null, 0, 0, 0);
}
- void startInputInner() {
+ boolean startInputInner(IBinder windowGainingFocus, int controlFlags, int softInputMode,
+ int windowFlags) {
final View view;
synchronized (mH) {
view = mServedView;
@@ -969,7 +988,7 @@
if (DEBUG) Log.v(TAG, "Starting input: view=" + view);
if (view == null) {
if (DEBUG) Log.v(TAG, "ABORT input: no served view!");
- return;
+ return false;
}
}
@@ -982,7 +1001,7 @@
// If the view doesn't have a handler, something has changed out
// from under us, so just bail.
if (DEBUG) Log.v(TAG, "ABORT input: no handler for view!");
- return;
+ return false;
}
if (vh.getLooper() != Looper.myLooper()) {
// The view is running on a different thread than our own, so
@@ -990,10 +1009,10 @@
if (DEBUG) Log.v(TAG, "Starting input: reschedule to view thread");
vh.post(new Runnable() {
public void run() {
- startInputInner();
+ startInputInner(null, 0, 0, 0);
}
});
- return;
+ return false;
}
// Okay we are now ready to call into the served view and have it
@@ -1013,12 +1032,14 @@
if (DEBUG) Log.v(TAG,
"Starting input: finished by someone else (view="
+ mServedView + " conn=" + mServedConnecting + ")");
- return;
+ return false;
}
-
+
// If we already have a text box, then this view is already
// connected so we want to restart it.
- final boolean initial = mCurrentTextBoxAttribute == null;
+ if (mCurrentTextBoxAttribute == null) {
+ controlFlags |= CONTROL_START_INITIAL;
+ }
// Hook 'em up and let 'er rip.
mCurrentTextBoxAttribute = tba;
@@ -1040,9 +1061,17 @@
try {
if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic="
- + ic + " tba=" + tba + " initial=" + initial);
- InputBindResult res = mService.startInput(mClient,
- servedContext, tba, initial, true);
+ + ic + " tba=" + tba + " controlFlags=#"
+ + Integer.toHexString(controlFlags));
+ InputBindResult res;
+ if (windowGainingFocus != null) {
+ res = mService.windowGainedFocus(mClient, windowGainingFocus,
+ controlFlags, softInputMode, windowFlags,
+ tba, servedContext);
+ } else {
+ res = mService.startInput(mClient,
+ servedContext, tba, controlFlags);
+ }
if (DEBUG) Log.v(TAG, "Starting input: Bind result=" + res);
if (res != null) {
if (res.id != null) {
@@ -1051,7 +1080,7 @@
} else if (mCurMethod == null) {
// This means there is no input method available.
if (DEBUG) Log.v(TAG, "ABORT input: no input method!");
- return;
+ return true;
}
}
if (mCurMethod != null && mCompletions != null) {
@@ -1064,6 +1093,8 @@
Log.w(TAG, "IME died: " + mCurId, e);
}
}
+
+ return true;
}
/**
@@ -1139,27 +1170,26 @@
* @hide
*/
public void checkFocus() {
- if (checkFocusNoStartInput()) {
- startInputInner();
+ if (checkFocusNoStartInput(false)) {
+ startInputInner(null, 0, 0, 0);
}
}
- private boolean checkFocusNoStartInput() {
+ private boolean checkFocusNoStartInput(boolean forceNewFocus) {
// This is called a lot, so short-circuit before locking.
- if (mServedView == mNextServedView && !mNextServedNeedsStart) {
+ if (mServedView == mNextServedView && !forceNewFocus) {
return false;
}
InputConnection ic = null;
synchronized (mH) {
- if (mServedView == mNextServedView && !mNextServedNeedsStart) {
+ if (mServedView == mNextServedView && !forceNewFocus) {
return false;
}
if (DEBUG) Log.v(TAG, "checkFocus: view=" + mServedView
+ " next=" + mNextServedView
- + " restart=" + mNextServedNeedsStart);
+ + " forceNewFocus=" + forceNewFocus);
- mNextServedNeedsStart = false;
if (mNextServedView == null) {
finishInputLocked();
// In this case, we used to have a focused view on the window,
@@ -1190,13 +1220,14 @@
} catch (RemoteException e) {
}
}
-
+
/**
* Called by ViewAncestor when its window gets input focus.
* @hide
*/
public void onWindowFocus(View rootView, View focusedView, int softInputMode,
boolean first, int windowFlags) {
+ boolean forceNewFocus = false;
synchronized (mH) {
if (DEBUG) Log.v(TAG, "onWindowFocus: " + focusedView
+ " softInputMode=" + softInputMode
@@ -1205,26 +1236,41 @@
if (mHasBeenInactive) {
if (DEBUG) Log.v(TAG, "Has been inactive! Starting fresh");
mHasBeenInactive = false;
- mNextServedNeedsStart = true;
+ forceNewFocus = true;
}
focusInLocked(focusedView != null ? focusedView : rootView);
}
-
- boolean startInput = checkFocusNoStartInput();
-
- synchronized (mH) {
- try {
- final boolean isTextEditor = focusedView != null &&
- focusedView.onCheckIsTextEditor();
- mService.windowGainedFocus(mClient, rootView.getWindowToken(),
- focusedView != null, isTextEditor, softInputMode, first,
- windowFlags);
- } catch (RemoteException e) {
+
+ int controlFlags = 0;
+ if (focusedView != null) {
+ controlFlags |= CONTROL_WINDOW_VIEW_HAS_FOCUS;
+ if (focusedView.onCheckIsTextEditor()) {
+ controlFlags |= CONTROL_WINDOW_IS_TEXT_EDITOR;
}
}
-
- if (startInput) {
- startInputInner();
+ if (first) {
+ controlFlags |= CONTROL_WINDOW_FIRST;
+ }
+
+ if (checkFocusNoStartInput(forceNewFocus)) {
+ // We need to restart input on the current focus view. This
+ // should be done in conjunction with telling the system service
+ // about the window gaining focus, to help make the transition
+ // smooth.
+ if (startInputInner(rootView.getWindowToken(),
+ controlFlags, softInputMode, windowFlags)) {
+ return;
+ }
+ }
+
+ // For some reason we didn't do a startInput + windowFocusGain, so
+ // we'll just do a window focus gain and call it a day.
+ synchronized (mH) {
+ try {
+ mService.windowGainedFocus(mClient, rootView.getWindowToken(),
+ controlFlags, softInputMode, windowFlags, null, null);
+ } catch (RemoteException e) {
+ }
}
}
@@ -1676,8 +1722,7 @@
p.println(" mCurMethod=" + mCurMethod);
p.println(" mCurRootView=" + mCurRootView);
p.println(" mServedView=" + mServedView);
- p.println(" mNextServedNeedsStart=" + mNextServedNeedsStart
- + " mNextServedView=" + mNextServedView);
+ p.println(" mNextServedView=" + mNextServedView);
p.println(" mServedConnecting=" + mServedConnecting);
if (mCurrentTextBoxAttribute != null) {
p.println(" mCurrentTextBoxAttribute:");
diff --git a/core/java/android/webkit/SelectActionModeCallback.java b/core/java/android/webkit/SelectActionModeCallback.java
index cdf20f6..2a770f5 100644
--- a/core/java/android/webkit/SelectActionModeCallback.java
+++ b/core/java/android/webkit/SelectActionModeCallback.java
@@ -53,10 +53,8 @@
mode.getMenuInflater().inflate(com.android.internal.R.menu.webview_copy, menu);
final Context context = mWebView.getContext();
- boolean allowText = context.getResources().getBoolean(
- com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon);
- mode.setTitle(allowText ?
- context.getString(com.android.internal.R.string.textSelectionCABTitle) : null);
+ mode.setTitle(context.getString(com.android.internal.R.string.textSelectionCABTitle));
+ mode.setTitleOptionalHint(true);
// If the action mode UI we're running in isn't capable of taking window focus
// the user won't be able to type into the find on page UI. Disable this functionality.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index a399c32..b9dfb2e 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -556,17 +556,13 @@
&& TextUtils.regionMatches(text, 0, original, 0,
textLength);
}
- boolean sendChange = false;
if (isCharacterAdd) {
- sendChange = !sendCharacter(text.charAt(textLength - 1));
+ sendCharacter(text.charAt(textLength - 1));
} else if (isCharacterDelete) {
sendDeleteKey();
- } else {
- sendChange = (textLength != originalLength) ||
- !TextUtils.regionMatches(text, 0, original, 0,
- textLength);
- }
- if (sendChange) {
+ } else if ((textLength != originalLength) ||
+ !TextUtils.regionMatches(text, 0, original, 0,
+ textLength)) {
// Send a message so that key strokes and text replacement
// do not come out of order.
Message replaceMessage = mPrivateHandler.obtainMessage(
@@ -580,20 +576,21 @@
* Send a single character to the WebView as a key down and up event.
* @param c The character to be sent.
*/
- private boolean sendCharacter(char c) {
+ private void sendCharacter(char c) {
if (mKeyCharacterMap == null) {
mKeyCharacterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
}
char[] chars = new char[1];
chars[0] = c;
KeyEvent[] events = mKeyCharacterMap.getEvents(chars);
- boolean mapsToKeyEvent = (events != null);
- if (mapsToKeyEvent) {
+ if (events != null) {
for (KeyEvent event : events) {
sendKeyEvent(event);
}
+ } else {
+ Message msg = mPrivateHandler.obtainMessage(KEY_PRESS, (int) c, 0);
+ mPrivateHandler.sendMessage(msg);
}
- return mapsToKeyEvent;
}
/**
@@ -1031,6 +1028,7 @@
static final int INIT_EDIT_FIELD = 142;
static final int REPLACE_TEXT = 143;
static final int CLEAR_CARET_HANDLE = 144;
+ static final int KEY_PRESS = 145;
private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
private static final int LAST_PACKAGE_MSG_ID = HIT_TEST_RESULT;
@@ -9229,6 +9227,10 @@
selectionDone();
break;
+ case KEY_PRESS:
+ mWebViewCore.sendMessage(EventHub.KEY_PRESS, msg.arg1);
+ break;
+
default:
super.handleMessage(msg);
break;
@@ -9236,35 +9238,50 @@
}
}
+ 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;
- } else {
- mInitialHitTestResult = new HitTestResult();
- if (hit.mLinkUrl != null) {
- mInitialHitTestResult.mType = HitTestResult.SRC_ANCHOR_TYPE;
- mInitialHitTestResult.mExtra = hit.mLinkUrl;
- if (hit.mImageUrl != null) {
- mInitialHitTestResult.mType = HitTestResult.SRC_IMAGE_ANCHOR_TYPE;
- mInitialHitTestResult.mExtra = hit.mImageUrl;
- }
- } else if (hit.mImageUrl != null) {
- mInitialHitTestResult.mType = HitTestResult.IMAGE_TYPE;
+ return;
+ }
+ mInitialHitTestResult = new HitTestResult();
+ if (hit.mLinkUrl != 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;
- } else if (hit.mEditable) {
- mInitialHitTestResult.mType = HitTestResult.EDIT_TEXT_TYPE;
- } else if (hit.mIntentUrl != null) {
- if (hit.mIntentUrl.startsWith(SCHEME_GEO)) {
- mInitialHitTestResult.mType = HitTestResult.GEO_TYPE;
- String substr = hit.mIntentUrl.substring(SCHEME_GEO.length());
- try {
- mInitialHitTestResult.mExtra = URLDecoder.decode(substr, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- Log.w(LOGTAG, "Failed to decode GEO URL!", e);
- mInitialHitTestResult.mType = HitTestResult.UNKNOWN_TYPE;
- }
- }
}
+ } else if (hit.mImageUrl != null) {
+ mInitialHitTestResult.mType = HitTestResult.IMAGE_TYPE;
+ mInitialHitTestResult.mExtra = hit.mImageUrl;
+ } else if (hit.mEditable) {
+ mInitialHitTestResult.mType = HitTestResult.EDIT_TEXT_TYPE;
+ } else if (hit.mIntentUrl != null) {
+ setHitTestTypeFromUrl(hit.mIntentUrl);
}
}
@@ -9511,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/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 649e5c9..e7da1a8 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1173,8 +1173,11 @@
static final int TRUST_STORAGE_UPDATED = 220;
// find-on-page controls
- static final int FIND_ALL = 220;
- static final int FIND_NEXT = 221;
+ static final int FIND_ALL = 221;
+ static final int FIND_NEXT = 222;
+
+ // key was pressed (down and up)
+ static final int KEY_PRESS = 223;
// Private handler for WebCore messages.
private Handler mHandler;
@@ -1355,6 +1358,10 @@
key((KeyEvent) msg.obj, false);
break;
+ case KEY_PRESS:
+ keyPress(msg.arg1);
+ break;
+
case FAKE_CLICK:
nativeClick(mNativeClass, msg.arg1, msg.arg2, true);
break;
@@ -2061,6 +2068,11 @@
}
}
+ private void keyPress(int unicodeChar) {
+ nativeKey(mNativeClass, 0, unicodeChar, 0, false, false, false, true);
+ nativeKey(mNativeClass, 0, unicodeChar, 0, false, false, false, false);
+ }
+
// These values are used to avoid requesting a layout based on old values
private int mCurrentViewWidth = 0;
private int mCurrentViewHeight = 0;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a4087d5..d6dd15e 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -2980,8 +2980,7 @@
"/" + ss.selEnd + " out of range for " + restored +
"text " + mText);
} else {
- Selection.setSelection((Spannable) mText, ss.selStart,
- ss.selEnd);
+ Selection.setSelection((Spannable) mText, ss.selStart, ss.selEnd);
if (ss.frozenWithFocus) {
createEditorIfNeeded("restore instance with focus");
@@ -6983,6 +6982,9 @@
*/
protected void onSelectionChanged(int selStart, int selEnd) {
sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED);
+ // mEditor may be null if selection is created programatically.
+ createEditorIfNeeded("onSelectionChanged");
+ // Invalidate even when selection range is empty, to remove previous highlight
getEditor().mTextDisplayListIsValid = false;
}
@@ -8201,7 +8203,7 @@
vibrate = false;
}
- if (!handled && (mEditor == null || getEditor().mSelectionActionMode != null)) {
+ if (!handled && mEditor != null && getEditor().mSelectionActionMode != null) {
if (touchPositionIsInSelection()) {
// Start a drag
final int start = getSelectionStart();
@@ -10363,9 +10365,9 @@
boolean allowText = getContext().getResources().getBoolean(
com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon);
- mode.setTitle(allowText ?
- mContext.getString(com.android.internal.R.string.textSelectionCABTitle) : null);
+ mode.setTitle(mContext.getString(com.android.internal.R.string.textSelectionCABTitle));
mode.setSubtitle(null);
+ mode.setTitleOptionalHint(true);
int selectAllIconId = 0; // No icon by default
if (!allowText) {
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index afb5bf1..f3486bd 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -748,6 +748,16 @@
}
@Override
+ public void setTitleOptionalHint(boolean titleOptional) {
+ mContextView.setTitleOptional(titleOptional);
+ }
+
+ @Override
+ public boolean isTitleOptional() {
+ return mContextView.isTitleOptional();
+ }
+
+ @Override
public View getCustomView() {
return mCustomView != null ? mCustomView.get() : null;
}
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/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl
index 5d80b79..82b2654 100644
--- a/core/java/com/android/internal/view/IInputMethodManager.aidl
+++ b/core/java/com/android/internal/view/IInputMethodManager.aidl
@@ -43,16 +43,17 @@
void removeClient(in IInputMethodClient client);
InputBindResult startInput(in IInputMethodClient client,
- IInputContext inputContext, in EditorInfo attribute,
- boolean initial, boolean needResult);
+ IInputContext inputContext, in EditorInfo attribute, int controlFlags);
void finishInput(in IInputMethodClient client);
boolean showSoftInput(in IInputMethodClient client, int flags,
in ResultReceiver resultReceiver);
boolean hideSoftInput(in IInputMethodClient client, int flags,
in ResultReceiver resultReceiver);
- void windowGainedFocus(in IInputMethodClient client, in IBinder windowToken,
- boolean viewHasFocus, boolean isTextEditor,
- int softInputMode, boolean first, int windowFlags);
+ // Report that a window has gained focus. If 'attribute' is non-null,
+ // this will also do a startInput.
+ InputBindResult windowGainedFocus(in IInputMethodClient client, in IBinder windowToken,
+ int controlFlags, int softInputMode, int windowFlags,
+ in EditorInfo attribute, IInputContext inputContext);
void showInputMethodPickerFromClient(in IInputMethodClient client);
void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId);
diff --git a/core/java/com/android/internal/view/StandaloneActionMode.java b/core/java/com/android/internal/view/StandaloneActionMode.java
index edf4443..4b681ec 100644
--- a/core/java/com/android/internal/view/StandaloneActionMode.java
+++ b/core/java/com/android/internal/view/StandaloneActionMode.java
@@ -72,6 +72,16 @@
}
@Override
+ public void setTitleOptionalHint(boolean titleOptional) {
+ mContextView.setTitleOptional(titleOptional);
+ }
+
+ @Override
+ public boolean isTitleOptional() {
+ return mContextView.isTitleOptional();
+ }
+
+ @Override
public void setCustomView(View view) {
mContextView.setCustomView(view);
mCustomView = view != null ? new WeakReference<View>(view) : null;
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index fa16527..16f08f5 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -56,6 +56,7 @@
private int mTitleStyleRes;
private int mSubtitleStyleRes;
private Drawable mSplitBackground;
+ private boolean mTitleOptional;
private Animator mCurrentAnimation;
private boolean mAnimateInOnLayout;
@@ -354,7 +355,18 @@
}
if (mTitleLayout != null && mCustomView == null) {
- availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
+ if (mTitleOptional) {
+ final int titleWidthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
+ mTitleLayout.measure(titleWidthSpec, childSpecHeight);
+ final int titleWidth = mTitleLayout.getMeasuredWidth();
+ final boolean titleFits = titleWidth <= availableWidth;
+ if (titleFits) {
+ availableWidth -= titleWidth;
+ }
+ mTitleLayout.setVisibility(titleFits ? VISIBLE : GONE);
+ } else {
+ availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
+ }
}
if (mCustomView != null) {
@@ -460,7 +472,7 @@
}
}
- if (mTitleLayout != null && mCustomView == null) {
+ if (mTitleLayout != null && mCustomView == null && mTitleLayout.getVisibility() != GONE) {
x += positionChild(mTitleLayout, x, y, contentHeight);
}
@@ -512,4 +524,15 @@
super.onInitializeAccessibilityEvent(event);
}
}
+
+ public void setTitleOptional(boolean titleOptional) {
+ if (titleOptional != mTitleOptional) {
+ requestLayout();
+ }
+ mTitleOptional = titleOptional;
+ }
+
+ public boolean isTitleOptional() {
+ return mTitleOptional;
+ }
}
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/docs/html/sdk/ndk/overview.jd b/docs/html/sdk/ndk/overview.jd
index 85599f7..e969f5d 100644
--- a/docs/html/sdk/ndk/overview.jd
+++ b/docs/html/sdk/ndk/overview.jd
@@ -46,7 +46,7 @@
<li>Documentation, samples, and tutorials</li>
</ul>
- <p>The latest release of the NDK supports these ARM instruction sets:</p>
+ <p>The latest release of the NDK supports the following instruction sets:</p>
<ul>
<li>ARMv5TE (including Thumb-1 instructions)</li>
diff --git a/drm/java/android/drm/DrmErrorEvent.java b/drm/java/android/drm/DrmErrorEvent.java
index 2cb82e6..c61819d 100755
--- a/drm/java/android/drm/DrmErrorEvent.java
+++ b/drm/java/android/drm/DrmErrorEvent.java
@@ -24,6 +24,10 @@
*
*/
public class DrmErrorEvent extends DrmEvent {
+
+ // Please add newly defined type constants to the end of the list,
+ // and modify checkTypeValidity() accordingly.
+
/**
* Something went wrong installing the rights.
*/
@@ -60,28 +64,46 @@
*/
public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
+ // Add more type constants here...
+
+ // FIXME:
+ // We may want to add a user-defined type constant, such as
+ // TYPE_VENDOR_SPECIFIC_FAILED, to take care vendor specific use
+ // cases.
+
+
/**
* Creates a <code>DrmErrorEvent</code> object with the specified parameters.
*
* @param uniqueId Unique session identifier.
- * @param type Type of the event. Could be any of the event types defined above.
- * @param message Message description.
+ * @param type Type of the event. Must be any of the event types defined above.
+ * @param message Message description. It can be null.
*/
public DrmErrorEvent(int uniqueId, int type, String message) {
super(uniqueId, type, message);
+ checkTypeValidity(type);
}
/**
* Creates a <code>DrmErrorEvent</code> object with the specified parameters.
*
* @param uniqueId Unique session identifier.
- * @param type Type of the event. Could be any of the event types defined above.
+ * @param type Type of the event. Must be any of the event types defined above.
* @param message Message description.
* @param attributes Attributes for extensible information. Could be any
- * information provided by the plug-in.
+ * information provided by the plug-in. It can be null.
*/
public DrmErrorEvent(int uniqueId, int type, String message,
HashMap<String, Object> attributes) {
super(uniqueId, type, message, attributes);
+ checkTypeValidity(type);
+ }
+
+ private void checkTypeValidity(int type) {
+ if (type < TYPE_RIGHTS_NOT_INSTALLED ||
+ type > TYPE_ACQUIRE_DRM_INFO_FAILED) {
+ final String msg = "Unsupported type: " + type;
+ throw new IllegalArgumentException(msg);
+ }
}
}
diff --git a/drm/java/android/drm/DrmEvent.java b/drm/java/android/drm/DrmEvent.java
index 4053eb3..1a19f5c 100755
--- a/drm/java/android/drm/DrmEvent.java
+++ b/drm/java/android/drm/DrmEvent.java
@@ -23,6 +23,10 @@
*
*/
public class DrmEvent {
+
+ // Please do not add type constants in this class. More event type constants
+ // should go to DrmInfoEvent or DrmErrorEvent classes.
+
/**
* All of the rights information associated with all DRM schemes have been successfully removed.
*/
diff --git a/drm/java/android/drm/DrmInfoEvent.java b/drm/java/android/drm/DrmInfoEvent.java
index 67aa0a9..2826dce 100755
--- a/drm/java/android/drm/DrmInfoEvent.java
+++ b/drm/java/android/drm/DrmInfoEvent.java
@@ -24,6 +24,10 @@
*
*/
public class DrmInfoEvent extends DrmEvent {
+
+ // Please add newly defined type constants to the end of the list,
+ // and modify checkTypeValidity() accordingly.
+
/**
* The registration has already been done by another account ID.
*/
@@ -50,29 +54,57 @@
*/
public static final int TYPE_RIGHTS_REMOVED = 6;
+ // Add more type constants here...
+
+ // FIXME:
+ // We may want to add a user-defined type constant, such as
+ // TYPE_VENDOR_SPECIFIC, to take care vendor specific use
+ // cases.
+
/**
* Creates a <code>DrmInfoEvent</code> object with the specified parameters.
*
* @param uniqueId Unique session identifier.
- * @param type Type of the event. Could be any of the event types defined above.
- * @param message Message description.
+ * @param type Type of the event. Must be any of the event types defined above,
+ * or the constants defined in {@link DrmEvent}.
+ * @param message Message description. It can be null.
*/
public DrmInfoEvent(int uniqueId, int type, String message) {
super(uniqueId, type, message);
+ checkTypeValidity(type);
}
/**
* Creates a <code>DrmInfoEvent</code> object with the specified parameters.
*
* @param uniqueId Unique session identifier.
- * @param type Type of the event. Could be any of the event types defined above.
- * @param message Message description.
+ * @param type Type of the event. Must be any of the event types defined above,
+ * or the constants defined in {@link DrmEvent}
+ * @param message Message description. It can be null.
* @param attributes Attributes for extensible information. Could be any
* information provided by the plug-in.
*/
public DrmInfoEvent(int uniqueId, int type, String message,
HashMap<String, Object> attributes) {
super(uniqueId, type, message, attributes);
+ checkTypeValidity(type);
+ }
+
+ /*
+ * Check the validity of the given type.
+ * To overcome a design flaw, we need also accept the type constants
+ * defined in super class, DrmEvent.
+ */
+ private void checkTypeValidity(int type) {
+ if (type < TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT ||
+ type > TYPE_RIGHTS_REMOVED) {
+
+ if (type != TYPE_ALL_RIGHTS_REMOVED &&
+ type != TYPE_DRM_INFO_PROCESSED) {
+ final String msg = "Unsupported type: " + type;
+ throw new IllegalArgumentException(msg);
+ }
+ }
}
}
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index 9a7194c..14d5fae 100755
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -317,6 +317,7 @@
*
* @return A {@link android.content.ContentValues} instance that contains
* key-value pairs representing the constraints. Null in case of failure.
+ * The keys are defined in {@link DrmStore.ConstraintsColumns}.
*/
public ContentValues getConstraints(String path, int action) {
if (null == path || path.equals("") || !DrmStore.Action.isValid(action)) {
diff --git a/drm/java/android/drm/DrmStore.java b/drm/java/android/drm/DrmStore.java
index ae311de..2f004cf 100755
--- a/drm/java/android/drm/DrmStore.java
+++ b/drm/java/android/drm/DrmStore.java
@@ -23,45 +23,65 @@
public class DrmStore {
/**
* Interface definition for the columns that represent DRM constraints.
+ * {@link android.drm.DrmManagerClient#getConstraints DrmManagerClient.getConstraints()}
+ * can be called by an application to find out the contraints on the
+ * {@link android.drm.DrmStore.Action actions} that can be performed
+ * on right-protected content. The constants defined in this interface
+ * represent three most common types of constraints: count-based,
+ * date-based, and duration-based. Two or more constraints can be used
+ * at the same time to represent more sophisticated constraints.
+ * In addition, user-defined constraint,
+ * {@link #EXTENDED_METADATA extended metadata}, can be
+ * used if these three types of constraints are not sufficient.
*/
public interface ConstraintsColumns {
/**
- * The maximum repeat count.
+ * This is a count-based constraint. It represents the maximum
+ * repeat count that can be performed on an
+ * {@link android.drm.DrmStore.Action action}.
* <p>
* Type: INTEGER
*/
public static final String MAX_REPEAT_COUNT = "max_repeat_count";
/**
- * The remaining repeat count.
+ * This is a count-based constraint. It represents the remaining
+ * repeat count that can be performed on an
+ * {@link android.drm.DrmStore.Action action}.
* <p>
* Type: INTEGER
*/
public static final String REMAINING_REPEAT_COUNT = "remaining_repeat_count";
/**
- * The time before which the rights-protected file cannot be played/viewed.
+ * This is a date-based constraint. It represents the time before which
+ * an {@link android.drm.DrmStore.Action action} can be performed on
+ * the rights-protected content.
* <p>
* Type: TEXT
*/
public static final String LICENSE_START_TIME = "license_start_time";
/**
- * The time after which the rights-protected file cannot be played/viewed.
+ * This is a date-based constaint. It represents the time after which
+ * an {@link android.drm.DrmStore.Action action} can not be performed on
+ * the rights-protected content.
* <p>
* Type: TEXT
*/
public static final String LICENSE_EXPIRY_TIME = "license_expiry_time";
/**
- * The available time left before the license expires.
+ * This is a duration-based constaint. It represents the available time left
+ * before the license expires.
* <p>
* Type: TEXT
*/
public static final String LICENSE_AVAILABLE_TIME = "license_available_time";
/**
- * The data stream for extended metadata.
+ * This is a user-defined constraint. It represents the additional constraint
+ * using extended metadata.
* <p>
* Type: TEXT
*/
diff --git a/graphics/java/android/graphics/PixelFormat.java b/graphics/java/android/graphics/PixelFormat.java
index 182f14d..f7c202f 100644
--- a/graphics/java/android/graphics/PixelFormat.java
+++ b/graphics/java/android/graphics/PixelFormat.java
@@ -39,11 +39,15 @@
public static final int RGB_888 = 3;
public static final int RGB_565 = 4;
+ @Deprecated
public static final int RGBA_5551 = 6;
+ @Deprecated
public static final int RGBA_4444 = 7;
public static final int A_8 = 8;
public static final int L_8 = 9;
+ @Deprecated
public static final int LA_88 = 0xA;
+ @Deprecated
public static final int RGB_332 = 0xB;
diff --git a/include/ui/EGLUtils.h b/include/ui/EGLUtils.h
deleted file mode 100644
index a5bff81..0000000
--- a/include/ui/EGLUtils.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef ANDROID_UI_EGLUTILS_H
-#define ANDROID_UI_EGLUTILS_H
-
-#include <utils/Errors.h>
-#include <ui/PixelFormat.h>
-#include <EGL/egl.h>
-
-
-// ----------------------------------------------------------------------------
-namespace android {
-// ----------------------------------------------------------------------------
-
-class EGLUtils
-{
-public:
-
- static const char *strerror(EGLint err);
-
- static status_t selectConfigForPixelFormat(
- EGLDisplay dpy,
- EGLint const* attrs,
- PixelFormat format,
- EGLConfig* outConfig);
-
- static status_t selectConfigForNativeWindow(
- EGLDisplay dpy,
- EGLint const* attrs,
- EGLNativeWindowType window,
- EGLConfig* outConfig);
-};
-
-// ----------------------------------------------------------------------------
-}; // namespace android
-// ----------------------------------------------------------------------------
-
-#endif /* ANDROID_UI_EGLUTILS_H */
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
index fc260c4..9f3e267 100644
--- a/include/ui/PixelFormat.h
+++ b/include/ui/PixelFormat.h
@@ -64,9 +64,6 @@
PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB
PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB
PIXEL_FORMAT_A_8 = 8, // 8-bit A
-
- // New formats can be added if they're also defined in
- // pixelflinger/format.h
};
typedef int32_t PixelFormat;
@@ -80,10 +77,12 @@
};
enum { // components
- ALPHA = 1,
- RGB = 2,
- RGBA = 3,
- OTHER = 0xFF
+ ALPHA = 1,
+ RGB = 2,
+ RGBA = 3,
+ L = 4,
+ LA = 5,
+ OTHER = 0xFF
};
struct szinfo {
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 90a7145..4a299c6 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -462,6 +462,7 @@
SkPath* pathCopy = mPathMap.valueFor(path);
if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
pathCopy = new SkPath(*path);
+ pathCopy->setSourcePath(path);
// replaceValueFor() performs an add if the entry doesn't exist
mPathMap.replaceValueFor(path, pathCopy);
mPaths.add(pathCopy);
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp
index e09c243..e363b73 100644
--- a/libs/hwui/PathCache.cpp
+++ b/libs/hwui/PathCache.cpp
@@ -83,6 +83,11 @@
}
PathTexture* PathCache::get(SkPath* path, SkPaint* paint) {
+ const SkPath* sourcePath = path->getSourcePath();
+ if (sourcePath && sourcePath->getGenerationID() == path->getGenerationID()) {
+ path = const_cast<SkPath*>(sourcePath);
+ }
+
PathCacheEntry entry(path, paint);
PathTexture* texture = mCache.get(entry);
diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp
index b136cc7..7c668573 100644
--- a/libs/rs/driver/rsdGL.cpp
+++ b/libs/rs/driver/rsdGL.cpp
@@ -16,7 +16,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/PixelFormat.h>
-#include <ui/EGLUtils.h>
#include <ui/egl/android_natives.h>
#include <sys/types.h>
@@ -47,6 +46,29 @@
static int32_t gGLContextCount = 0;
static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE) {
+ struct EGLUtils {
+ static const char *strerror(EGLint err) {
+ switch (err){
+ case EGL_SUCCESS: return "EGL_SUCCESS";
+ case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
+ case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
+ case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
+ case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
+ case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
+ case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
+ case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
+ case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
+ case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
+ case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
+ case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
+ case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
+ case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
+ default: return "UNKNOWN";
+ }
+ }
+ };
+
if (returnVal != EGL_TRUE) {
fprintf(stderr, "%s() returned %d\n", op, returnVal);
}
diff --git a/libs/ui/Android.mk b/libs/ui/Android.mk
index c029291..5aff7a4 100644
--- a/libs/ui/Android.mk
+++ b/libs/ui/Android.mk
@@ -16,7 +16,6 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- EGLUtils.cpp \
FramebufferNativeWindow.cpp \
GraphicBuffer.cpp \
GraphicBufferAllocator.cpp \
@@ -28,7 +27,6 @@
LOCAL_SHARED_LIBRARIES := \
libcutils \
libutils \
- libEGL \
libhardware
ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),)
diff --git a/libs/ui/PixelFormat.cpp b/libs/ui/PixelFormat.cpp
index 6993dac..fc1d3c2 100644
--- a/libs/ui/PixelFormat.cpp
+++ b/libs/ui/PixelFormat.cpp
@@ -48,7 +48,10 @@
{ 4, 32, {32,24, 24,16, 16, 8, 8, 0 }, PixelFormatInfo::RGBA },
{ 2, 16, { 1, 0, 16,11, 11, 6, 6, 1 }, PixelFormatInfo::RGBA },
{ 2, 16, { 4, 0, 16,12, 12, 8, 8, 4 }, PixelFormatInfo::RGBA },
- { 1, 8, { 8, 0, 0, 0, 0, 0, 0, 0 }, PixelFormatInfo::ALPHA}
+ { 1, 8, { 8, 0, 0, 0, 0, 0, 0, 0 }, PixelFormatInfo::ALPHA},
+ { 1, 8, { 0, 0, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::L },
+ { 2, 16, {16, 8, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::LA },
+ { 1, 8, { 0, 0, 8, 5, 5, 2, 2, 0 }, PixelFormatInfo::RGB },
};
static const Info* gGetPixelFormatTable(size_t* numEntries) {
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/media/libstagefright/timedtext/Android.mk b/media/libstagefright/timedtext/Android.mk
index 8b23dee..dde2066 100644
--- a/media/libstagefright/timedtext/Android.mk
+++ b/media/libstagefright/timedtext/Android.mk
@@ -4,7 +4,7 @@
LOCAL_SRC_FILES:= \
TextDescriptions.cpp \
TimedTextDriver.cpp \
- TimedTextInBandSource.cpp \
+ TimedText3GPPSource.cpp \
TimedTextSource.cpp \
TimedTextSRTSource.cpp \
TimedTextPlayer.cpp
@@ -12,8 +12,7 @@
LOCAL_CFLAGS += -Wno-multichar
LOCAL_C_INCLUDES:= \
$(JNI_H_INCLUDE) \
- $(TOP)/frameworks/base/media/libstagefright \
- $(TOP)/frameworks/base/include/media/stagefright/openmax
+ $(TOP)/frameworks/base/media/libstagefright
LOCAL_MODULE:= libstagefright_timedtext
diff --git a/media/libstagefright/timedtext/TimedTextInBandSource.cpp b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
similarity index 63%
rename from media/libstagefright/timedtext/TimedTextInBandSource.cpp
rename to media/libstagefright/timedtext/TimedText3GPPSource.cpp
index afb73fb..4a3bfd3 100644
--- a/media/libstagefright/timedtext/TimedTextInBandSource.cpp
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.cpp
@@ -15,7 +15,7 @@
*/
//#define LOG_NDEBUG 0
-#define LOG_TAG "TimedTextInBandSource"
+#define LOG_TAG "TimedText3GPPSource"
#include <utils/Log.h>
#include <binder/Parcel.h>
@@ -26,19 +26,19 @@
#include <media/stagefright/MediaSource.h>
#include <media/stagefright/MetaData.h>
-#include "TimedTextInBandSource.h"
+#include "TimedText3GPPSource.h"
#include "TextDescriptions.h"
namespace android {
-TimedTextInBandSource::TimedTextInBandSource(const sp<MediaSource>& mediaSource)
+TimedText3GPPSource::TimedText3GPPSource(const sp<MediaSource>& mediaSource)
: mSource(mediaSource) {
}
-TimedTextInBandSource::~TimedTextInBandSource() {
+TimedText3GPPSource::~TimedText3GPPSource() {
}
-status_t TimedTextInBandSource::read(
+status_t TimedText3GPPSource::read(
int64_t *timeUs, Parcel *parcel, const MediaSource::ReadOptions *options) {
MediaBuffer *textBuffer = NULL;
status_t err = mSource->read(&textBuffer, options);
@@ -60,7 +60,7 @@
// text style for the string of text. These descriptions are present only
// if they are needed. This method is used to extract the modifier
// description and append it at the end of the text.
-status_t TimedTextInBandSource::extractAndAppendLocalDescriptions(
+status_t TimedText3GPPSource::extractAndAppendLocalDescriptions(
int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel) {
const void *data;
size_t size = 0;
@@ -68,51 +68,46 @@
const char *mime;
CHECK(mSource->getFormat()->findCString(kKeyMIMEType, &mime));
+ CHECK(strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) == 0);
- if (strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) == 0) {
- data = textBuffer->data();
- size = textBuffer->size();
+ data = textBuffer->data();
+ size = textBuffer->size();
- if (size > 0) {
- parcel->freeData();
- flag |= TextDescriptions::IN_BAND_TEXT_3GPP;
- return TextDescriptions::getParcelOfDescriptions(
- (const uint8_t *)data, size, flag, timeUs / 1000, parcel);
- }
- return OK;
+ if (size > 0) {
+ parcel->freeData();
+ flag |= TextDescriptions::IN_BAND_TEXT_3GPP;
+ return TextDescriptions::getParcelOfDescriptions(
+ (const uint8_t *)data, size, flag, timeUs / 1000, parcel);
}
- return ERROR_UNSUPPORTED;
+ return OK;
}
// To extract and send the global text descriptions for all the text samples
// in the text track or text file.
// TODO: send error message to application via notifyListener()...?
-status_t TimedTextInBandSource::extractGlobalDescriptions(Parcel *parcel) {
+status_t TimedText3GPPSource::extractGlobalDescriptions(Parcel *parcel) {
const void *data;
size_t size = 0;
int32_t flag = TextDescriptions::GLOBAL_DESCRIPTIONS;
const char *mime;
CHECK(mSource->getFormat()->findCString(kKeyMIMEType, &mime));
+ CHECK(strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) == 0);
- // support 3GPP only for now
- if (strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) == 0) {
- uint32_t type;
- // get the 'tx3g' box content. This box contains the text descriptions
- // used to render the text track
- if (!mSource->getFormat()->findData(
- kKeyTextFormatData, &type, &data, &size)) {
- return ERROR_MALFORMED;
- }
-
- if (size > 0) {
- flag |= TextDescriptions::IN_BAND_TEXT_3GPP;
- return TextDescriptions::getParcelOfDescriptions(
- (const uint8_t *)data, size, flag, 0, parcel);
- }
- return OK;
+ uint32_t type;
+ // get the 'tx3g' box content. This box contains the text descriptions
+ // used to render the text track
+ if (!mSource->getFormat()->findData(
+ kKeyTextFormatData, &type, &data, &size)) {
+ return ERROR_MALFORMED;
}
- return ERROR_UNSUPPORTED;
+
+ if (size > 0) {
+ flag |= TextDescriptions::IN_BAND_TEXT_3GPP;
+ return TextDescriptions::getParcelOfDescriptions(
+ (const uint8_t *)data, size, flag, 0, parcel);
+ }
+ return OK;
}
} // namespace android
diff --git a/media/libstagefright/timedtext/TimedTextInBandSource.h b/media/libstagefright/timedtext/TimedText3GPPSource.h
similarity index 80%
rename from media/libstagefright/timedtext/TimedTextInBandSource.h
rename to media/libstagefright/timedtext/TimedText3GPPSource.h
index 26e5737..cb7e47c 100644
--- a/media/libstagefright/timedtext/TimedTextInBandSource.h
+++ b/media/libstagefright/timedtext/TimedText3GPPSource.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef TIMED_TEXT_IN_BAND_SOURCE_H_
-#define TIMED_TEXT_IN_BAND_SOURCE_H_
+#ifndef TIMED_TEXT_3GPP_SOURCE_H_
+#define TIMED_TEXT_3GPP_SOURCE_H_
#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/MediaSource.h>
@@ -27,9 +27,9 @@
class MediaBuffer;
class Parcel;
-class TimedTextInBandSource : public TimedTextSource {
+class TimedText3GPPSource : public TimedTextSource {
public:
- TimedTextInBandSource(const sp<MediaSource>& mediaSource);
+ TimedText3GPPSource(const sp<MediaSource>& mediaSource);
virtual status_t start() { return mSource->start(); }
virtual status_t stop() { return mSource->stop(); }
virtual status_t read(
@@ -39,7 +39,7 @@
virtual status_t extractGlobalDescriptions(Parcel *parcel);
protected:
- virtual ~TimedTextInBandSource();
+ virtual ~TimedText3GPPSource();
private:
sp<MediaSource> mSource;
@@ -47,9 +47,9 @@
status_t extractAndAppendLocalDescriptions(
int64_t timeUs, const MediaBuffer *textBuffer, Parcel *parcel);
- DISALLOW_EVIL_CONSTRUCTORS(TimedTextInBandSource);
+ DISALLOW_EVIL_CONSTRUCTORS(TimedText3GPPSource);
};
} // namespace android
-#endif // TIMED_TEXT_IN_BAND_SOURCE_H_
+#endif // TIMED_TEXT_3GPP_SOURCE_H_
diff --git a/media/libstagefright/timedtext/TimedTextSource.cpp b/media/libstagefright/timedtext/TimedTextSource.cpp
index 9efe67c..ffbe1c3 100644
--- a/media/libstagefright/timedtext/TimedTextSource.cpp
+++ b/media/libstagefright/timedtext/TimedTextSource.cpp
@@ -18,12 +18,15 @@
#define LOG_TAG "TimedTextSource"
#include <utils/Log.h>
+#include <media/stagefright/foundation/ADebug.h> // CHECK_XX macro
#include <media/stagefright/DataSource.h>
+#include <media/stagefright/MediaDefs.h> // for MEDIA_MIMETYPE_xxx
#include <media/stagefright/MediaSource.h>
+#include <media/stagefright/MetaData.h>
#include "TimedTextSource.h"
-#include "TimedTextInBandSource.h"
+#include "TimedText3GPPSource.h"
#include "TimedTextSRTSource.h"
namespace android {
@@ -31,7 +34,13 @@
// static
sp<TimedTextSource> TimedTextSource::CreateTimedTextSource(
const sp<MediaSource>& mediaSource) {
- return new TimedTextInBandSource(mediaSource);
+ const char *mime;
+ CHECK(mediaSource->getFormat()->findCString(kKeyMIMEType, &mime));
+ if (strcasecmp(mime, MEDIA_MIMETYPE_TEXT_3GPP) == 0) {
+ return new TimedText3GPPSource(mediaSource);
+ }
+ ALOGE("Unsupported mime type for subtitle. : %s", mime);
+ return NULL;
}
// static
diff --git a/opengl/tests/angeles/Android.mk b/opengl/tests/angeles/Android.mk
index d0c3221..84b754b 100644
--- a/opengl/tests/angeles/Android.mk
+++ b/opengl/tests/angeles/Android.mk
@@ -4,14 +4,7 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm
LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
LOCAL_MODULE:= angeles
LOCAL_MODULE_TAGS := optional
include $(BUILD_EXECUTABLE)
-
-
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= gpustate.c
-LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM
-LOCAL_MODULE:= gpustate
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_EXECUTABLE)
diff --git a/opengl/tests/angeles/app-linux.cpp b/opengl/tests/angeles/app-linux.cpp
index 4d10ee5..6ac68a2 100644
--- a/opengl/tests/angeles/app-linux.cpp
+++ b/opengl/tests/angeles/app-linux.cpp
@@ -53,7 +53,7 @@
#include <GLES/gl.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/angeles/gpustate.c b/opengl/tests/angeles/gpustate.c
deleted file mode 100644
index 3c540c9..0000000
--- a/opengl/tests/angeles/gpustate.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-static void *map_memory(const char *fn, unsigned base, unsigned size)
-{
- int fd;
- void *ptr;
-
- fd = open(fn, O_RDWR | O_SYNC);
- if(fd < 0) {
- perror("cannot open %s for mapping");
- return MAP_FAILED;
- }
-
- ptr = mmap(0, size, PROT_READ | PROT_WRITE,
- MAP_SHARED, fd, base);
- close(fd);
-
- if(ptr == MAP_FAILED) {
- fprintf(stderr,"cannot map %s (@%08x,%08x)\n", fn, base, size);
- }
- return ptr;
-}
-
-
-int main(int argc, char** argv)
-{
- void *grp_regs = map_memory("/dev/hw3d", 0, 1024 * 1024);
- printf("GPU base mapped at %p\n", grp_regs);
- int state_offset = 0x10140;
- printf("GPU state = %08lx\n",
- *((long*)((char*)grp_regs + state_offset)) );
-
- return 0;
-}
diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk
index 191c59b..835f858 100644
--- a/opengl/tests/fillrate/Android.mk
+++ b/opengl/tests/fillrate/Android.mk
@@ -11,6 +11,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-fillrate
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/fillrate/fillrate.cpp b/opengl/tests/fillrate/fillrate.cpp
index 911d354..a708647 100644
--- a/opengl/tests/fillrate/fillrate.cpp
+++ b/opengl/tests/fillrate/fillrate.cpp
@@ -26,7 +26,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/filter/Android.mk b/opengl/tests/filter/Android.mk
index a254127..d780362 100644
--- a/opengl/tests/filter/Android.mk
+++ b/opengl/tests/filter/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-filter
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/filter/filter.cpp b/opengl/tests/filter/filter.cpp
index 2351909..0067327 100644
--- a/opengl/tests/filter/filter.cpp
+++ b/opengl/tests/filter/filter.cpp
@@ -6,7 +6,7 @@
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk
index aa607c6..8f4f9c3 100644
--- a/opengl/tests/finish/Android.mk
+++ b/opengl/tests/finish/Android.mk
@@ -11,6 +11,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-finish
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/finish/finish.cpp b/opengl/tests/finish/finish.cpp
index 91f5c45..11f0c22 100644
--- a/opengl/tests/finish/finish.cpp
+++ b/opengl/tests/finish/finish.cpp
@@ -27,7 +27,7 @@
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/gl2_basic/Android.mk b/opengl/tests/gl2_basic/Android.mk
index a642eaf..07469a0 100644
--- a/opengl/tests/gl2_basic/Android.mk
+++ b/opengl/tests/gl2_basic/Android.mk
@@ -10,6 +10,8 @@
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_basic
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl2_basic/gl2_basic.cpp b/opengl/tests/gl2_basic/gl2_basic.cpp
index f274c7c..7007871 100644
--- a/opengl/tests/gl2_basic/gl2_basic.cpp
+++ b/opengl/tests/gl2_basic/gl2_basic.cpp
@@ -27,7 +27,7 @@
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/gl2_copyTexImage/Android.mk b/opengl/tests/gl2_copyTexImage/Android.mk
index bef1f90..b616428 100644
--- a/opengl/tests/gl2_copyTexImage/Android.mk
+++ b/opengl/tests/gl2_copyTexImage/Android.mk
@@ -10,6 +10,8 @@
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_copyTexImage
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
index c2bfdec..988d7ac 100644
--- a/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
+++ b/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp
@@ -27,7 +27,7 @@
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/gl2_yuvtex/Android.mk b/opengl/tests/gl2_yuvtex/Android.mk
index 6304700..e36f319 100644
--- a/opengl/tests/gl2_yuvtex/Android.mk
+++ b/opengl/tests/gl2_yuvtex/Android.mk
@@ -10,6 +10,8 @@
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_yuvtex
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
index f0b8d12..d3e4932 100644
--- a/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
+++ b/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp
@@ -29,7 +29,7 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/gl_basic/Android.mk b/opengl/tests/gl_basic/Android.mk
index 6b6341f..2ba327b 100644
--- a/opengl/tests/gl_basic/Android.mk
+++ b/opengl/tests/gl_basic/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl_basic
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl_basic/gl_basic.cpp b/opengl/tests/gl_basic/gl_basic.cpp
index 0cc8398..23ce934 100644
--- a/opengl/tests/gl_basic/gl_basic.cpp
+++ b/opengl/tests/gl_basic/gl_basic.cpp
@@ -6,7 +6,7 @@
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <stdio.h>
diff --git a/opengl/tests/gl_perf/Android.mk b/opengl/tests/gl_perf/Android.mk
index 37647ca..f32abd3 100644
--- a/opengl/tests/gl_perf/Android.mk
+++ b/opengl/tests/gl_perf/Android.mk
@@ -11,6 +11,8 @@
libGLESv2 \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl2_perf
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl_perf/gl2_perf.cpp b/opengl/tests/gl_perf/gl2_perf.cpp
index 9dfcf1c..224acaf 100644
--- a/opengl/tests/gl_perf/gl2_perf.cpp
+++ b/opengl/tests/gl_perf/gl2_perf.cpp
@@ -27,7 +27,7 @@
#include <utils/Timers.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/gl_yuvtex/Android.mk b/opengl/tests/gl_yuvtex/Android.mk
index a78db25..5b87f2e 100644
--- a/opengl/tests/gl_yuvtex/Android.mk
+++ b/opengl/tests/gl_yuvtex/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-gl_yuvtex
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
index fbe65f1..7a00f76 100644
--- a/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
+++ b/opengl/tests/gl_yuvtex/gl_yuvtex.cpp
@@ -29,7 +29,7 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/hwc/hwcColorEquiv.cpp b/opengl/tests/hwc/hwcColorEquiv.cpp
index 1d03948..bb305dc 100644
--- a/opengl/tests/hwc/hwcColorEquiv.cpp
+++ b/opengl/tests/hwc/hwcColorEquiv.cpp
@@ -87,7 +87,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcColorEquivTest"
#include <utils/Log.h>
diff --git a/opengl/tests/hwc/hwcCommit.cpp b/opengl/tests/hwc/hwcCommit.cpp
index 66ccdae..685dc5d 100644
--- a/opengl/tests/hwc/hwcCommit.cpp
+++ b/opengl/tests/hwc/hwcCommit.cpp
@@ -98,7 +98,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcCommitTest"
#include <utils/Log.h>
diff --git a/opengl/tests/hwc/hwcRects.cpp b/opengl/tests/hwc/hwcRects.cpp
index 523e3de..80cde23 100644
--- a/opengl/tests/hwc/hwcRects.cpp
+++ b/opengl/tests/hwc/hwcRects.cpp
@@ -106,7 +106,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcRectsTest"
#include <utils/Log.h>
diff --git a/opengl/tests/hwc/hwcStress.cpp b/opengl/tests/hwc/hwcStress.cpp
index 1cefb4b..7d7bc1f 100644
--- a/opengl/tests/hwc/hwcStress.cpp
+++ b/opengl/tests/hwc/hwcStress.cpp
@@ -103,7 +103,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#define LOG_TAG "hwcStressTest"
#include <utils/Log.h>
diff --git a/opengl/tests/hwc/hwcTestLib.cpp b/opengl/tests/hwc/hwcTestLib.cpp
index 925405e..63f42ba 100644
--- a/opengl/tests/hwc/hwcTestLib.cpp
+++ b/opengl/tests/hwc/hwcTestLib.cpp
@@ -27,6 +27,8 @@
#include <hwc/hwcTestLib.h>
+#include "EGLUtils.h"
+
// Defines
#define NUMA(a) (sizeof(a) / sizeof(a [0]))
diff --git a/opengl/tests/hwc/hwcTestLib.h b/opengl/tests/hwc/hwcTestLib.h
index 99ee608..b0c3012 100644
--- a/opengl/tests/hwc/hwcTestLib.h
+++ b/opengl/tests/hwc/hwcTestLib.h
@@ -29,7 +29,6 @@
#include <ui/FramebufferNativeWindow.h>
#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
#include <utils/Log.h>
#include <testUtil.h>
diff --git a/libs/ui/EGLUtils.cpp b/opengl/tests/include/EGLUtils.h
similarity index 82%
rename from libs/ui/EGLUtils.cpp
rename to opengl/tests/include/EGLUtils.h
index f24a71d..014c261 100644
--- a/libs/ui/EGLUtils.cpp
+++ b/opengl/tests/include/EGLUtils.h
@@ -15,21 +15,42 @@
*/
-#define LOG_TAG "EGLUtils"
+#ifndef ANDROID_UI_EGLUTILS_H
+#define ANDROID_UI_EGLUTILS_H
-#include <cutils/log.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include <system/window.h>
#include <utils/Errors.h>
-
-#include <ui/EGLUtils.h>
-
#include <EGL/egl.h>
-#include <private/ui/android_natives_priv.h>
// ----------------------------------------------------------------------------
namespace android {
// ----------------------------------------------------------------------------
+class EGLUtils
+{
+public:
+
+ static inline const char *strerror(EGLint err);
+
+ static inline status_t selectConfigForPixelFormat(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ int32_t format,
+ EGLConfig* outConfig);
+
+ static inline status_t selectConfigForNativeWindow(
+ EGLDisplay dpy,
+ EGLint const* attrs,
+ EGLNativeWindowType window,
+ EGLConfig* outConfig);
+};
+
+// ----------------------------------------------------------------------------
+
const char *EGLUtils::strerror(EGLint err)
{
switch (err){
@@ -55,7 +76,7 @@
status_t EGLUtils::selectConfigForPixelFormat(
EGLDisplay dpy,
EGLint const* attrs,
- PixelFormat format,
+ int32_t format,
EGLConfig* outConfig)
{
EGLint numConfigs = -1, n=0;
@@ -65,7 +86,7 @@
if (outConfig == NULL)
return BAD_VALUE;
-
+
// Get all the "potential match" configs...
if (eglGetConfigs(dpy, NULL, 0, &numConfigs) == EGL_FALSE)
return BAD_VALUE;
@@ -75,7 +96,7 @@
free(configs);
return BAD_VALUE;
}
-
+
int i;
EGLConfig config = NULL;
for (i=0 ; i<n ; i++) {
@@ -88,7 +109,7 @@
}
free(configs);
-
+
if (i<n) {
*outConfig = config;
return NO_ERROR;
@@ -105,10 +126,10 @@
{
int err;
int format;
-
+
if (!window)
return BAD_VALUE;
-
+
if ((err = window->query(window, NATIVE_WINDOW_FORMAT, &format)) < 0) {
return err;
}
@@ -119,3 +140,5 @@
// ----------------------------------------------------------------------------
}; // namespace android
// ----------------------------------------------------------------------------
+
+#endif /* ANDROID_UI_EGLUTILS_H */
diff --git a/opengl/tests/include/glTestLib.h b/opengl/tests/include/glTestLib.h
index 06fbf5d..c91c594 100644
--- a/opengl/tests/include/glTestLib.h
+++ b/opengl/tests/include/glTestLib.h
@@ -24,9 +24,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-//#include <ui/FramebufferNativeWindow.h>
-//#include <ui/GraphicBuffer.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
void glTestPrintGLString(const char *name, GLenum s);
void glTestCheckEglError(const char* op, EGLBoolean returnVal = EGL_TRUE);
diff --git a/opengl/tests/lib/glTestLib.cpp b/opengl/tests/lib/glTestLib.cpp
index 052cbd7..b434fc7 100644
--- a/opengl/tests/lib/glTestLib.cpp
+++ b/opengl/tests/lib/glTestLib.cpp
@@ -26,7 +26,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <utils/Log.h>
#include <testUtil.h>
diff --git a/opengl/tests/linetex/Android.mk b/opengl/tests/linetex/Android.mk
index 6ff248d..261940e 100644
--- a/opengl/tests/linetex/Android.mk
+++ b/opengl/tests/linetex/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-linetex
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/linetex/linetex.cpp b/opengl/tests/linetex/linetex.cpp
index 6842940..8669492 100644
--- a/opengl/tests/linetex/linetex.cpp
+++ b/opengl/tests/linetex/linetex.cpp
@@ -27,7 +27,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/swapinterval/Android.mk b/opengl/tests/swapinterval/Android.mk
index 9a4145e..d014cc9 100644
--- a/opengl/tests/swapinterval/Android.mk
+++ b/opengl/tests/swapinterval/Android.mk
@@ -11,6 +11,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-swapinterval
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/swapinterval/swapinterval.cpp b/opengl/tests/swapinterval/swapinterval.cpp
index 8ca031b..a0f4bc4 100644
--- a/opengl/tests/swapinterval/swapinterval.cpp
+++ b/opengl/tests/swapinterval/swapinterval.cpp
@@ -24,7 +24,7 @@
#include <utils/StopWatch.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/textures/Android.mk b/opengl/tests/textures/Android.mk
index b2fa185..fe9f43c 100644
--- a/opengl/tests/textures/Android.mk
+++ b/opengl/tests/textures/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-textures
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/textures/textures.cpp b/opengl/tests/textures/textures.cpp
index cbe8ffd..5d3d94e 100644
--- a/opengl/tests/textures/textures.cpp
+++ b/opengl/tests/textures/textures.cpp
@@ -23,7 +23,7 @@
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
using namespace android;
diff --git a/opengl/tests/tritex/Android.mk b/opengl/tests/tritex/Android.mk
index 6db3f49..fc544e4 100644
--- a/opengl/tests/tritex/Android.mk
+++ b/opengl/tests/tritex/Android.mk
@@ -10,6 +10,8 @@
libGLESv1_CM \
libui
+LOCAL_C_INCLUDES += frameworks/base/opengl/tests/include
+
LOCAL_MODULE:= test-opengl-tritex
LOCAL_MODULE_TAGS := optional
diff --git a/opengl/tests/tritex/tritex.cpp b/opengl/tests/tritex/tritex.cpp
index 3365ab4..f183483 100644
--- a/opengl/tests/tritex/tritex.cpp
+++ b/opengl/tests/tritex/tritex.cpp
@@ -9,7 +9,7 @@
#include <GLES/glext.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
+#include "EGLUtils.h"
#include <stdio.h>
#include <stdlib.h>
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..d522091 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,63 @@
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
+};
+
+void AudioFlinger::PlaybackThread::checkSilentMode_l()
+{
+ if (!mMasterMute) {
+ char value[PROPERTY_VALUE_MAX];
+ if (property_get("ro.audio.silent", value, "0") > 0) {
+ char *endptr;
+ unsigned long ul = strtoul(value, &endptr, 0);
+ if (*endptr == '\0' && ul != 0) {
+ ALOGD("Silence is golden");
+ // The setprop command will not allow a property to be changed after
+ // the first time it is set, so we don't have to worry about un-muting.
+ setMasterMute_l(true);
+ }
+ }
+ }
+}
+
bool AudioFlinger::MixerThread::threadLoop()
{
Vector< sp<Track> > tracksToRemove;
@@ -1950,42 +2008,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;
@@ -2030,14 +2059,7 @@
acquireWakeLock_l();
mPrevMixerStatus = MIXER_IDLE;
- if (!mMasterMute) {
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.audio.silent", value, "0");
- if (atoi(value)) {
- ALOGD("Silence is golden");
- setMasterMute_l(true);
- }
- }
+ checkSilentMode_l();
standbyTime = systemTime() + mStandbyTimeInNsecs;
sleepTime = idleSleepTime;
@@ -2739,14 +2761,7 @@
ALOGV("DirectOutputThread %p TID %d waking up in active mode", this, gettid());
acquireWakeLock_l();
- if (!mMasterMute) {
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.audio.silent", value, "0");
- if (atoi(value)) {
- ALOGD("Silence is golden");
- setMasterMute_l(true);
- }
- }
+ checkSilentMode_l();
standbyTime = systemTime() + standbyDelay;
sleepTime = idleSleepTime;
@@ -3135,15 +3150,7 @@
ALOGV("DuplicatingThread %p TID %d waking up", this, gettid());
acquireWakeLock_l();
- mPrevMixerStatus = MIXER_IDLE;
- if (!mMasterMute) {
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.audio.silent", value, "0");
- if (atoi(value)) {
- ALOGD("Silence is golden");
- setMasterMute_l(true);
- }
- }
+ checkSilentMode_l();
standbyTime = systemTime() + mStandbyTimeInNsecs;
sleepTime = idleSleepTime;
@@ -3306,7 +3313,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
const sp<IMemory>& sharedBuffer,
int sessionId)
: RefBase(),
@@ -3318,7 +3324,7 @@
mFrameCount(0),
mState(IDLE),
mFormat(format),
- mFlags(flags & ~SYSTEM_FLAGS_MASK),
+ mStepServerFailed(false),
mSessionId(sessionId)
// mChannelCount
// mChannelMask
@@ -3413,7 +3419,7 @@
result = cblk->stepServer(mFrameCount);
if (!result) {
ALOGV("stepServer failed acquiring cblk mutex");
- mFlags |= STEPSERVER_FAILED;
+ mStepServerFailed = true;
}
return result;
}
@@ -3425,7 +3431,7 @@
cblk->server = 0;
cblk->userBase = 0;
cblk->serverBase = 0;
- mFlags &= (uint32_t)(~SYSTEM_FLAGS_MASK);
+ mStepServerFailed = false;
ALOGV("TrackBase::reset");
}
@@ -3465,7 +3471,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 +3562,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 +4161,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 +4193,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 +4659,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 +4704,6 @@
format,
channelMask,
frameCount,
- flags,
lSessionId,
&lStatus);
}
@@ -4992,7 +4997,6 @@
audio_format_t format,
int channelMask,
int frameCount,
- uint32_t flags,
int sessionId,
status_t *status)
{
@@ -5009,7 +5013,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..2a5d805 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;
@@ -866,6 +859,9 @@
virtual uint32_t idleSleepTimeUs() = 0;
virtual uint32_t suspendSleepTimeUs() = 0;
+ // Code snippets that are temporarily lifted up out of threadLoop() until the merge
+ void checkSilentMode_l();
+
private:
friend class AudioFlinger;
@@ -1048,7 +1044,6 @@
audio_format_t format,
uint32_t channelMask,
int frameCount,
- uint32_t flags,
int sessionId);
virtual ~RecordTrack();
@@ -1094,7 +1089,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/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 86669f8..c705646 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -786,7 +786,7 @@
return flags;
}
- InputBindResult attachNewInputLocked(boolean initial, boolean needResult) {
+ InputBindResult attachNewInputLocked(boolean initial) {
if (!mBoundToMethod) {
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_BIND_INPUT, mCurMethod, mCurClient.binding));
@@ -804,14 +804,11 @@
if (DEBUG) Slog.v(TAG, "Attach new input asks to show input");
showCurrentInputLocked(getAppShowFlags(), null);
}
- return needResult
- ? new InputBindResult(session.session, mCurId, mCurSeq)
- : null;
+ return new InputBindResult(session.session, mCurId, mCurSeq);
}
InputBindResult startInputLocked(IInputMethodClient client,
- IInputContext inputContext, EditorInfo attribute,
- boolean initial, boolean needResult) {
+ IInputContext inputContext, EditorInfo attribute, int controlFlags) {
// If no method is currently selected, do nothing.
if (mCurMethodId == null) {
return mNoBinding;
@@ -837,6 +834,16 @@
} catch (RemoteException e) {
}
+ return startInputUncheckedLocked(cs, inputContext, attribute, controlFlags);
+ }
+
+ InputBindResult startInputUncheckedLocked(ClientState cs,
+ IInputContext inputContext, EditorInfo attribute, int controlFlags) {
+ // If no method is currently selected, do nothing.
+ if (mCurMethodId == null) {
+ return mNoBinding;
+ }
+
if (mCurClient != cs) {
// If the client is changing, we need to switch over to the new
// one.
@@ -867,7 +874,8 @@
if (cs.curSession != null) {
// Fast case: if we are already connected to the input method,
// then just return it.
- return attachNewInputLocked(initial, needResult);
+ return attachNewInputLocked(
+ (controlFlags&InputMethodManager.CONTROL_START_INITIAL) != 0);
}
if (mHaveConnection) {
if (mCurMethod != null) {
@@ -948,13 +956,11 @@
@Override
public InputBindResult startInput(IInputMethodClient client,
- IInputContext inputContext, EditorInfo attribute,
- boolean initial, boolean needResult) {
+ IInputContext inputContext, EditorInfo attribute, int controlFlags) {
synchronized (mMethodMap) {
final long ident = Binder.clearCallingIdentity();
try {
- return startInputLocked(client, inputContext, attribute,
- initial, needResult);
+ return startInputLocked(client, inputContext, attribute, controlFlags);
} finally {
Binder.restoreCallingIdentity(ident);
}
@@ -997,7 +1003,7 @@
mCurClient.curSession = new SessionState(mCurClient,
method, session);
mCurClient.sessionRequested = false;
- InputBindResult res = attachNewInputLocked(true, true);
+ InputBindResult res = attachNewInputLocked(true);
if (res.method != null) {
executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO(
MSG_BIND_METHOD, mCurClient.client, res));
@@ -1482,36 +1488,45 @@
}
@Override
- public void windowGainedFocus(IInputMethodClient client, IBinder windowToken,
- boolean viewHasFocus, boolean isTextEditor, int softInputMode,
- boolean first, int windowFlags) {
+ public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder windowToken,
+ int controlFlags, int softInputMode, int windowFlags,
+ EditorInfo attribute, IInputContext inputContext) {
+ InputBindResult res = null;
long ident = Binder.clearCallingIdentity();
try {
synchronized (mMethodMap) {
if (DEBUG) Slog.v(TAG, "windowGainedFocus: " + client.asBinder()
- + " viewHasFocus=" + viewHasFocus
- + " isTextEditor=" + isTextEditor
+ + " controlFlags=#" + Integer.toHexString(controlFlags)
+ " softInputMode=#" + Integer.toHexString(softInputMode)
- + " first=" + first + " flags=#"
- + Integer.toHexString(windowFlags));
+ + " windowFlags=#" + Integer.toHexString(windowFlags));
- if (mCurClient == null || client == null
- || mCurClient.client.asBinder() != client.asBinder()) {
- try {
- // We need to check if this is the current client with
- // focus in the window manager, to allow this call to
- // be made before input is started in it.
- if (!mIWindowManager.inputMethodClientHasFocus(client)) {
- Slog.w(TAG, "Client not active, ignoring focus gain of: " + client);
- return;
- }
- } catch (RemoteException e) {
+ ClientState cs = mClients.get(client.asBinder());
+ if (cs == null) {
+ throw new IllegalArgumentException("unknown client "
+ + client.asBinder());
+ }
+
+ try {
+ if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) {
+ // Check with the window manager to make sure this client actually
+ // has a window with focus. If not, reject. This is thread safe
+ // because if the focus changes some time before or after, the
+ // next client receiving focus that has any interest in input will
+ // be calling through here after that change happens.
+ Slog.w(TAG, "Focus gain on non-focused client " + cs.client
+ + " (uid=" + cs.uid + " pid=" + cs.pid + ")");
+ return null;
}
+ } catch (RemoteException e) {
}
if (mCurFocusedWindow == windowToken) {
Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client);
- return;
+ if (attribute != null) {
+ return startInputUncheckedLocked(cs, inputContext, attribute,
+ controlFlags);
+ }
+ return null;
}
mCurFocusedWindow = windowToken;
@@ -1527,6 +1542,14 @@
== WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE
|| mRes.getConfiguration().isLayoutSizeAtLeast(
Configuration.SCREENLAYOUT_SIZE_LARGE);
+ final boolean isTextEditor =
+ (controlFlags&InputMethodManager.CONTROL_WINDOW_IS_TEXT_EDITOR) != 0;
+
+ // We want to start input before showing the IME, but after closing
+ // it. We want to do this after closing it to help the IME disappear
+ // more quickly (not get stuck behind it initializing itself for the
+ // new focused input, even if its window wants to hide the IME).
+ boolean didStart = false;
switch (softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE) {
case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED:
@@ -1542,12 +1565,17 @@
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
// There is a focus view, and we are navigating forward
// into the window, so show the input window for the user.
- // We only do this automatically if the window an resize
- // to accomodate the IME (so what the user sees will give
+ // We only do this automatically if the window can resize
+ // to accommodate the IME (so what the user sees will give
// them good context without input information being obscured
// by the IME) or if running on a large screen where there
// is more room for the target window + IME.
if (DEBUG) Slog.v(TAG, "Unspecified window will show input");
+ if (attribute != null) {
+ res = startInputUncheckedLocked(cs, inputContext, attribute,
+ controlFlags);
+ didStart = true;
+ }
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
}
break;
@@ -1569,18 +1597,35 @@
if ((softInputMode &
WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) {
if (DEBUG) Slog.v(TAG, "Window asks to show input going forward");
+ if (attribute != null) {
+ res = startInputUncheckedLocked(cs, inputContext, attribute,
+ controlFlags);
+ didStart = true;
+ }
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
}
break;
case WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE:
if (DEBUG) Slog.v(TAG, "Window asks to always show input");
+ if (attribute != null) {
+ res = startInputUncheckedLocked(cs, inputContext, attribute,
+ controlFlags);
+ didStart = true;
+ }
showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null);
break;
}
+
+ if (!didStart && attribute != null) {
+ res = startInputUncheckedLocked(cs, inputContext, attribute,
+ controlFlags);
+ }
}
} finally {
Binder.restoreCallingIdentity(ident);
}
+
+ return res;
}
@Override
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/services/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
index 455325a..c99aa02 100644
--- a/services/java/com/android/server/accessibility/AccessibilityManagerService.java
+++ b/services/java/com/android/server/accessibility/AccessibilityManagerService.java
@@ -1129,7 +1129,8 @@
public float findAccessibilityNodeInfoByAccessibilityId(int accessibilityWindowId,
long accessibilityNodeId, int interactionId,
- IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
+ IAccessibilityInteractionConnectionCallback callback, long interrogatingTid,
+ int prefetchFlags)
throws RemoteException {
final int resolvedWindowId = resolveAccessibilityWindowId(accessibilityWindowId);
IAccessibilityInteractionConnection connection = null;
@@ -1150,7 +1151,7 @@
final long identityToken = Binder.clearCallingIdentity();
try {
connection.findAccessibilityNodeInfoByAccessibilityId(accessibilityNodeId,
- interactionId, callback, interrogatingPid, interrogatingTid);
+ interactionId, callback, prefetchFlags, interrogatingPid, interrogatingTid);
} catch (RemoteException re) {
if (DEBUG) {
Slog.e(LOG_TAG, "Error calling findAccessibilityNodeInfoByAccessibilityId()");
diff --git a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index 986aec5..cea17f8 100644
--- a/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -26,7 +26,6 @@
#include <ui/PixelFormat.h>
#include <ui/FramebufferNativeWindow.h>
-#include <ui/EGLUtils.h>
#include <GLES/gl.h>
#include <EGL/egl.h>
@@ -60,6 +59,29 @@
static __attribute__((noinline))
void checkEGLErrors(const char* token)
{
+ struct EGLUtils {
+ static const char *strerror(EGLint err) {
+ switch (err){
+ case EGL_SUCCESS: return "EGL_SUCCESS";
+ case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
+ case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
+ case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
+ case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
+ case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
+ case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
+ case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
+ case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
+ case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
+ case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
+ case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
+ case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
+ case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
+ case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
+ default: return "UNKNOWN";
+ }
+ }
+ };
+
EGLint error = eglGetError();
if (error && error != EGL_SUCCESS) {
ALOGE("%s: EGL error 0x%04x (%s)",
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3e6b872..efcdd87 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -42,7 +42,6 @@
#define DEBUG_RESIZE 0
-
namespace android {
// ---------------------------------------------------------------------------
@@ -55,7 +54,7 @@
mCurrentTransform(0),
mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mCurrentOpacity(true),
- mRefreshPending(0),
+ mRefreshPending(false),
mFrameLatencyNeeded(false),
mFrameLatencyOffset(0),
mFormat(PIXEL_FORMAT_NONE),
@@ -161,7 +160,10 @@
// this surfaces pixel format
PixelFormatInfo info;
status_t err = getPixelFormatInfo(format, &info);
- if (err) return err;
+ if (err) {
+ ALOGE("unsupported pixelformat %d", format);
+ return err;
+ }
// the display's pixel format
const DisplayHardware& hw(graphicPlane(0).displayHardware());
@@ -171,6 +173,7 @@
// never allow a surface larger than what our underlying GL implementation
// can handle.
if ((uint32_t(w)>maxSurfaceDims) || (uint32_t(h)>maxSurfaceDims)) {
+ ALOGE("dimensions too large %u x %u", uint32_t(w), uint32_t(h));
return BAD_VALUE;
}
@@ -408,15 +411,9 @@
// pageflip handling...
// ----------------------------------------------------------------------------
-bool Layer::onPreComposition()
-{
- // if there was more than one pending update, request a refresh
- if (mRefreshPending >= 2) {
- mRefreshPending = 0;
- return true;
- }
- mRefreshPending = 0;
- return false;
+bool Layer::onPreComposition() {
+ mRefreshPending = false;
+ return mQueuedFrames > 0;
}
void Layer::lockPageFlip(bool& recomputeVisibleRegions)
@@ -428,9 +425,11 @@
// because we cannot call updateTeximage() without a corresponding
// compositionComplete() call.
// we'll trigger an update in onPreComposition().
- if (mRefreshPending++) {
+ if (mRefreshPending) {
+ mPostedDirtyRegion.clear();
return;
}
+ mRefreshPending = true;
// Capture the old state of the layer for comparisons later
const bool oldOpacity = isOpaque();
@@ -541,25 +540,23 @@
void Layer::unlockPageFlip(
const Transform& planeTransform, Region& outDirtyRegion)
{
- if (mRefreshPending >= 2) {
- return;
- }
-
- Region dirtyRegion(mPostedDirtyRegion);
- if (!dirtyRegion.isEmpty()) {
+ Region postedRegion(mPostedDirtyRegion);
+ if (!postedRegion.isEmpty()) {
mPostedDirtyRegion.clear();
- // The dirty region is given in the layer's coordinate space
- // transform the dirty region by the surface's transformation
- // and the global transformation.
- const Layer::State& s(drawingState());
- const Transform tr(planeTransform * s.transform);
- dirtyRegion = tr.transform(dirtyRegion);
+ if (!visibleRegionScreen.isEmpty()) {
+ // The dirty region is given in the layer's coordinate space
+ // transform the dirty region by the surface's transformation
+ // and the global transformation.
+ const Layer::State& s(drawingState());
+ const Transform tr(planeTransform * s.transform);
+ postedRegion = tr.transform(postedRegion);
- // At this point, the dirty region is in screen space.
- // Make sure it's constrained by the visible region (which
- // is in screen space as well).
- dirtyRegion.andSelf(visibleRegionScreen);
- outDirtyRegion.orSelf(dirtyRegion);
+ // At this point, the dirty region is in screen space.
+ // Make sure it's constrained by the visible region (which
+ // is in screen space as well).
+ postedRegion.andSelf(visibleRegionScreen);
+ outDirtyRegion.orSelf(postedRegion);
+ }
}
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index bf30608..39bbb2b 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -116,7 +116,7 @@
uint32_t mCurrentTransform;
uint32_t mCurrentScalingMode;
bool mCurrentOpacity;
- size_t mRefreshPending;
+ bool mRefreshPending;
bool mFrameLatencyNeeded;
int mFrameLatencyOffset;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 9e3f548..05b5bf5 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1000,6 +1000,12 @@
drawWormhole();
}
+ // FIXME: workaroud for b/6020860
+ glEnable(GL_SCISSOR_TEST);
+ glScissor(0,0,0,0);
+ glClear(GL_COLOR_BUFFER_BIT);
+ // end-workaround
+
/*
* and then, render the layers targeted at the framebuffer
*/
@@ -1279,7 +1285,7 @@
return surfaceHandle;
}
- //ALOGD("createSurface for pid %d (%d x %d)", pid, w, h);
+ //ALOGD("createSurface for (%d x %d), name=%s", w, h, name.string());
sp<Layer> normalLayer;
switch (flags & eFXSurfaceMask) {
case eFXSurfaceNormal:
@@ -1776,6 +1782,10 @@
setTransactionFlags(eTransactionNeeded|eTraversalNeeded);
return NO_ERROR;
}
+ case 1006:{ // send empty update
+ signalRefresh();
+ return NO_ERROR;
+ }
case 1008: // toggle use of hw composer
n = data.readInt32();
mDebugDisableHWC = n ? 1 : 0;
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/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
index b8ad823..9ab2a86 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/PathsCacheActivity.java
@@ -92,19 +92,24 @@
canvas.restore();
-// Path path = makePath();
-// int r = mRandom.nextInt(10);
-// if (r == 5 || r == 3) {
-// mPathList.add(path);
-// } else if (r == 9) {
-// mPathList.clear();
-// }
-//
-// canvas.save();
-// canvas.translate(550.0f + mRandom.nextInt(50), 60.0f + mRandom.nextInt(50));
-// canvas.drawPath(path, mMediumPaint);
-// canvas.restore();
-//
+ for (int i = 0; i < mRandom.nextInt(20); i++) {
+ Path path = makePath();
+ int r = mRandom.nextInt(10);
+ if (r == 5 || r == 3) {
+ mPathList.add(path);
+ }
+
+ canvas.save();
+ canvas.translate(450.0f + mRandom.nextInt(200), mRandom.nextInt(200));
+ canvas.drawPath(path, mMediumPaint);
+ canvas.restore();
+ }
+
+ int r = mRandom.nextInt(100);
+ if (r == 50) {
+ mPathList.clear();
+ }
+
invalidate();
}
}
diff --git a/tests/RenderScriptTests/SceneGraph/res/raw/unit_obj.a3d b/tests/RenderScriptTests/SceneGraph/res/raw/unit_obj.a3d
new file mode 100644
index 0000000..56eff04
--- /dev/null
+++ b/tests/RenderScriptTests/SceneGraph/res/raw/unit_obj.a3d
Binary files differ
diff --git a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppRS.java b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppRS.java
index 621bfa36..fff6f34 100644
--- a/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppRS.java
+++ b/tests/RenderScriptTests/SceneGraph/src/com/android/testapp/SimpleAppRS.java
@@ -34,9 +34,6 @@
// This is where the scenegraph and the rendered objects are initialized and used
public class SimpleAppRS {
-
- private static String TAG = "SimpleAppRS";
-
SceneManager mSceneManager;
RenderScriptGL mRS;
@@ -44,6 +41,8 @@
Scene mScene;
Mesh mSimpleMesh;
+ Mesh mSphereMesh;
+ Mesh mCubeMesh;
public void init(RenderScriptGL rs, Resources res, int width, int height) {
mRS = rs;
@@ -54,7 +53,9 @@
mScene = new Scene();
setupGeometry();
- setupRenderables();
+ setupColoredQuad();
+ setupTexturedQuad();
+ setupShadedGeometry();
setupCamera();
setupRenderPass();
@@ -68,6 +69,7 @@
Mesh.TriangleMeshBuilder tmb = new Mesh.TriangleMeshBuilder(mRS, 3,
Mesh.TriangleMeshBuilder.TEXTURE_0);
+ // Create four vertices with texture coordinates
tmb.setTexture(0.0f, 1.0f).addVertex(-1.0f, 1.0f, 0.0f);
tmb.setTexture(0.0f, 0.0f).addVertex(-1.0f, -1.0f, 0.0f);
tmb.setTexture(1.0f, 0.0f).addVertex(1.0f, -1.0f, 0.0f);
@@ -76,36 +78,110 @@
tmb.addTriangle(0, 1, 2);
tmb.addTriangle(2, 3, 0);
mSimpleMesh = tmb.create(true);
+
+ // Load a file that constains two pieces of geometry, a sphere and a cube
+ FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.unit_obj);
+ for (int i = 0; i < model.getIndexEntryCount(); i ++) {
+ FileA3D.IndexEntry entry = model.getIndexEntry(i);
+ if (entry != null && entry.getName().equals("CubeMesh")) {
+ mCubeMesh = entry.getMesh();
+ } else if (entry != null && entry.getName().equals("SphereMesh")) {
+ mSphereMesh = entry.getMesh();
+ }
+ }
}
- private void setupRenderables() {
+ private void setupColoredQuad() {
// Built-in shader that provides position, texcoord and normal
VertexShader genericV = SceneManager.getDefaultVS();
// Built-in shader that displays a color
FragmentShader colorF = SceneManager.getColorFS();
- // Built-in shader that displays a texture
- FragmentShader textureF = SceneManager.getTextureFS();
RenderState colorRS = new RenderState(genericV, colorF, null, null);
- ProgramStore alphaBlend = ProgramStore.BLEND_ALPHA_DEPTH_TEST(mRS);
- RenderState texRS = new RenderState(genericV, textureF, alphaBlend, null);
// Draw a simple colored quad
Renderable quad = mScene.appendNewRenderable();
quad.setMesh(mSimpleMesh);
+ // Our shader has a constant input called "color"
+ // This tells the scenegraph to assign the following float3 to that input
quad.appendSourceParams(new Float4Param("color", 0.2f, 0.3f, 0.4f));
quad.setRenderState(colorRS);
+ }
+
+ private void setupTexturedQuad() {
+ // Built-in shader that provides position, texcoord and normal
+ VertexShader genericV = SceneManager.getDefaultVS();
+ // Built-in shader that displays a texture
+ FragmentShader textureF = SceneManager.getTextureFS();
+ // We want to use transparency based on the alpha channel of the texture
+ ProgramStore alphaBlend = ProgramStore.BLEND_ALPHA_DEPTH_TEST(mRS);
+ RenderState texRS = new RenderState(genericV, textureF, alphaBlend, null);
// Draw a textured quad
- quad = mScene.appendNewRenderable();
+ Renderable quad = mScene.appendNewRenderable();
quad.setMesh(mSimpleMesh);
// Make a transform to position the quad
CompoundTransform t = mScene.appendNewCompoundTransform();
t.addTranslate("position", new Float3(2, 2, 0));
quad.setTransform(t);
+ // Our fragment shader has a constant texture input called "color"
+ // This will assign an icon from drawables to that input
quad.appendSourceParams(new TextureParam("color", new Texture2D(R.drawable.icon)));
quad.setRenderState(texRS);
}
+ private FragmentShader createLambertShader() {
+ // Describe what constant inputs our shader wants
+ Element.Builder b = new Element.Builder(mRS);
+ b.add(Element.F32_4(mRS), "cameraPos");
+
+ // Create a shader from a text file in resources
+ FragmentShader.Builder fb = new FragmentShader.Builder(mRS);
+ // Tell the shader what constants we want
+ fb.setShaderConst(new Type.Builder(mRS, b.create()).setX(1).create());
+ // Shader code location
+ fb.setShader(mRes, R.raw.diffuse);
+ // We want a texture called diffuse on our shader
+ fb.addTexture(TextureType.TEXTURE_2D, "diffuse");
+ FragmentShader shader = fb.create();
+ mScene.appendShader(shader);
+ return shader;
+ }
+
+ private void setupShadedGeometry() {
+ // Built-in shader that provides position, texcoord and normal
+ VertexShader genericV = SceneManager.getDefaultVS();
+ // Custom shader
+ FragmentShader diffuseF = createLambertShader();
+ RenderState diffuseRS = new RenderState(genericV, diffuseF, null, null);
+
+ // Draw a sphere
+ Renderable sphere = mScene.appendNewRenderable();
+ // Use the sphere geometry loaded earlier
+ sphere.setMesh(mSphereMesh);
+ // Make a transform to position the sphere
+ CompoundTransform t = mScene.appendNewCompoundTransform();
+ t.addTranslate("position", new Float3(-1, 2, 3));
+ t.addScale("scale", new Float3(1.4f, 1.4f, 1.4f));
+ sphere.setTransform(t);
+ // Tell the renderable which texture to use when we draw
+ // This will mean a texture param in the shader called "diffuse"
+ // will be assigned a texture called red.jpg
+ sphere.appendSourceParams(new TextureParam("diffuse", new Texture2D("", "red.jpg")));
+ sphere.setRenderState(diffuseRS);
+
+ // Draw a cube
+ Renderable cube = mScene.appendNewRenderable();
+ cube.setMesh(mCubeMesh);
+ t = mScene.appendNewCompoundTransform();
+ t.addTranslate("position", new Float3(-2, -2.1f, 0));
+ t.addRotate("rotateX", new Float3(1, 0, 0), 30);
+ t.addRotate("rotateY", new Float3(0, 1, 0), 30);
+ t.addScale("scale", new Float3(2, 2, 2));
+ cube.setTransform(t);
+ cube.appendSourceParams(new TextureParam("diffuse", new Texture2D("", "orange.jpg")));
+ cube.setRenderState(diffuseRS);
+ }
+
private void setupCamera() {
Camera camera = mScene.appendNewCamera();
camera.setFar(200);
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) {
diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp
index 9ee6c84..8d7acee 100644
--- a/tools/aapt/XMLNode.cpp
+++ b/tools/aapt/XMLNode.cpp
@@ -21,7 +21,7 @@
const char* const RESOURCES_ROOT_NAMESPACE = "http://schemas.android.com/apk/res/";
const char* const RESOURCES_ANDROID_NAMESPACE = "http://schemas.android.com/apk/res/android";
-const char* const RESOURCES_AUTO_PACKAGE_NAMESPACE = "http://schemas.android.com/apk/res/auto";
+const char* const RESOURCES_AUTO_PACKAGE_NAMESPACE = "http://schemas.android.com/apk/res-auto";
const char* const RESOURCES_ROOT_PRV_NAMESPACE = "http://schemas.android.com/apk/prv/res/";
const char* const XLIFF_XMLNS = "urn:oasis:names:tc:xliff:document:1.2";
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
index 6afdfbe..d6abbaa 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java
@@ -184,8 +184,8 @@
}
@Override
- public InputBindResult startInput(IInputMethodClient arg0, IInputContext arg1, EditorInfo arg2,
- boolean arg3, boolean arg4) throws RemoteException {
+ public InputBindResult startInput(IInputMethodClient client, IInputContext inputContext,
+ EditorInfo attribute, int controlFlags) throws RemoteException {
// TODO Auto-generated method stub
return null;
}
@@ -209,10 +209,11 @@
}
@Override
- public void windowGainedFocus(IInputMethodClient arg0, IBinder arg1, boolean arg2,
- boolean arg3, int arg4, boolean arg5, int arg6) throws RemoteException {
+ public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder windowToken,
+ int controlFlags, int softInputMode, int windowFlags, EditorInfo attribute,
+ IInputContext inputContext) throws RemoteException {
// TODO Auto-generated method stub
-
+ return null;
}
@Override