summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-17 07:26:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-17 07:26:44 -0700
commitc97022e7acc6da71e558e9137036622b4c77ca46 (patch)
tree20b336c7422d0e0838475179d67cbe24fec83fc7 /media
parent4502636629ebb3f2ebb8521241c364666d1d7345 (diff)
parent11473332b4df78610ebb903e255d69ab35e5bf59 (diff)
downloadframeworks_base-c97022e7acc6da71e558e9137036622b4c77ca46.zip
frameworks_base-c97022e7acc6da71e558e9137036622b4c77ca46.tar.gz
frameworks_base-c97022e7acc6da71e558e9137036622b4c77ca46.tar.bz2
am 11473332: Merge "MtpServer: Do not attempt to stop MTP if it has not been started" into honeycomb-mr1
* commit '11473332b4df78610ebb903e255d69ab35e5bf59': MtpServer: Do not attempt to stop MTP if it has not been started
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) {