Merge "MiltiWaveView accessibility improvement." into ics-factoryrom
diff --git a/Android.mk b/Android.mk
index 352e5eb..91850d5 100644
--- a/Android.mk
+++ b/Android.mk
@@ -238,7 +238,7 @@
 # Make sure that framework-res is installed when framework is.
 $(LOCAL_INSTALLED_MODULE): | $(dir $(LOCAL_INSTALLED_MODULE))framework-res.apk
 
-framework_built := $(LOCAL_BUILT_MODULE)
+framework_built := $(call java-lib-deps,framework)
 
 # AIDL files to be preprocessed and included in the SDK,
 # relative to the root of the build tree.
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 5dfbe01..c270f21 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -245,6 +245,20 @@
 }
 
 static void
+decVideoSurfaceRef(JNIEnv *env, jobject thiz)
+{
+    sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
+    if (mp == NULL) {
+        return;
+    }
+
+    sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz);
+    if (old_st != NULL) {
+        old_st->decStrong(thiz);
+    }
+}
+
+static void
 setVideoSurface(JNIEnv *env, jobject thiz, jobject jsurface, jboolean mediaPlayerMustBeAlive)
 {
     sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
@@ -255,16 +269,15 @@
         return;
     }
 
-    sp<ISurfaceTexture> old_st = getVideoSurfaceTexture(env, thiz);
+    decVideoSurfaceRef(env, thiz);
+
     sp<ISurfaceTexture> new_st;
     if (jsurface) {
         sp<Surface> surface(Surface_getSurface(env, jsurface));
         new_st = surface->getSurfaceTexture();
         new_st->incStrong(thiz);
     }
-    if (old_st != NULL) {
-        old_st->decStrong(thiz);
-    }
+
     env->SetIntField(thiz, fields.surface_texture, (int)new_st.get());
 
     // This will fail if the media player has not been initialized yet. This
@@ -625,7 +638,7 @@
 android_media_MediaPlayer_release(JNIEnv *env, jobject thiz)
 {
     LOGV("release");
-    setVideoSurface(env, thiz, NULL, false /* mediaPlayerMustBeAlive */);
+    decVideoSurfaceRef(env, thiz);
     sp<MediaPlayer> mp = setMediaPlayer(env, thiz, 0);
     if (mp != NULL) {
         // this prevents native callbacks after the object is released
diff --git a/services/java/com/android/server/accessibility/TouchExplorer.java b/services/java/com/android/server/accessibility/TouchExplorer.java
index aa43bb6..5875ee3 100644
--- a/services/java/com/android/server/accessibility/TouchExplorer.java
+++ b/services/java/com/android/server/accessibility/TouchExplorer.java
@@ -659,8 +659,8 @@
      * @param policyFlags The policy flags associated with the event.
      */
     private void sendActionDownAndUp(MotionEvent prototype, int policyFlags) {
-        // Tap with the pointer that last went up - we may have inactive pointers.
-        final int pointerId = mPointerTracker.getLastReceivedUpPointerId();
+        // Tap with the pointer that last explored - we may have inactive pointers.
+        final int pointerId = prototype.getPointerId(prototype.getActionIndex());
         final int pointerIdBits = (1 << pointerId);
         sendMotionEvent(prototype, MotionEvent.ACTION_DOWN, pointerIdBits, policyFlags);
         sendMotionEvent(prototype, MotionEvent.ACTION_UP, pointerIdBits, policyFlags);