Merge "DatePicker is calling back its listener on init." into honeycomb
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 28f3dc2..1389ed6 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -131,7 +131,7 @@
     Mutex::Autolock lock(mMutex);
     int found = INVALID_BUFFER_SLOT;
     for (int i = 0; i < mBufferCount; i++) {
-        if (!mSlots[i].mOwnedByClient && i != mCurrentTexture) {
+        if (!mSlots[i].mOwnedByClient && i != mCurrentTexture && i != mLastQueued) {
             mSlots[i].mOwnedByClient = true;
             found = i;
             break;
diff --git a/libs/utils/Threads.cpp b/libs/utils/Threads.cpp
index f6c55e4..ad9a94f 100644
--- a/libs/utils/Threads.cpp
+++ b/libs/utils/Threads.cpp
@@ -774,6 +774,9 @@
             self->mExitPending = true;
             self->mLock.lock();
             self->mRunning = false;
+            // clear thread ID so that requestExitAndWait() does not exit if
+            // called by a new thread using the same thread ID as this one.
+            self->mThread = thread_id_t(-1);
             self->mThreadExitedCondition.broadcast();
             self->mLock.unlock();
             break;
diff --git a/vpn/java/android/net/vpn/VpnManager.java b/vpn/java/android/net/vpn/VpnManager.java
index 60fecc2..ce40b5d 100644
--- a/vpn/java/android/net/vpn/VpnManager.java
+++ b/vpn/java/android/net/vpn/VpnManager.java
@@ -16,12 +16,15 @@
 
 package android.net.vpn;
 
+import java.io.File;
+
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.ServiceConnection;
 import android.os.Environment;
+import android.os.SystemProperties;
 import android.util.Log;
 
 /**
@@ -83,7 +86,7 @@
     // TODO(oam): Test VPN when EFS is enabled (will do later)...
     public static String getProfilePath() {
         // This call will return the correct path if Encrypted FS is enabled or not.
-        return Environment.getDataDirectory().getPath() + PROFILES_PATH;
+        return Environment.getSecureDataDirectory().getPath() + PROFILES_PATH;
     }
 
     /**
@@ -121,7 +124,7 @@
      */
     public VpnProfile createVpnProfile(VpnType type, boolean customized) {
         try {
-            VpnProfile p = type.getProfileClass().newInstance();
+            VpnProfile p = (VpnProfile) type.getProfileClass().newInstance();
             p.setCustomized(customized);
             return p;
         } catch (InstantiationException e) {