Merge "Fix metered SSID matching regression."
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 9e5a326..ccb84e6 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -1278,6 +1278,7 @@
mBrowserFrame = null;
mSettings.onDestroyed();
mNativeClass = 0;
+ WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic);
mWebViewClassic = null;
}
break;
@@ -1982,7 +1983,6 @@
mEventHub.sendMessageAtFrontOfQueue(
Message.obtain(null, EventHub.DESTROY));
mEventHub.blockMessages();
- WebCoreThreadWatchdog.unregisterWebView(mWebViewClassic);
}
}
diff --git a/core/jni/android/graphics/SurfaceTexture.cpp b/core/jni/android/graphics/SurfaceTexture.cpp
index 3315045..f8715fe 100644
--- a/core/jni/android/graphics/SurfaceTexture.cpp
+++ b/core/jni/android/graphics/SurfaceTexture.cpp
@@ -18,7 +18,7 @@
#include <stdio.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <android_runtime/AndroidRuntime.h>
@@ -48,10 +48,10 @@
// ----------------------------------------------------------------------------
static void SurfaceTexture_setSurfaceTexture(JNIEnv* env, jobject thiz,
- const sp<SurfaceTexture>& surfaceTexture)
+ const sp<GLConsumer>& surfaceTexture)
{
- SurfaceTexture* const p =
- (SurfaceTexture*)env->GetIntField(thiz, fields.surfaceTexture);
+ GLConsumer* const p =
+ (GLConsumer*)env->GetIntField(thiz, fields.surfaceTexture);
if (surfaceTexture.get()) {
surfaceTexture->incStrong(thiz);
}
@@ -62,10 +62,10 @@
}
static void SurfaceTexture_setFrameAvailableListener(JNIEnv* env,
- jobject thiz, sp<SurfaceTexture::FrameAvailableListener> listener)
+ jobject thiz, sp<GLConsumer::FrameAvailableListener> listener)
{
- SurfaceTexture::FrameAvailableListener* const p =
- (SurfaceTexture::FrameAvailableListener*)
+ GLConsumer::FrameAvailableListener* const p =
+ (GLConsumer::FrameAvailableListener*)
env->GetIntField(thiz, fields.frameAvailableListener);
if (listener.get()) {
listener->incStrong(thiz);
@@ -76,16 +76,16 @@
env->SetIntField(thiz, fields.frameAvailableListener, (int)listener.get());
}
-sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env,
+sp<GLConsumer> SurfaceTexture_getSurfaceTexture(JNIEnv* env,
jobject thiz)
{
- return (SurfaceTexture*)env->GetIntField(thiz, fields.surfaceTexture);
+ return (GLConsumer*)env->GetIntField(thiz, fields.surfaceTexture);
}
sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(
JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
sp<SurfaceTextureClient> surfaceTextureClient(surfaceTexture != NULL ?
new SurfaceTextureClient(surfaceTexture->getBufferQueue()) : NULL);
return surfaceTextureClient;
@@ -99,7 +99,7 @@
// ----------------------------------------------------------------------------
-class JNISurfaceTextureContext : public SurfaceTexture::FrameAvailableListener
+class JNISurfaceTextureContext : public GLConsumer::FrameAvailableListener
{
public:
JNISurfaceTextureContext(JNIEnv* env, jobject weakThiz, jclass clazz);
@@ -200,7 +200,7 @@
static void SurfaceTexture_init(JNIEnv* env, jobject thiz, jint texName,
jobject weakThiz, jboolean allowSynchronous)
{
- sp<SurfaceTexture> surfaceTexture(new SurfaceTexture(texName, allowSynchronous));
+ sp<GLConsumer> surfaceTexture(new GLConsumer(texName, allowSynchronous));
if (surfaceTexture == 0) {
jniThrowException(env, OutOfResourcesException,
"Unable to create native SurfaceTexture");
@@ -223,7 +223,7 @@
static void SurfaceTexture_finalize(JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
surfaceTexture->setFrameAvailableListener(0);
SurfaceTexture_setFrameAvailableListener(env, thiz, 0);
SurfaceTexture_setSurfaceTexture(env, thiz, 0);
@@ -232,13 +232,13 @@
static void SurfaceTexture_setDefaultBufferSize(
JNIEnv* env, jobject thiz, jint width, jint height)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
surfaceTexture->setDefaultBufferSize(width, height);
}
static void SurfaceTexture_updateTexImage(JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
status_t err = surfaceTexture->updateTexImage();
if (err == INVALID_OPERATION) {
jniThrowException(env, IllegalStateException, "Unable to update texture contents (see "
@@ -250,20 +250,20 @@
static jint SurfaceTexture_detachFromGLContext(JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
return surfaceTexture->detachFromContext();
}
static jint SurfaceTexture_attachToGLContext(JNIEnv* env, jobject thiz, jint tex)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
return surfaceTexture->attachToContext((GLuint)tex);
}
static void SurfaceTexture_getTransformMatrix(JNIEnv* env, jobject thiz,
jfloatArray jmtx)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
float* mtx = env->GetFloatArrayElements(jmtx, NULL);
surfaceTexture->getTransformMatrix(mtx);
env->ReleaseFloatArrayElements(jmtx, mtx, 0);
@@ -271,13 +271,13 @@
static jlong SurfaceTexture_getTimestamp(JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
return surfaceTexture->getTimestamp();
}
static void SurfaceTexture_release(JNIEnv* env, jobject thiz)
{
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, thiz));
surfaceTexture->abandon();
}
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index d39f565c..0e0893b 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -27,7 +27,7 @@
#include <cutils/properties.h>
#include <utils/Vector.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/Surface.h>
#include <camera/Camera.h>
#include <binder/IMemory.h>
@@ -555,7 +555,7 @@
sp<BufferQueue> bufferQueue = NULL;
if (jSurfaceTexture != NULL) {
- sp<SurfaceTexture> surfaceTexture =
+ sp<GLConsumer> surfaceTexture =
SurfaceTexture_getSurfaceTexture(env, jSurfaceTexture);
if (surfaceTexture != NULL) {
bufferQueue = surfaceTexture->getBufferQueue();
diff --git a/core/jni/android_media_RemoteDisplay.cpp b/core/jni/android_media_RemoteDisplay.cpp
index 5d24f61..a340fa1 100644
--- a/core/jni/android_media_RemoteDisplay.cpp
+++ b/core/jni/android_media_RemoteDisplay.cpp
@@ -27,7 +27,7 @@
#include <binder/IServiceManager.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <media/IMediaPlayerService.h>
#include <media/IRemoteDisplay.h>
@@ -60,14 +60,14 @@
}
public:
- virtual void onDisplayConnected(const sp<ISurfaceTexture>& surfaceTexture,
+ virtual void onDisplayConnected(const sp<IGraphicBufferProducer>& bufferProducer,
uint32_t width, uint32_t height, uint32_t flags) {
JNIEnv* env = AndroidRuntime::getJNIEnv();
- jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, surfaceTexture);
+ jobject surfaceObj = android_view_Surface_createFromISurfaceTexture(env, bufferProducer);
if (surfaceObj == NULL) {
ALOGE("Could not create Surface from surface texture %p provided by media server.",
- surfaceTexture.get());
+ bufferProducer.get());
return;
}
diff --git a/core/jni/android_opengl_EGL14.cpp b/core/jni/android_opengl_EGL14.cpp
index 2b265db..9c7124a 100644
--- a/core/jni/android_opengl_EGL14.cpp
+++ b/core/jni/android_opengl_EGL14.cpp
@@ -28,7 +28,7 @@
#include <EGL/egl.h>
#include <gui/Surface.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <ui/ANativeObjectBase.h>
@@ -605,7 +605,7 @@
jint _remaining;
EGLint *attrib_list = (EGLint *) 0;
android::sp<ANativeWindow> window;
- android::sp<android::SurfaceTexture> surfaceTexture;
+ android::sp<android::GLConsumer> surfaceTexture;
if (!attrib_list_ref) {
_exception = 1;
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 5d306d2..d8d55b2 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -24,7 +24,7 @@
#include <android_runtime/AndroidRuntime.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <androidfw/ResourceTypes.h>
@@ -806,7 +806,7 @@
static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz,
Layer* layer, jint width, jint height, jboolean isOpaque, jobject surface) {
float transform[16];
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
+ sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
if (surfaceTexture->updateTexImage() == NO_ERROR) {
surfaceTexture->getTransformMatrix(transform);
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index 2767e94..1f15370 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -28,7 +28,7 @@
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <ui/DisplayInfo.h>
#include <ui/Rect.h>
@@ -234,7 +234,7 @@
}
}
-static sp<ISurfaceTexture> getISurfaceTexture(JNIEnv* env, jobject surfaceObj) {
+static sp<IGraphicBufferProducer> getISurfaceTexture(JNIEnv* env, jobject surfaceObj) {
if (surfaceObj) {
sp<Surface> surface(getSurface(env, surfaceObj));
if (surface != NULL) {
@@ -245,12 +245,12 @@
}
jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env,
- const sp<ISurfaceTexture>& surfaceTexture) {
- if (surfaceTexture == NULL) {
+ const sp<IGraphicBufferProducer>& bufferProducer) {
+ if (bufferProducer == NULL) {
return NULL;
}
- sp<Surface> surface(new Surface(surfaceTexture));
+ sp<Surface> surface(new Surface(bufferProducer));
if (surface == NULL) {
return NULL;
}
@@ -258,7 +258,7 @@
jobject surfaceObj = env->NewObject(gSurfaceClassInfo.clazz, gSurfaceClassInfo.ctor);
if (surfaceObj == NULL) {
if (env->ExceptionCheck()) {
- ALOGE("Could not create instance of Surface from ISurfaceTexture.");
+ ALOGE("Could not create instance of Surface from IGraphicBufferProducer.");
LOGE_EX(env);
env->ExceptionClear();
}
@@ -289,14 +289,14 @@
static void nativeCreateFromSurfaceTexture(JNIEnv* env, jobject surfaceObj,
jobject surfaceTextureObj) {
- sp<SurfaceTexture> st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj));
+ sp<GLConsumer> st(SurfaceTexture_getSurfaceTexture(env, surfaceTextureObj));
if (st == NULL) {
jniThrowException(env, "java/lang/IllegalArgumentException",
"SurfaceTexture has already been released");
return;
}
- sp<ISurfaceTexture> bq = st->getBufferQueue();
+ sp<IGraphicBufferProducer> bq = st->getBufferQueue();
sp<Surface> surface(new Surface(bq));
if (surface == NULL) {
@@ -667,8 +667,8 @@
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
if (token == NULL) return;
- sp<ISurfaceTexture> surfaceTexture(getISurfaceTexture(env, surfaceObj));
- SurfaceComposerClient::setDisplaySurface(token, surfaceTexture);
+ sp<IGraphicBufferProducer> bufferProducer(getISurfaceTexture(env, surfaceObj));
+ SurfaceComposerClient::setDisplaySurface(token, bufferProducer);
}
static void nativeSetDisplayLayerStack(JNIEnv* env, jclass clazz,
diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp
index 854c9ae..87b312f 100644
--- a/core/jni/android_view_TextureView.cpp
+++ b/core/jni/android_view_TextureView.cpp
@@ -22,7 +22,7 @@
#include <ui/Region.h>
#include <ui/Rect.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <SkBitmap.h>
@@ -67,8 +67,8 @@
static void android_view_TextureView_setDefaultBufferSize(JNIEnv* env, jobject,
jobject surface, jint width, jint height) {
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
- surfaceTexture->setDefaultBufferSize(width, height);
+ sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(env, surface));
+ glConsumer->setDefaultBufferSize(width, height);
}
static inline SkBitmap::Config convertPixelFormat(int32_t format) {
@@ -101,8 +101,8 @@
static void android_view_TextureView_createNativeWindow(JNIEnv* env, jobject textureView,
jobject surface) {
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
- sp<ANativeWindow> window = new SurfaceTextureClient(surfaceTexture->getBufferQueue());
+ sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(env, surface));
+ sp<ANativeWindow> window = new SurfaceTextureClient(glConsumer->getBufferQueue());
window->incStrong(0);
SET_INT(textureView, gTextureViewClassInfo.nativeWindow, jint(window.get()));
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 1c9562e..199d5bf 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -27,7 +27,7 @@
#include <GLES/gl.h>
#include <gui/Surface.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <SkBitmap.h>
@@ -353,9 +353,9 @@
return 0;
}
- sp<SurfaceTexture> surfaceTexture(SurfaceTexture_getSurfaceTexture(_env, native_window));
+ sp<GLConsumer> glConsumer(SurfaceTexture_getSurfaceTexture(_env, native_window));
- window = new SurfaceTextureClient(surfaceTexture->getBufferQueue());
+ window = new SurfaceTextureClient(glConsumer->getBufferQueue());
if (window == NULL)
goto not_valid_surface;
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index b919ba4..af1a447 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -246,7 +246,7 @@
* release() frees all the buffers and puts the SurfaceTexture into the
* 'abandoned' state. Once put in this state the SurfaceTexture can never
* leave it. When in the 'abandoned' state, all methods of the
- * ISurfaceTexture interface will fail with the NO_INIT error.
+ * IGraphicBufferProducer interface will fail with the NO_INIT error.
*
* Note that while calling this method causes all the buffers to be freed
* from the perspective of the the SurfaceTexture, if there are additional
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index e0470dc..75c7903 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -42,7 +42,7 @@
#include <rs.h>
#include <rsEnv.h>
#include <gui/Surface.h>
-#include <gui/SurfaceTexture.h>
+#include <gui/GLConsumer.h>
#include <gui/SurfaceTextureClient.h>
#include <android_runtime/android_graphics_SurfaceTexture.h>
@@ -242,7 +242,7 @@
LOG_API("nContextSetSurfaceTexture, con(%p), width(%i), height(%i), surface(%p)", con, width, height, (Surface *)sur);
sp<ANativeWindow> window;
- sp<SurfaceTexture> st;
+ sp<GLConsumer> st;
if (sur == 0) {
} else {
@@ -481,9 +481,9 @@
nAllocationGetSurfaceTextureID2(JNIEnv *_env, jobject _this, RsContext con, jint a, jobject jst)
{
LOG_API("nAllocationGetSurfaceTextureID2, con(%p), a(%p)", con, (RsAllocation)a);
- sp<SurfaceTexture> st = SurfaceTexture_getSurfaceTexture(_env, jst);
+ sp<GLConsumer> st = SurfaceTexture_getSurfaceTexture(_env, jst);
- rsAllocationGetSurfaceTextureID2(con, (RsAllocation)a, st.get(), sizeof(SurfaceTexture *));
+ rsAllocationGetSurfaceTextureID2(con, (RsAllocation)a, st.get(), sizeof(GLConsumer *));
}
static void
diff --git a/include/android_runtime/android_graphics_SurfaceTexture.h b/include/android_runtime/android_graphics_SurfaceTexture.h
index badf22c..77ccd2a 100644
--- a/include/android_runtime/android_graphics_SurfaceTexture.h
+++ b/include/android_runtime/android_graphics_SurfaceTexture.h
@@ -23,14 +23,14 @@
namespace android {
-class SurfaceTexture;
+class GLConsumer;
extern sp<ANativeWindow> android_SurfaceTexture_getNativeWindow(
JNIEnv* env, jobject thiz);
extern bool android_SurfaceTexture_isInstanceOf(JNIEnv* env, jobject thiz);
-/* Gets the underlying SurfaceTexture from a SurfaceTexture Java object. */
-extern sp<SurfaceTexture> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz);
+/* Gets the underlying GLConsumer from a SurfaceTexture Java object. */
+extern sp<GLConsumer> SurfaceTexture_getSurfaceTexture(JNIEnv* env, jobject thiz);
} // namespace android
diff --git a/include/android_runtime/android_view_Surface.h b/include/android_runtime/android_view_Surface.h
index df0fe72..b56aff8 100644
--- a/include/android_runtime/android_view_Surface.h
+++ b/include/android_runtime/android_view_Surface.h
@@ -24,7 +24,7 @@
namespace android {
class Surface;
-class ISurfaceTexture;
+class IGraphicBufferProducer;
/* Gets the underlying ANativeWindow for a Surface. */
extern sp<ANativeWindow> android_view_Surface_getNativeWindow(
@@ -36,9 +36,9 @@
/* Gets the underlying Surface from a Surface Java object. */
extern sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj);
-/* Creates a Surface from an ISurfaceTexture. */
+/* Creates a Surface from an IGraphicBufferProducer. */
extern jobject android_view_Surface_createFromISurfaceTexture(JNIEnv* env,
- const sp<ISurfaceTexture>& surfaceTexture);
+ const sp<IGraphicBufferProducer>& bufferProducer);
} // namespace android
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index ad05fcf..cd50de4 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -159,23 +159,13 @@
*/
private final Object mPlayStateLock = new Object();
/**
- * The listener the AudioTrack notifies when the playback position reaches a marker
- * or for periodic updates during the progression of the playback head.
- * @see #setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener)
- */
- private OnPlaybackPositionUpdateListener mPositionListener = null;
- /**
- * Lock to protect event listener updates against event notifications.
- */
- private final Object mPositionListenerLock = new Object();
- /**
* Size of the native audio buffer.
*/
private int mNativeBufferSizeInBytes = 0;
/**
* Handler for marker events coming from the native code.
*/
- private NativeEventHandlerDelegate mEventHandlerDelegate = null;
+ private NativeEventHandlerDelegate mEventHandlerDelegate;
/**
* Looper associated with the thread that creates the AudioTrack instance.
*/
@@ -737,13 +727,11 @@
*/
public void setPlaybackPositionUpdateListener(OnPlaybackPositionUpdateListener listener,
Handler handler) {
- synchronized (mPositionListenerLock) {
- mPositionListener = listener;
- }
if (listener != null) {
- mEventHandlerDelegate = new NativeEventHandlerDelegate(this, handler);
+ mEventHandlerDelegate = new NativeEventHandlerDelegate(this, listener, handler);
+ } else {
+ mEventHandlerDelegate = null;
}
-
}
@@ -1149,11 +1137,11 @@
* (potentially) handled in a different thread
*/
private class NativeEventHandlerDelegate {
- private final AudioTrack mAudioTrack;
private final Handler mHandler;
- NativeEventHandlerDelegate(AudioTrack track, Handler handler) {
- mAudioTrack = track;
+ NativeEventHandlerDelegate(final AudioTrack track,
+ final OnPlaybackPositionUpdateListener listener,
+ Handler handler) {
// find the looper for our new event handler
Looper looper;
if (handler != null) {
@@ -1169,22 +1157,18 @@
mHandler = new Handler(looper) {
@Override
public void handleMessage(Message msg) {
- if (mAudioTrack == null) {
+ if (track == null) {
return;
}
- OnPlaybackPositionUpdateListener listener = null;
- synchronized (mPositionListenerLock) {
- listener = mAudioTrack.mPositionListener;
- }
switch(msg.what) {
case NATIVE_EVENT_MARKER:
if (listener != null) {
- listener.onMarkerReached(mAudioTrack);
+ listener.onMarkerReached(track);
}
break;
case NATIVE_EVENT_NEW_POS:
if (listener != null) {
- listener.onPeriodicNotification(mAudioTrack);
+ listener.onPeriodicNotification(track);
}
break;
default:
@@ -1216,10 +1200,13 @@
return;
}
- if (track.mEventHandlerDelegate != null) {
- Message m =
- track.mEventHandlerDelegate.getHandler().obtainMessage(what, arg1, arg2, obj);
- track.mEventHandlerDelegate.getHandler().sendMessage(m);
+ NativeEventHandlerDelegate delegate = track.mEventHandlerDelegate;
+ if (delegate != null) {
+ Handler handler = delegate.getHandler();
+ if (handler != null) {
+ Message m = handler.obtainMessage(what, arg1, arg2, obj);
+ handler.sendMessage(m);
+ }
}
}
diff --git a/media/jni/android_media_MediaCodec.cpp b/media/jni/android_media_MediaCodec.cpp
index dab2de1..8740c08 100644
--- a/media/jni/android_media_MediaCodec.cpp
+++ b/media/jni/android_media_MediaCodec.cpp
@@ -111,12 +111,12 @@
status_t JMediaCodec::configure(
const sp<AMessage> &format,
- const sp<ISurfaceTexture> &surfaceTexture,
+ const sp<IGraphicBufferProducer> &bufferProducer,
const sp<ICrypto> &crypto,
int flags) {
sp<SurfaceTextureClient> client;
- if (surfaceTexture != NULL) {
- mSurfaceTextureClient = new SurfaceTextureClient(surfaceTexture);
+ if (bufferProducer != NULL) {
+ mSurfaceTextureClient = new SurfaceTextureClient(bufferProducer);
} else {
mSurfaceTextureClient.clear();
}
@@ -382,11 +382,11 @@
return;
}
- sp<ISurfaceTexture> surfaceTexture;
+ sp<IGraphicBufferProducer> bufferProducer;
if (jsurface != NULL) {
sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
if (surface != NULL) {
- surfaceTexture = surface->getSurfaceTexture();
+ bufferProducer = surface->getSurfaceTexture();
} else {
jniThrowException(
env,
@@ -401,7 +401,7 @@
crypto = JCrypto::GetCrypto(env, jcrypto);
}
- err = codec->configure(format, surfaceTexture, crypto, flags);
+ err = codec->configure(format, bufferProducer, crypto, flags);
throwExceptionAsNecessary(env, err);
}
diff --git a/media/jni/android_media_MediaCodec.h b/media/jni/android_media_MediaCodec.h
index bc9ad50..a9bb9af 100644
--- a/media/jni/android_media_MediaCodec.h
+++ b/media/jni/android_media_MediaCodec.h
@@ -30,7 +30,7 @@
struct AMessage;
struct AString;
struct ICrypto;
-struct ISurfaceTexture;
+struct IGraphicBufferProducer;
struct MediaCodec;
struct SurfaceTextureClient;
@@ -43,7 +43,7 @@
status_t configure(
const sp<AMessage> &format,
- const sp<ISurfaceTexture> &surfaceTexture,
+ const sp<IGraphicBufferProducer> &bufferProducer,
const sp<ICrypto> &crypto,
int flags);
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index ad536f2..5408a1f 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -39,7 +39,7 @@
#include "android_os_Parcel.h"
#include "android_util_Binder.h"
#include <binder/Parcel.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <gui/Surface.h>
#include <binder/IPCThreadState.h>
#include <binder/IServiceManager.h>
@@ -236,10 +236,10 @@
process_media_player_call( env, thiz, mp->setDataSource(fd, offset, length), "java/io/IOException", "setDataSourceFD failed." );
}
-static sp<ISurfaceTexture>
+static sp<IGraphicBufferProducer>
getVideoSurfaceTexture(JNIEnv* env, jobject thiz) {
- ISurfaceTexture * const p = (ISurfaceTexture*)env->GetIntField(thiz, fields.surface_texture);
- return sp<ISurfaceTexture>(p);
+ IGraphicBufferProducer * const p = (IGraphicBufferProducer*)env->GetIntField(thiz, fields.surface_texture);
+ return sp<IGraphicBufferProducer>(p);
}
static void
@@ -250,7 +250,7 @@
return;
}
- sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz);
+ sp<IGraphicBufferProducer> old_st = getVideoSurfaceTexture(env, thiz);
if (old_st != NULL) {
old_st->decStrong(thiz);
}
@@ -269,7 +269,7 @@
decVideoSurfaceRef(env, thiz);
- sp<ISurfaceTexture> new_st;
+ sp<IGraphicBufferProducer> new_st;
if (jsurface) {
sp<Surface> surface(android_view_Surface_getSurface(env, jsurface));
if (surface != NULL) {
@@ -313,7 +313,7 @@
// Handle the case where the display surface was set before the mp was
// initialized. We try again to make it stick.
- sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz);
+ sp<IGraphicBufferProducer> st = getVideoSurfaceTexture(env, thiz);
mp->setVideoSurfaceTexture(st);
process_media_player_call( env, thiz, mp->prepare(), "java/io/IOException", "Prepare failed." );
@@ -330,7 +330,7 @@
// Handle the case where the display surface was set before the mp was
// initialized. We try again to make it stick.
- sp<ISurfaceTexture> st = getVideoSurfaceTexture(env, thiz);
+ sp<IGraphicBufferProducer> st = getVideoSurfaceTexture(env, thiz);
mp->setVideoSurfaceTexture(st);
process_media_player_call( env, thiz, mp->prepareAsync(), "java/io/IOException", "Prepare Async failed." );
diff --git a/media/mca/filterfw/jni/jni_gl_environment.cpp b/media/mca/filterfw/jni/jni_gl_environment.cpp
index 3c596a4..b64004e 100644
--- a/media/mca/filterfw/jni/jni_gl_environment.cpp
+++ b/media/mca/filterfw/jni/jni_gl_environment.cpp
@@ -23,7 +23,7 @@
#include <media/mediarecorder.h>
#include "native/core/gl_env.h"
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <gui/SurfaceTextureClient.h>
#include <utils/Errors.h>
#include <system/window.h>
@@ -33,7 +33,7 @@
using android::filterfw::WindowHandle;
using android::MediaRecorder;
using android::sp;
-using android::ISurfaceTexture;
+using android::IGraphicBufferProducer;
using android::SurfaceTextureClient;
@@ -284,10 +284,10 @@
// Ask the mediarecorder to return a handle to a surfacemediasource
// This will talk to the StageFrightRecorder via MediaRecorderClient
// over binder calls
- sp<ISurfaceTexture> surfaceMS = mr->querySurfaceMediaSourceFromMediaServer();
+ sp<IGraphicBufferProducer> surfaceMS = mr->querySurfaceMediaSourceFromMediaServer();
if (surfaceMS == NULL) {
ALOGE("GLEnvironment: Error- MediaRecorder returned a null \
- <ISurfaceTexture> handle.");
+ <IGraphicBufferProducer> handle.");
return -1;
}
sp<SurfaceTextureClient> surfaceTC = new SurfaceTextureClient(surfaceMS);
diff --git a/media/mca/filterfw/jni/jni_gl_environment.h b/media/mca/filterfw/jni/jni_gl_environment.h
index af9c744..9dd7102 100644
--- a/media/mca/filterfw/jni/jni_gl_environment.h
+++ b/media/mca/filterfw/jni/jni_gl_environment.h
@@ -68,7 +68,7 @@
// The call to hook up the SurfaceMediaSource (in MediaServer) to the GL.
// We get a sp<ISurfaceTexure> from the MediaServer and talks to MediaServer
// over a binder interface. GL hooked up to the MediaServer by using the native
-// window created using the <ISurfaceTexture> handle
+// window created using the <IGraphicBufferProducer> handle
JNIEXPORT jint JNICALL
Java_android_filterfw_core_GLEnvironment_nativeAddSurfaceFromMediaRecorder(
JNIEnv* env,
diff --git a/media/mca/filterfw/native/core/gl_env.cpp b/media/mca/filterfw/native/core/gl_env.cpp
index 738b8e0..8ed82e2 100644
--- a/media/mca/filterfw/native/core/gl_env.cpp
+++ b/media/mca/filterfw/native/core/gl_env.cpp
@@ -159,9 +159,9 @@
return false;
}
- // Create dummy surface using a SurfaceTexture
- surfaceTexture_ = new SurfaceTexture(0);
- window_ = new SurfaceTextureClient(static_cast<sp<ISurfaceTexture> >(
+ // Create dummy surface using a GLConsumer
+ surfaceTexture_ = new GLConsumer(0);
+ window_ = new SurfaceTextureClient(static_cast<sp<IGraphicBufferProducer> >(
surfaceTexture_->getBufferQueue()));
surfaces_[0] = SurfaceWindowPair(eglCreateWindowSurface(display(), config, window_.get(), NULL), NULL);
diff --git a/media/mca/filterfw/native/core/gl_env.h b/media/mca/filterfw/native/core/gl_env.h
index b61785f..3c87195 100644
--- a/media/mca/filterfw/native/core/gl_env.h
+++ b/media/mca/filterfw/native/core/gl_env.h
@@ -27,7 +27,7 @@
#include <GLES2/gl2.h>
#include <EGL/egl.h>
-#include <gui/ISurfaceTexture.h>
+#include <gui/IGraphicBufferProducer.h>
#include <gui/SurfaceTextureClient.h>
namespace android {
@@ -236,8 +236,8 @@
// Dummy surface for context
sp<ANativeWindow> window_;
- // Dummy SurfaceTexture for context
- sp<SurfaceTexture> surfaceTexture_;
+ // Dummy GLConsumer for context
+ sp<GLConsumer> surfaceTexture_;
// The maximum surface id used.
int max_surface_id_;
diff --git a/media/tests/players/invoke_mock_media_player.cpp b/media/tests/players/invoke_mock_media_player.cpp
index 1289dfa..a94fedb 100644
--- a/media/tests/players/invoke_mock_media_player.cpp
+++ b/media/tests/players/invoke_mock_media_player.cpp
@@ -26,7 +26,7 @@
using android::INVALID_OPERATION;
using android::Surface;
-using android::ISurfaceTexture;
+using android::IGraphicBufferProducer;
using android::MediaPlayerBase;
using android::OK;
using android::Parcel;
@@ -69,7 +69,7 @@
virtual status_t setDataSource(int fd, int64_t offset, int64_t length) {return OK;}
virtual status_t setVideoSurfaceTexture(
- const sp<ISurfaceTexture>& surfaceTexture) {return OK;}
+ const sp<IGraphicBufferProducer>& bufferProducer) {return OK;}
virtual status_t prepare() {return OK;}
virtual status_t prepareAsync() {return OK;}
virtual status_t start() {return OK;}
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index 8c5ff04..4cfe5d5 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -1193,8 +1193,11 @@
log("startUsingNetworkFeature reconnecting to " + networkType + ": " +
feature);
}
- network.reconnect();
- return PhoneConstants.APN_REQUEST_STARTED;
+ if (network.reconnect()) {
+ return PhoneConstants.APN_REQUEST_STARTED;
+ } else {
+ return PhoneConstants.APN_REQUEST_FAILED;
+ }
} else {
// need to remember this unsupported request so we respond appropriately on stop
synchronized(this) {