Merge "Fix some typos and logging of calls to CDMA methods."
diff --git a/api/current.xml b/api/current.xml
index 9dc2218..10742db 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -80658,6 +80658,19 @@
<parameter name="l" type="android.media.AudioManager.OnAudioFocusChangeListener">
</parameter>
</method>
+<method name="registerMediaButtonEventReceiver"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="eventReceiver" type="android.content.ComponentName">
+</parameter>
+</method>
<method name="requestAudioFocus"
return="int"
abstract="false"
@@ -80917,6 +80930,19 @@
<parameter name="l" type="android.media.AudioManager.OnAudioFocusChangeListener">
</parameter>
</method>
+<method name="unregisterMediaButtonEventReceiver"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="eventReceiver" type="android.content.ComponentName">
+</parameter>
+</method>
<field name="ACTION_AUDIO_BECOMING_NOISY"
type="java.lang.String"
transient="false"
diff --git a/core/java/android/net/http/Request.java b/core/java/android/net/http/Request.java
index 1b6568e..6dbf325 100644
--- a/core/java/android/net/http/Request.java
+++ b/core/java/android/net/http/Request.java
@@ -82,6 +82,9 @@
/* Used to synchronize waitUntilComplete() requests */
private final Object mClientResource = new Object();
+ /** True if loading should be paused **/
+ private boolean mLoadingPaused = false;
+
/**
* Processor used to set content-length and transfer-encoding
* headers.
@@ -133,6 +136,18 @@
}
/**
+ * @param pause True if the load should be paused.
+ */
+ synchronized void setLoadingPaused(boolean pause) {
+ mLoadingPaused = pause;
+
+ // Wake up the paused thread if we're unpausing the load.
+ if (!mLoadingPaused) {
+ notify();
+ }
+ }
+
+ /**
* @param connection Request served by this connection
*/
void setConnection(Connection connection) {
@@ -271,7 +286,24 @@
int len = 0;
int lowWater = buf.length / 2;
while (len != -1) {
+ synchronized(this) {
+ while (mLoadingPaused) {
+ // Put this (network loading) thread to sleep if WebCore
+ // has asked us to. This can happen with plugins for
+ // example, if we are streaming data but the plugin has
+ // filled its internal buffers.
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ HttpLog.e("Interrupted exception whilst "
+ + "network thread paused at WebCore's request."
+ + " " + e.getMessage());
+ }
+ }
+ }
+
len = nis.read(buf, count, buf.length - count);
+
if (len != -1) {
count += len;
}
@@ -316,10 +348,16 @@
*
* Called by RequestHandle from non-network thread
*/
- void cancel() {
+ synchronized void cancel() {
if (HttpLog.LOGV) {
HttpLog.v("Request.cancel(): " + getUri());
}
+
+ // Ensure that the network thread is not blocked by a hanging request from WebCore to
+ // pause the load.
+ mLoadingPaused = false;
+ notify();
+
mCancelled = true;
if (mConnection != null) {
mConnection.cancel();
diff --git a/core/java/android/net/http/RequestHandle.java b/core/java/android/net/http/RequestHandle.java
index 77cd544..1a3a289 100644
--- a/core/java/android/net/http/RequestHandle.java
+++ b/core/java/android/net/http/RequestHandle.java
@@ -101,6 +101,16 @@
}
/**
+ * Pauses the loading of this request. For example, called from the WebCore thread
+ * when the plugin can take no more data.
+ */
+ public void pauseRequest(boolean pause) {
+ if (mRequest != null) {
+ mRequest.setLoadingPaused(pause);
+ }
+ }
+
+ /**
* Handles SSL error(s) on the way down from the user (the user
* has already provided their feedback).
*/
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index e4eaf45b..f4ca8bc 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -361,6 +361,9 @@
*/
public WakeLock newWakeLock(int flags, String tag)
{
+ if (tag == null) {
+ throw new NullPointerException("tag is null in PowerManager.newWakeLock");
+ }
return new WakeLock(flags, tag);
}
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index 53c238c..c44854a 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -506,6 +506,17 @@
updateWindow(false);
}
+ /**
+ * Check to see if the surface has fixed size dimensions or if the surface's
+ * dimensions are dimensions are dependent on its current layout.
+ *
+ * @return true if the surface has dimensions that are fixed in size
+ * @hide
+ */
+ public boolean isFixedSize() {
+ return (mRequestedWidth != -1 || mRequestedHeight != -1);
+ }
+
private static class MyWindow extends BaseIWindow {
private final WeakReference<SurfaceView> mSurfaceView;
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index dc7723f..2c24757 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -1198,6 +1198,16 @@
}
/**
+ * Pause the load. For example, if a plugin is unable to accept more data,
+ * we pause reading from the request. Called directly from the WebCore thread.
+ */
+ void pauseLoad(boolean pause) {
+ if (mRequestHandle != null) {
+ mRequestHandle.pauseRequest(pause);
+ }
+ }
+
+ /**
* Cancel a request.
* FIXME: This will only work if the request has yet to be handled. This
* is in no way guarenteed if requests are served in a separate thread.
diff --git a/core/java/android/webkit/WebViewDatabase.java b/core/java/android/webkit/WebViewDatabase.java
index a870931..a75e6f0 100644
--- a/core/java/android/webkit/WebViewDatabase.java
+++ b/core/java/android/webkit/WebViewDatabase.java
@@ -389,10 +389,17 @@
return false;
}
- Cursor cursor = mDatabase.query(mTableNames[tableId], ID_PROJECTION,
- null, null, null, null, null);
- boolean ret = cursor.moveToFirst() == true;
- cursor.close();
+ Cursor cursor = null;
+ boolean ret = false;
+ try {
+ cursor = mDatabase.query(mTableNames[tableId], ID_PROJECTION,
+ null, null, null, null, null);
+ ret = cursor.moveToFirst() == true;
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "hasEntries", e);
+ } finally {
+ if (cursor != null) cursor.close();
+ }
return ret;
}
@@ -420,33 +427,39 @@
};
final String selection = "(" + COOKIES_DOMAIN_COL
+ " GLOB '*' || ?)";
- Cursor cursor = mDatabase.query(mTableNames[TABLE_COOKIES_ID],
- columns, selection, new String[] { domain }, null, null,
- null);
- if (cursor.moveToFirst()) {
- int domainCol = cursor.getColumnIndex(COOKIES_DOMAIN_COL);
- int pathCol = cursor.getColumnIndex(COOKIES_PATH_COL);
- int nameCol = cursor.getColumnIndex(COOKIES_NAME_COL);
- int valueCol = cursor.getColumnIndex(COOKIES_VALUE_COL);
- int expiresCol = cursor.getColumnIndex(COOKIES_EXPIRES_COL);
- int secureCol = cursor.getColumnIndex(COOKIES_SECURE_COL);
- do {
- Cookie cookie = new Cookie();
- cookie.domain = cursor.getString(domainCol);
- cookie.path = cursor.getString(pathCol);
- cookie.name = cursor.getString(nameCol);
- cookie.value = cursor.getString(valueCol);
- if (cursor.isNull(expiresCol)) {
- cookie.expires = -1;
- } else {
- cookie.expires = cursor.getLong(expiresCol);
- }
- cookie.secure = cursor.getShort(secureCol) != 0;
- cookie.mode = Cookie.MODE_NORMAL;
- list.add(cookie);
- } while (cursor.moveToNext());
+ Cursor cursor = null;
+ try {
+ cursor = mDatabase.query(mTableNames[TABLE_COOKIES_ID],
+ columns, selection, new String[] { domain }, null, null,
+ null);
+ if (cursor.moveToFirst()) {
+ int domainCol = cursor.getColumnIndex(COOKIES_DOMAIN_COL);
+ int pathCol = cursor.getColumnIndex(COOKIES_PATH_COL);
+ int nameCol = cursor.getColumnIndex(COOKIES_NAME_COL);
+ int valueCol = cursor.getColumnIndex(COOKIES_VALUE_COL);
+ int expiresCol = cursor.getColumnIndex(COOKIES_EXPIRES_COL);
+ int secureCol = cursor.getColumnIndex(COOKIES_SECURE_COL);
+ do {
+ Cookie cookie = new Cookie();
+ cookie.domain = cursor.getString(domainCol);
+ cookie.path = cursor.getString(pathCol);
+ cookie.name = cursor.getString(nameCol);
+ cookie.value = cursor.getString(valueCol);
+ if (cursor.isNull(expiresCol)) {
+ cookie.expires = -1;
+ } else {
+ cookie.expires = cursor.getLong(expiresCol);
+ }
+ cookie.secure = cursor.getShort(secureCol) != 0;
+ cookie.mode = Cookie.MODE_NORMAL;
+ list.add(cookie);
+ } while (cursor.moveToNext());
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getCookiesForDomain", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return list;
}
}
@@ -604,12 +617,12 @@
return null;
}
- Cursor cursor = mCacheDatabase.rawQuery("SELECT filepath, lastmodify, etag, expires, "
- + "expiresstring, mimetype, encoding, httpstatus, location, contentlength, "
- + "contentdisposition FROM cache WHERE url = ?",
- new String[] { url });
-
+ Cursor cursor = null;
+ final String query = "SELECT filepath, lastmodify, etag, expires, "
+ + "expiresstring, mimetype, encoding, httpstatus, location, contentlength, "
+ + "contentdisposition FROM cache WHERE url = ?";
try {
+ cursor = mCacheDatabase.rawQuery(query, new String[] { url });
if (cursor.moveToFirst()) {
CacheResult ret = new CacheResult();
ret.localPath = cursor.getString(0);
@@ -625,6 +638,8 @@
ret.contentdisposition = cursor.getString(10);
return ret;
}
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getCache", e);
} finally {
if (cursor != null) cursor.close();
}
@@ -688,78 +703,108 @@
return false;
}
- Cursor cursor = mCacheDatabase.query("cache", ID_PROJECTION,
- null, null, null, null, null);
- boolean ret = cursor.moveToFirst() == true;
- cursor.close();
+ Cursor cursor = null;
+ boolean ret = false;
+ try {
+ cursor = mCacheDatabase.query("cache", ID_PROJECTION,
+ null, null, null, null, null);
+ ret = cursor.moveToFirst() == true;
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "hasCache", e);
+ } finally {
+ if (cursor != null) cursor.close();
+ }
return ret;
}
long getCacheTotalSize() {
long size = 0;
- Cursor cursor = mCacheDatabase.rawQuery(
- "SELECT SUM(contentlength) as sum FROM cache", null);
- if (cursor.moveToFirst()) {
- size = cursor.getLong(0);
+ Cursor cursor = null;
+ final String query = "SELECT SUM(contentlength) as sum FROM cache";
+ try {
+ cursor = mCacheDatabase.rawQuery(query, null);
+ if (cursor.moveToFirst()) {
+ size = cursor.getLong(0);
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getCacheTotalSize", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return size;
}
List<String> trimCache(long amount) {
ArrayList<String> pathList = new ArrayList<String>(100);
- Cursor cursor = mCacheDatabase.rawQuery(
- "SELECT contentlength, filepath FROM cache ORDER BY expires ASC",
- null);
- if (cursor.moveToFirst()) {
- int batchSize = 100;
- StringBuilder pathStr = new StringBuilder(20 + 16 * batchSize);
- pathStr.append("DELETE FROM cache WHERE filepath IN (?");
- for (int i = 1; i < batchSize; i++) {
- pathStr.append(", ?");
- }
- pathStr.append(")");
- SQLiteStatement statement = mCacheDatabase.compileStatement(pathStr
- .toString());
- // as bindString() uses 1-based index, initialize index to 1
- int index = 1;
- do {
- long length = cursor.getLong(0);
- if (length == 0) {
- continue;
+ Cursor cursor = null;
+ final String query = "SELECT contentlength, filepath FROM cache ORDER BY expires ASC";
+ try {
+ cursor = mCacheDatabase.rawQuery(query, null);
+ if (cursor.moveToFirst()) {
+ int batchSize = 100;
+ StringBuilder pathStr = new StringBuilder(20 + 16 * batchSize);
+ pathStr.append("DELETE FROM cache WHERE filepath IN (?");
+ for (int i = 1; i < batchSize; i++) {
+ pathStr.append(", ?");
}
- amount -= length;
- String filePath = cursor.getString(1);
- statement.bindString(index, filePath);
- pathList.add(filePath);
- if (index++ == batchSize) {
- statement.execute();
- statement.clearBindings();
- index = 1;
+ pathStr.append(")");
+ SQLiteStatement statement = null;
+ try {
+ statement = mCacheDatabase.compileStatement(
+ pathStr.toString());
+ // as bindString() uses 1-based index, initialize index to 1
+ int index = 1;
+ do {
+ long length = cursor.getLong(0);
+ if (length == 0) {
+ continue;
+ }
+ amount -= length;
+ String filePath = cursor.getString(1);
+ statement.bindString(index, filePath);
+ pathList.add(filePath);
+ if (index++ == batchSize) {
+ statement.execute();
+ statement.clearBindings();
+ index = 1;
+ }
+ } while (cursor.moveToNext() && amount > 0);
+ if (index > 1) {
+ // there may be old bindings from the previous statement
+ // if index is less than batchSize, which is Ok.
+ statement.execute();
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "trimCache SQLiteStatement", e);
+ } finally {
+ if (statement != null) statement.close();
}
- } while (cursor.moveToNext() && amount > 0);
- if (index > 1) {
- // there may be old bindings from the previous statement if
- // index is less than batchSize, which is Ok.
- statement.execute();
}
- statement.close();
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "trimCache Cursor", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return pathList;
}
List<String> getAllCacheFileNames() {
ArrayList<String> pathList = null;
- Cursor cursor = mCacheDatabase.rawQuery("SELECT filepath FROM cache",
- null);
- if (cursor != null && cursor.moveToFirst()) {
- pathList = new ArrayList<String>(cursor.getCount());
- do {
- pathList.add(cursor.getString(0));
- } while (cursor.moveToNext());
+ Cursor cursor = null;
+ try {
+ cursor = mCacheDatabase.rawQuery("SELECT filepath FROM cache",
+ null);
+ if (cursor != null && cursor.moveToFirst()) {
+ pathList = new ArrayList<String>(cursor.getCount());
+ do {
+ pathList.add(cursor.getString(0));
+ } while (cursor.moveToNext());
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getAllCacheFileNames", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return pathList;
}
@@ -809,17 +854,23 @@
final String selection = "(" + PASSWORD_HOST_COL + " == ?)";
synchronized (mPasswordLock) {
String[] ret = null;
- Cursor cursor = mDatabase.query(mTableNames[TABLE_PASSWORD_ID],
- columns, selection, new String[] { schemePlusHost }, null,
- null, null);
- if (cursor.moveToFirst()) {
- ret = new String[2];
- ret[0] = cursor.getString(
- cursor.getColumnIndex(PASSWORD_USERNAME_COL));
- ret[1] = cursor.getString(
- cursor.getColumnIndex(PASSWORD_PASSWORD_COL));
+ Cursor cursor = null;
+ try {
+ cursor = mDatabase.query(mTableNames[TABLE_PASSWORD_ID],
+ columns, selection, new String[] { schemePlusHost }, null,
+ null, null);
+ if (cursor.moveToFirst()) {
+ ret = new String[2];
+ ret[0] = cursor.getString(
+ cursor.getColumnIndex(PASSWORD_USERNAME_COL));
+ ret[1] = cursor.getString(
+ cursor.getColumnIndex(PASSWORD_PASSWORD_COL));
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getUsernamePassword", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return ret;
}
}
@@ -900,17 +951,23 @@
+ HTTPAUTH_REALM_COL + " == ?)";
synchronized (mHttpAuthLock) {
String[] ret = null;
- Cursor cursor = mDatabase.query(mTableNames[TABLE_HTTPAUTH_ID],
- columns, selection, new String[] { host, realm }, null,
- null, null);
- if (cursor.moveToFirst()) {
- ret = new String[2];
- ret[0] = cursor.getString(
- cursor.getColumnIndex(HTTPAUTH_USERNAME_COL));
- ret[1] = cursor.getString(
- cursor.getColumnIndex(HTTPAUTH_PASSWORD_COL));
+ Cursor cursor = null;
+ try {
+ cursor = mDatabase.query(mTableNames[TABLE_HTTPAUTH_ID],
+ columns, selection, new String[] { host, realm }, null,
+ null, null);
+ if (cursor.moveToFirst()) {
+ ret = new String[2];
+ ret[0] = cursor.getString(
+ cursor.getColumnIndex(HTTPAUTH_USERNAME_COL));
+ ret[1] = cursor.getString(
+ cursor.getColumnIndex(HTTPAUTH_PASSWORD_COL));
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getHttpAuthUsernamePassword", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return ret;
}
}
@@ -958,18 +1015,24 @@
final String selection = "(" + FORMURL_URL_COL + " == ?)";
synchronized (mFormLock) {
long urlid = -1;
- Cursor cursor = mDatabase.query(mTableNames[TABLE_FORMURL_ID],
- ID_PROJECTION, selection, new String[] { url }, null, null,
- null);
- if (cursor.moveToFirst()) {
- urlid = cursor.getLong(cursor.getColumnIndex(ID_COL));
- } else {
- ContentValues c = new ContentValues();
- c.put(FORMURL_URL_COL, url);
- urlid = mDatabase.insert(
- mTableNames[TABLE_FORMURL_ID], null, c);
+ Cursor cursor = null;
+ try {
+ cursor = mDatabase.query(mTableNames[TABLE_FORMURL_ID],
+ ID_PROJECTION, selection, new String[] { url }, null, null,
+ null);
+ if (cursor.moveToFirst()) {
+ urlid = cursor.getLong(cursor.getColumnIndex(ID_COL));
+ } else {
+ ContentValues c = new ContentValues();
+ c.put(FORMURL_URL_COL, url);
+ urlid = mDatabase.insert(
+ mTableNames[TABLE_FORMURL_ID], null, c);
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "setFormData", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
if (urlid >= 0) {
Set<Entry<String, String>> set = formdata.entrySet();
Iterator<Entry<String, String>> iter = set.iterator();
@@ -1002,27 +1065,39 @@
final String dataSelection = "(" + FORMDATA_URLID_COL + " == ?) AND ("
+ FORMDATA_NAME_COL + " == ?)";
synchronized (mFormLock) {
- Cursor cursor = mDatabase.query(mTableNames[TABLE_FORMURL_ID],
- ID_PROJECTION, urlSelection, new String[] { url }, null,
- null, null);
- if (cursor.moveToFirst()) {
- long urlid = cursor.getLong(cursor.getColumnIndex(ID_COL));
- Cursor dataCursor = mDatabase.query(
- mTableNames[TABLE_FORMDATA_ID],
- new String[] { ID_COL, FORMDATA_VALUE_COL },
- dataSelection,
- new String[] { Long.toString(urlid), name }, null,
+ Cursor cursor = null;
+ try {
+ cursor = mDatabase.query(mTableNames[TABLE_FORMURL_ID],
+ ID_PROJECTION, urlSelection, new String[] { url }, null,
null, null);
- if (dataCursor.moveToFirst()) {
- int valueCol =
- dataCursor.getColumnIndex(FORMDATA_VALUE_COL);
- do {
- values.add(dataCursor.getString(valueCol));
- } while (dataCursor.moveToNext());
+ if (cursor.moveToFirst()) {
+ long urlid = cursor.getLong(cursor.getColumnIndex(ID_COL));
+ Cursor dataCursor = null;
+ try {
+ dataCursor = mDatabase.query(
+ mTableNames[TABLE_FORMDATA_ID],
+ new String[] { ID_COL, FORMDATA_VALUE_COL },
+ dataSelection,
+ new String[] { Long.toString(urlid), name },
+ null, null, null);
+ if (dataCursor.moveToFirst()) {
+ int valueCol = dataCursor.getColumnIndex(
+ FORMDATA_VALUE_COL);
+ do {
+ values.add(dataCursor.getString(valueCol));
+ } while (dataCursor.moveToNext());
+ }
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getFormData dataCursor", e);
+ } finally {
+ if (dataCursor != null) dataCursor.close();
+ }
}
- dataCursor.close();
+ } catch (IllegalStateException e) {
+ Log.e(LOGTAG, "getFormData cursor", e);
+ } finally {
+ if (cursor != null) cursor.close();
}
- cursor.close();
return values;
}
}
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 86011d7..a30059c 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -1835,9 +1835,11 @@
mSelectedPosition < mAdapter.getCount()) {
final View view = getChildAt(mSelectedPosition - mFirstPosition);
- performItemClick(view, mSelectedPosition, mSelectedRowId);
+ if (view != null) {
+ performItemClick(view, mSelectedPosition, mSelectedRowId);
+ view.setPressed(false);
+ }
setPressed(false);
- if (view != null) view.setPressed(false);
return true;
}
break;
diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java
index ea99f03..52a560c 100644
--- a/core/java/android/widget/TabWidget.java
+++ b/core/java/android/widget/TabWidget.java
@@ -221,7 +221,7 @@
* @param drawable the right strip drawable
*/
public void setRightStripDrawable(Drawable drawable) {
- mBottomLeftStrip = drawable;
+ mBottomRightStrip = drawable;
requestLayout();
invalidate(); }
@@ -232,7 +232,7 @@
* right strip drawable
*/
public void setRightStripDrawable(int resId) {
- mBottomLeftStrip = mContext.getResources().getDrawable(resId);
+ mBottomRightStrip = mContext.getResources().getDrawable(resId);
requestLayout();
invalidate();
}
diff --git a/core/java/com/google/android/mms/pdu/PduPersister.java b/core/java/com/google/android/mms/pdu/PduPersister.java
index 2a1f23a..d4ac24a 100644
--- a/core/java/com/google/android/mms/pdu/PduPersister.java
+++ b/core/java/com/google/android/mms/pdu/PduPersister.java
@@ -424,7 +424,8 @@
// faster.
if ("text/plain".equals(type) || "application/smil".equals(type)) {
String text = c.getString(PART_COLUMN_TEXT);
- byte [] blob = new EncodedStringValue(text).getTextString();
+ byte [] blob = new EncodedStringValue(text != null ? text : "")
+ .getTextString();
baos.write(blob, 0, blob.length);
} else {
@@ -858,7 +859,7 @@
} else {
values.put(Mms.SUBJECT, "");
}
-
+
long messageSize = sendReq.getMessageSize();
if (messageSize > 0) {
values.put(Mms.MESSAGE_SIZE, messageSize);
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 68b351b..b56e638 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1472,8 +1472,6 @@
//====================================================================
// Remote Control
/**
- * @hide
- * TODO unhide for SDK
* TODO document for SDK
* @param eventReceiver identifier of a {@link android.content.BroadcastReceiver}
* that will receive the media button intent. This broadcast receiver must be declared
@@ -1490,21 +1488,6 @@
}
/**
- * @hide
- * TODO unhide for SDK
- * TODO document for SDK
- * @param eventReceiverClass class of a {@link android.content.BroadcastReceiver} that will
- * receive the media button intent. This broadcast receiver must be declared in the
- * application manifest.
- */
- public void registerMediaButtonEventReceiver(Class<?> eventReceiverClass) {
- registerMediaButtonEventReceiver(new ComponentName(
- eventReceiverClass.getPackage().getName(), eventReceiverClass.getName()));
- }
-
- /**
- * @hide
- * TODO unhide for SDK
* TODO document for SDK
*/
public void unregisterMediaButtonEventReceiver(ComponentName eventReceiver) {
@@ -1517,16 +1500,6 @@
}
/**
- * @hide
- * TODO unhide for SDK
- * TODO document for SDK
- */
- public void unregisterMediaButtonEventReceiver(Class<?> eventReceiverClass) {
- unregisterMediaButtonEventReceiver(new ComponentName(
- eventReceiverClass.getPackage().getName(), eventReceiverClass.getName()));
- }
-
- /**
* @hide
* Reload audio settings. This method is called by Settings backup
* agent when audio settings are restored and causes the AudioService
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index d3ac026..a4703de 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -1203,7 +1203,10 @@
try {
mConnector.doCommand(cmd);
} catch (NativeDaemonConnectorException e) {
- rc = StorageResultCode.OperationFailedInternalError;
+ int code = e.getCode();
+ if (code != VoldResponseCode.OpFailedStorageBusy) {
+ rc = StorageResultCode.OperationFailedInternalError;
+ }
}
if (rc == StorageResultCode.OperationSucceeded) {
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index d72416d..848997b 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -571,6 +571,7 @@
binder = b;
tag = t;
uid = u == MY_UID ? Process.SYSTEM_UID : u;
+ pid = Binder.getCallingPid();
if (u != MY_UID || (
!"KEEP_SCREEN_ON_FLAG".equals(tag)
&& !"KeyInputQueue".equals(tag))) {
@@ -595,6 +596,7 @@
final IBinder binder;
final String tag;
final int uid;
+ final int pid;
final int monitorType;
boolean activated = true;
int minState;
@@ -998,7 +1000,8 @@
activated = " activated";
}
pw.println(" " + type + " '" + wl.tag + "'" + acquireCausesWakeup
- + activated + " (minState=" + wl.minState + ")");
+ + activated + " (minState=" + wl.minState + ", uid=" + wl.uid
+ + ", pid=" + wl.pid + ")");
}
pw.println();
diff --git a/wifi/java/android/net/wifi/WifiStateTracker.java b/wifi/java/android/net/wifi/WifiStateTracker.java
index abae65d..73ed6ed 100644
--- a/wifi/java/android/net/wifi/WifiStateTracker.java
+++ b/wifi/java/android/net/wifi/WifiStateTracker.java
@@ -54,10 +54,11 @@
import android.database.ContentObserver;
import com.android.internal.app.IBatteryStats;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* Track the state of Wifi connectivity. All event handling is done here,
@@ -284,6 +285,13 @@
* {@link WifiManager#WIFI_STATE_UNKNOWN}
*/
private int mWifiState;
+
+ /**
+ * For getWifiState(), to make sure it's always fast, even when the
+ * instance lock is held on other slow operations.
+ */
+ private final AtomicInteger mWifiStateAtomic = new AtomicInteger(WIFI_STATE_UNKNOWN);
+
// Wi-Fi run states:
private static final int RUN_STATE_STARTING = 1;
private static final int RUN_STATE_RUNNING = 2;
@@ -1504,11 +1512,12 @@
return true;
}
- public synchronized int getWifiState() {
- return mWifiState;
+ public int getWifiState() {
+ return mWifiStateAtomic.get();
}
public synchronized void setWifiState(int wifiState) {
+ mWifiStateAtomic.set(wifiState);
mWifiState = wifiState;
}