summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-17 07:24:12 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-03-17 07:24:12 -0700
commit11473332b4df78610ebb903e255d69ab35e5bf59 (patch)
tree389323259c349ce2739ce888b8087fcd550baf01 /media
parent8f5cab8b31014a261f4e6e12e6d751de51de37c3 (diff)
parenta3f8514492cb4bc8fa7c36e2c0f720342796ada7 (diff)
downloadframeworks_base-11473332b4df78610ebb903e255d69ab35e5bf59.zip
frameworks_base-11473332b4df78610ebb903e255d69ab35e5bf59.tar.gz
frameworks_base-11473332b4df78610ebb903e255d69ab35e5bf59.tar.bz2
Merge "MtpServer: Do not attempt to stop MTP if it has not been started" into honeycomb-mr1
Diffstat (limited to 'media')
-rw-r--r--media/java/android/mtp/MtpServer.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/media/java/android/mtp/MtpServer.java b/media/java/android/mtp/MtpServer.java
index fe734e1..006fa6d 100644
--- a/media/java/android/mtp/MtpServer.java
+++ b/media/java/android/mtp/MtpServer.java
@@ -24,6 +24,9 @@ import android.util.Log;
*/
public class MtpServer {
+ private final Object mLock = new Object();
+ private boolean mStarted;
+
private static final String TAG = "MtpServer";
static {
@@ -35,11 +38,19 @@ public class MtpServer {
}
public void start() {
- native_start();
+ synchronized (mLock) {
+ native_start();
+ mStarted = true;
+ }
}
public void stop() {
- native_stop();
+ synchronized (mLock) {
+ if (mStarted) {
+ native_stop();
+ mStarted = false;
+ }
+ }
}
public void sendObjectAdded(int handle) {