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
This commit is contained in:
@ -24,6 +24,9 @@ import android.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class MtpServer {
|
public class MtpServer {
|
||||||
|
|
||||||
|
private final Object mLock = new Object();
|
||||||
|
private boolean mStarted;
|
||||||
|
|
||||||
private static final String TAG = "MtpServer";
|
private static final String TAG = "MtpServer";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -35,11 +38,19 @@ public class MtpServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
native_start();
|
synchronized (mLock) {
|
||||||
|
native_start();
|
||||||
|
mStarted = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void stop() {
|
||||||
native_stop();
|
synchronized (mLock) {
|
||||||
|
if (mStarted) {
|
||||||
|
native_stop();
|
||||||
|
mStarted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendObjectAdded(int handle) {
|
public void sendObjectAdded(int handle) {
|
||||||
|
Reference in New Issue
Block a user