diff options
author | Mike Lockwood <lockwood@android.com> | 2011-03-17 07:24:12 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-17 07:24:12 -0700 |
commit | 11473332b4df78610ebb903e255d69ab35e5bf59 (patch) | |
tree | 389323259c349ce2739ce888b8087fcd550baf01 /media | |
parent | 8f5cab8b31014a261f4e6e12e6d751de51de37c3 (diff) | |
parent | a3f8514492cb4bc8fa7c36e2c0f720342796ada7 (diff) | |
download | frameworks_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.java | 15 |
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) { |