Loading media/java/android/mtp/MtpServer.java +3 −3 Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ public class MtpServer { System.loadLibrary("media_jni"); } public MtpServer(MtpDatabase database) { native_setup(database); public MtpServer(MtpDatabase database, boolean usePtp) { native_setup(database, usePtp); } public void start() { Loading Loading @@ -69,7 +69,7 @@ public class MtpServer { native_remove_storage(storage.getStorageId()); } private native final void native_setup(MtpDatabase database); private native final void native_setup(MtpDatabase database, boolean usePtp); private native final void native_start(); private native final void native_stop(); private native final void native_send_object_added(int handle); Loading media/jni/android_mtp_MtpServer.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -68,13 +68,15 @@ static bool ExceptionCheck(void* env) class MtpThread : public Thread { private: MtpDatabase* mDatabase; bool mPtp; MtpServer* mServer; MtpStorageList mStorageList; int mFd; public: MtpThread(MtpDatabase* database) MtpThread(MtpDatabase* database, bool usePtp) : mDatabase(database), mPtp(usePtp), mServer(NULL), mFd(-1) { Loading Loading @@ -113,7 +115,7 @@ public: mFd = open("/dev/mtp_usb", O_RDWR); if (mFd >= 0) { mServer = new MtpServer(mFd, mDatabase, AID_MEDIA_RW, 0664, 0775); mServer = new MtpServer(mFd, mDatabase, mPtp, AID_MEDIA_RW, 0664, 0775); for (size_t i = 0; i < mStorageList.size(); i++) { mServer->addStorage(mStorageList[i]); } Loading Loading @@ -156,11 +158,11 @@ static sp<MtpThread> sThread; #endif // HAVE_ANDROID_OS static void android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase) android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase, jboolean usePtp) { #ifdef HAVE_ANDROID_OS // create the thread and assign it to the smart pointer sThread = new MtpThread(getMtpDatabase(env, javaDatabase)); sThread = new MtpThread(getMtpDatabase(env, javaDatabase), usePtp); #endif } Loading Loading @@ -263,7 +265,7 @@ android_mtp_MtpServer_remove_storage(JNIEnv *env, jobject thiz, jint storageId) // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { {"native_setup", "(Landroid/mtp/MtpDatabase;)V", {"native_setup", "(Landroid/mtp/MtpDatabase;Z)V", (void *)android_mtp_MtpServer_setup}, {"native_start", "()V", (void *)android_mtp_MtpServer_start}, {"native_stop", "()V", (void *)android_mtp_MtpServer_stop}, Loading media/mtp/MtpServer.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -95,10 +95,11 @@ static const MtpEventCode kSupportedEventCodes[] = { MTP_EVENT_STORE_REMOVED, }; MtpServer::MtpServer(int fd, MtpDatabase* database, MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm) : mFD(fd), mDatabase(database), mPtp(ptp), mFileGroup(fileGroup), mFilePermission(filePerm), mDirectoryPermission(directoryPerm), Loading Loading @@ -426,9 +427,20 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { // fill in device info mData.putUInt16(MTP_STANDARD_VERSION); mData.putUInt32(6); // MTP Vendor Extension ID if (mPtp) { mData.putUInt32(0); } else { // MTP Vendor Extension ID mData.putUInt32(6); } mData.putUInt16(MTP_STANDARD_VERSION); if (mPtp) { // no extensions string.set(""); } else { // MTP extensions string.set("microsoft.com: 1.0; android.com: 1.0;"); } mData.putString(string); // MTP Extensions mData.putUInt16(0); //Functional Mode mData.putAUInt16(kSupportedOperationCodes, Loading media/mtp/MtpServer.h +4 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ private: MtpDatabase* mDatabase; // appear as a PTP device bool mPtp; // group to own new files and folders int mFileGroup; // permissions for new files and directories Loading Loading @@ -87,7 +90,7 @@ private: Vector<ObjectEdit*> mObjectEditList; public: MtpServer(int fd, MtpDatabase* database, MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm); virtual ~MtpServer(); Loading Loading
media/java/android/mtp/MtpServer.java +3 −3 Original line number Diff line number Diff line Loading @@ -33,8 +33,8 @@ public class MtpServer { System.loadLibrary("media_jni"); } public MtpServer(MtpDatabase database) { native_setup(database); public MtpServer(MtpDatabase database, boolean usePtp) { native_setup(database, usePtp); } public void start() { Loading Loading @@ -69,7 +69,7 @@ public class MtpServer { native_remove_storage(storage.getStorageId()); } private native final void native_setup(MtpDatabase database); private native final void native_setup(MtpDatabase database, boolean usePtp); private native final void native_start(); private native final void native_stop(); private native final void native_send_object_added(int handle); Loading
media/jni/android_mtp_MtpServer.cpp +7 −5 Original line number Diff line number Diff line Loading @@ -68,13 +68,15 @@ static bool ExceptionCheck(void* env) class MtpThread : public Thread { private: MtpDatabase* mDatabase; bool mPtp; MtpServer* mServer; MtpStorageList mStorageList; int mFd; public: MtpThread(MtpDatabase* database) MtpThread(MtpDatabase* database, bool usePtp) : mDatabase(database), mPtp(usePtp), mServer(NULL), mFd(-1) { Loading Loading @@ -113,7 +115,7 @@ public: mFd = open("/dev/mtp_usb", O_RDWR); if (mFd >= 0) { mServer = new MtpServer(mFd, mDatabase, AID_MEDIA_RW, 0664, 0775); mServer = new MtpServer(mFd, mDatabase, mPtp, AID_MEDIA_RW, 0664, 0775); for (size_t i = 0; i < mStorageList.size(); i++) { mServer->addStorage(mStorageList[i]); } Loading Loading @@ -156,11 +158,11 @@ static sp<MtpThread> sThread; #endif // HAVE_ANDROID_OS static void android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase) android_mtp_MtpServer_setup(JNIEnv *env, jobject thiz, jobject javaDatabase, jboolean usePtp) { #ifdef HAVE_ANDROID_OS // create the thread and assign it to the smart pointer sThread = new MtpThread(getMtpDatabase(env, javaDatabase)); sThread = new MtpThread(getMtpDatabase(env, javaDatabase), usePtp); #endif } Loading Loading @@ -263,7 +265,7 @@ android_mtp_MtpServer_remove_storage(JNIEnv *env, jobject thiz, jint storageId) // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { {"native_setup", "(Landroid/mtp/MtpDatabase;)V", {"native_setup", "(Landroid/mtp/MtpDatabase;Z)V", (void *)android_mtp_MtpServer_setup}, {"native_start", "()V", (void *)android_mtp_MtpServer_start}, {"native_stop", "()V", (void *)android_mtp_MtpServer_stop}, Loading
media/mtp/MtpServer.cpp +15 −3 Original line number Diff line number Diff line Loading @@ -95,10 +95,11 @@ static const MtpEventCode kSupportedEventCodes[] = { MTP_EVENT_STORE_REMOVED, }; MtpServer::MtpServer(int fd, MtpDatabase* database, MtpServer::MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm) : mFD(fd), mDatabase(database), mPtp(ptp), mFileGroup(fileGroup), mFilePermission(filePerm), mDirectoryPermission(directoryPerm), Loading Loading @@ -426,9 +427,20 @@ MtpResponseCode MtpServer::doGetDeviceInfo() { // fill in device info mData.putUInt16(MTP_STANDARD_VERSION); mData.putUInt32(6); // MTP Vendor Extension ID if (mPtp) { mData.putUInt32(0); } else { // MTP Vendor Extension ID mData.putUInt32(6); } mData.putUInt16(MTP_STANDARD_VERSION); if (mPtp) { // no extensions string.set(""); } else { // MTP extensions string.set("microsoft.com: 1.0; android.com: 1.0;"); } mData.putString(string); // MTP Extensions mData.putUInt16(0); //Functional Mode mData.putAUInt16(kSupportedOperationCodes, Loading
media/mtp/MtpServer.h +4 −1 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ private: MtpDatabase* mDatabase; // appear as a PTP device bool mPtp; // group to own new files and folders int mFileGroup; // permissions for new files and directories Loading Loading @@ -87,7 +90,7 @@ private: Vector<ObjectEdit*> mObjectEditList; public: MtpServer(int fd, MtpDatabase* database, MtpServer(int fd, MtpDatabase* database, bool ptp, int fileGroup, int filePerm, int directoryPerm); virtual ~MtpServer(); Loading