am 745a42bb: Merge "aapt: add support for optional uses-permission" into jb-mr2-dev
* commit '745a42bbb9db8d54af5381ef5fe41828bf6fc352':
aapt: add support for optional uses-permission
diff --git a/Android.mk b/Android.mk
index 2ad7a72..e8af05d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -242,7 +242,7 @@
$(framework_res_source_path)/com/android/internal/R.java
LOCAL_NO_STANDARD_LIBRARIES := true
-LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext
+LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit ext okhttp
LOCAL_MODULE := framework
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
@@ -409,6 +409,7 @@
framework_docs_LOCAL_JAVA_LIBRARIES := \
bouncycastle \
core \
+ okhttp \
ext \
framework \
mms-common \
diff --git a/core/java/android/net/http/HttpResponseCache.java b/core/java/android/net/http/HttpResponseCache.java
index 73f3d7c..4e986a9 100644
--- a/core/java/android/net/http/HttpResponseCache.java
+++ b/core/java/android/net/http/HttpResponseCache.java
@@ -17,21 +17,21 @@
package android.net.http;
import android.content.Context;
+import com.android.okhttp.OkResponseCache;
+import com.android.okhttp.ResponseSource;
+import com.android.okhttp.internal.DiskLruCache;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.net.CacheRequest;
import java.net.CacheResponse;
-import java.net.ExtendedResponseCache;
import java.net.HttpURLConnection;
import java.net.ResponseCache;
-import java.net.ResponseSource;
import java.net.URI;
import java.net.URLConnection;
import java.util.List;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
-import libcore.io.DiskLruCache;
import libcore.io.IoUtils;
import org.apache.http.impl.client.DefaultHttpClient;
@@ -152,12 +152,12 @@
* }}</pre>
*/
public final class HttpResponseCache extends ResponseCache
- implements Closeable, ExtendedResponseCache {
+ implements Closeable, OkResponseCache {
- private final libcore.net.http.HttpResponseCache delegate;
+ private final com.android.okhttp.internal.http.HttpResponseCache delegate;
private HttpResponseCache(File directory, long maxSize) throws IOException {
- this.delegate = new libcore.net.http.HttpResponseCache(directory, maxSize);
+ this.delegate = new com.android.okhttp.internal.http.HttpResponseCache(directory, maxSize);
}
/**
@@ -274,7 +274,8 @@
}
/** @hide */
- @Override public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) {
+ @Override public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection)
+ throws IOException {
delegate.update(conditionalCacheHit, connection);
}
diff --git a/core/java/android/util/SparseArray.java b/core/java/android/util/SparseArray.java
index 366abd3..7e8fee5 100644
--- a/core/java/android/util/SparseArray.java
+++ b/core/java/android/util/SparseArray.java
@@ -118,7 +118,7 @@
mGarbage = true;
}
}
-
+
private void gc() {
// Log.e("SparseArray", "gc start with " + mSize);
@@ -214,7 +214,7 @@
/**
* Given an index in the range <code>0...size()-1</code>, returns
* the key from the <code>index</code>th key-value mapping that this
- * SparseArray stores.
+ * SparseArray stores.
*/
public int keyAt(int index) {
if (mGarbage) {
@@ -223,11 +223,11 @@
return mKeys[index];
}
-
+
/**
* Given an index in the range <code>0...size()-1</code>, returns
* the value from the <code>index</code>th key-value mapping that this
- * SparseArray stores.
+ * SparseArray stores.
*/
@SuppressWarnings("unchecked")
public E valueAt(int index) {
@@ -241,7 +241,7 @@
/**
* Given an index in the range <code>0...size()-1</code>, sets a new
* value for the <code>index</code>th key-value mapping that this
- * SparseArray stores.
+ * SparseArray stores.
*/
public void setValueAt(int index, E value) {
if (mGarbage) {
@@ -250,7 +250,7 @@
mValues[index] = value;
}
-
+
/**
* Returns the index for which {@link #keyAt} would return the
* specified key, or a negative number if the specified
@@ -268,9 +268,11 @@
* Returns an index for which {@link #valueAt} would return the
* specified key, or a negative number if no keys map to the
* specified value.
- * Beware that this is a linear search, unlike lookups by key,
+ * <p>Beware that this is a linear search, unlike lookups by key,
* and that multiple keys can map to the same value and this will
* find only one of them.
+ * <p>Note also that unlike most collections' {@code indexOf} methods,
+ * this method compares values using {@code ==} rather than {@code equals}.
*/
public int indexOfValue(E value) {
if (mGarbage) {
@@ -332,7 +334,7 @@
mValues[pos] = value;
mSize = pos + 1;
}
-
+
private static int binarySearch(int[] a, int start, int len, int key) {
int high = start + len, low = start - 1, guess;
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index b6b49a2..30c90e8 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -170,7 +170,7 @@
* <li>"audio/3gpp" - AMR narrowband audio
* <li>"audio/amr-wb" - AMR wideband audio
* <li>"audio/mpeg" - MPEG1/2 audio layer III
- * <li>"audio/mp4a-latm" - AAC audio
+ * <li>"audio/mp4a-latm" - AAC audio (note, this is raw AAC packets, not packaged in LATM!)
* <li>"audio/vorbis" - vorbis audio
* <li>"audio/g711-alaw" - G.711 alaw audio
* <li>"audio/g711-mlaw" - G.711 ulaw audio
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index cbc42eb..9921f7c 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -8921,10 +8921,31 @@
if (DEBUG_ORIENTATION &&
winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING) Slog.i(
TAG, "Resizing " + win + " WITH DRAW PENDING");
- win.mClient.resized(win.mFrame, win.mLastOverscanInsets, win.mLastContentInsets,
- win.mLastVisibleInsets,
- winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING,
- configChanged ? win.mConfiguration : null);
+ final IWindow client = win.mClient;
+ final Rect frame = win.mFrame;
+ final Rect overscanInsets = win.mLastOverscanInsets;
+ final Rect contentInsets = win.mLastContentInsets;
+ final Rect visibleInsets = win.mLastVisibleInsets;
+ final boolean reportDraw
+ = winAnimator.mDrawState == WindowStateAnimator.DRAW_PENDING;
+ final Configuration newConfig = configChanged ? win.mConfiguration : null;
+ if (win.mClient instanceof IWindow.Stub) {
+ // To prevent deadlock simulate one-way call if win.mClient is a local object.
+ mH.post(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ client.resized(frame, overscanInsets, contentInsets,
+ visibleInsets, reportDraw, newConfig);
+ } catch (RemoteException e) {
+ // Not a remote call, RemoteException won't be raised.
+ }
+ }
+ });
+ } else {
+ client.resized(frame, overscanInsets, contentInsets, visibleInsets, reportDraw,
+ newConfig);
+ }
win.mOverscanInsetsChanged = false;
win.mContentInsetsChanged = false;
win.mVisibleInsetsChanged = false;