FileDocCategorySizeDatePackage
MtpServer.javaAPI DocAndroid 5.1 API2288Thu Mar 12 22:22:30 GMT 2015android.mtp

MtpServer

public class MtpServer extends Object implements Runnable
Java wrapper for MTP/PTP support as USB responder. {@hide}

Fields Summary
private long
mNativeContext
Constructors Summary
public MtpServer(MtpDatabase database, boolean usePtp)

        System.loadLibrary("media_jni");
    
        native_setup(database, usePtp);
        database.setServer(this);
    
Methods Summary
public voidaddStorage(MtpStorage storage)

        native_add_storage(storage);
    
private final native voidnative_add_storage(MtpStorage storage)

private final native voidnative_cleanup()

private final native voidnative_remove_storage(int storageId)

private final native voidnative_run()

private final native voidnative_send_device_property_changed(int property)

private final native voidnative_send_object_added(int handle)

private final native voidnative_send_object_removed(int handle)

private final native voidnative_setup(MtpDatabase database, boolean usePtp)

public voidremoveStorage(MtpStorage storage)

        native_remove_storage(storage.getStorageId());
    
public voidrun()

        native_run();
        native_cleanup();
    
public voidsendDevicePropertyChanged(int property)

        native_send_device_property_changed(property);
    
public voidsendObjectAdded(int handle)

        native_send_object_added(handle);
    
public voidsendObjectRemoved(int handle)

        native_send_object_removed(handle);
    
public voidstart()

        Thread thread = new Thread(this, "MtpServer");
        thread.start();