Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 007fc721 authored by Mike Lockwood's avatar Mike Lockwood Committed by Android (Google) Code Review
Browse files

Merge "MTP: Remove obsolete setPtpMode support"

parents 523510e9 aa48835c
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -61,10 +61,6 @@ public class MtpServer {
        native_send_object_removed(handle);
    }

    public void setPtpMode(boolean usePtp) {
        native_set_ptp_mode(usePtp);
    }

    public void addStorage(MtpStorage storage) {
        native_add_storage(storage);
    }
@@ -78,7 +74,6 @@ public class MtpServer {
    private native final void native_stop();
    private native final void native_send_object_added(int handle);
    private native final void native_send_object_removed(int handle);
    private native final void native_set_ptp_mode(boolean usePtp);
    private native final void native_add_storage(MtpStorage storage);
    private native final void native_remove_storage(int storageId);
}
+0 −22
Original line number Diff line number Diff line
@@ -70,14 +70,12 @@ private:
    MtpDatabase*    mDatabase;
    MtpServer*      mServer;
    MtpStorageList  mStorageList;
    bool            mUsePtp;
    int             mFd;

public:
    MtpThread(MtpDatabase* database)
        :   mDatabase(database),
            mServer(NULL),
            mUsePtp(false),
            mFd(-1)
    {
    }
@@ -85,10 +83,6 @@ public:
    virtual ~MtpThread() {
    }

    void setPtpMode(bool usePtp) {
        mUsePtp = usePtp;
    }

    void addStorage(MtpStorage *storage) {
        mStorageList.push(storage);
        if (mServer)
@@ -119,9 +113,6 @@ public:

        mFd = open("/dev/mtp_usb", O_RDWR);
        if (mFd >= 0) {
            ioctl(mFd, MTP_SET_INTERFACE_MODE,
                    (mUsePtp ? MTP_INTERFACE_MODE_PTP : MTP_INTERFACE_MODE_MTP));

            mServer = new MtpServer(mFd, mDatabase, AID_MEDIA_RW, 0664, 0775);
            for (size_t i = 0; i < mStorageList.size(); i++) {
                mServer->addStorage(mStorageList[i]);
@@ -223,18 +214,6 @@ android_mtp_MtpServer_send_object_removed(JNIEnv *env, jobject thiz, jint handle
#endif
}

static void
android_mtp_MtpServer_set_ptp_mode(JNIEnv *env, jobject thiz, jboolean usePtp)
{
#ifdef HAVE_ANDROID_OS
    sMutex.lock();
    MtpThread *thread = sThread.get();
    if (thread)
        thread->setPtpMode(usePtp);
    sMutex.unlock();
#endif
}

static void
android_mtp_MtpServer_add_storage(JNIEnv *env, jobject thiz, jobject jstorage)
{
@@ -290,7 +269,6 @@ static JNINativeMethod gMethods[] = {
    {"native_stop",                 "()V",  (void *)android_mtp_MtpServer_stop},
    {"native_send_object_added",    "(I)V", (void *)android_mtp_MtpServer_send_object_added},
    {"native_send_object_removed",  "(I)V", (void *)android_mtp_MtpServer_send_object_removed},
    {"native_set_ptp_mode",         "(Z)V", (void *)android_mtp_MtpServer_set_ptp_mode},
    {"native_add_storage",          "(Landroid/mtp/MtpStorage;)V",
                                            (void *)android_mtp_MtpServer_add_storage},
    {"native_remove_storage",       "(I)V", (void *)android_mtp_MtpServer_remove_storage},