Loading media/java/android/mtp/MtpDatabase.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -423,6 +423,12 @@ public class MtpDatabase implements AutoCloseable { } } } } private void doScanDirectory(String path) { String[] scanPath; scanPath = new String[] { path }; mMediaScanner.scanDirectories(scanPath); } private Cursor createObjectQuery(int storageID, int format, int parent) throws RemoteException { private Cursor createObjectQuery(int storageID, int format, int parent) throws RemoteException { String where; String where; String[] whereArgs; String[] whereArgs; Loading media/jni/android_mtp_MtpDatabase.cpp +18 −0 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ using namespace android; static jmethodID method_beginSendObject; static jmethodID method_beginSendObject; static jmethodID method_endSendObject; static jmethodID method_endSendObject; static jmethodID method_doScanDirectory; static jmethodID method_getObjectList; static jmethodID method_getObjectList; static jmethodID method_getNumObjects; static jmethodID method_getNumObjects; static jmethodID method_getSupportedPlaybackFormats; static jmethodID method_getSupportedPlaybackFormats; Loading Loading @@ -119,6 +120,8 @@ public: MtpObjectFormat format, MtpObjectFormat format, bool succeeded); bool succeeded); virtual void doScanDirectory(const char* path); virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, MtpObjectFormat format, MtpObjectFormat format, MtpObjectHandle parent); MtpObjectHandle parent); Loading Loading @@ -265,6 +268,16 @@ void MyMtpDatabase::endSendObject(const char* path, MtpObjectHandle handle, checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } void MyMtpDatabase::doScanDirectory(const char* path) { JNIEnv* env = AndroidRuntime::getJNIEnv(); jstring pathStr = env->NewStringUTF(path); env->CallVoidMethod(mDatabase, method_doScanDirectory, pathStr); if (pathStr) env->DeleteLocalRef(pathStr); checkAndClearExceptionFromCallback(env, __FUNCTION__); } MtpObjectHandleList* MyMtpDatabase::getObjectList(MtpStorageID storageID, MtpObjectHandleList* MyMtpDatabase::getObjectList(MtpStorageID storageID, MtpObjectFormat format, MtpObjectFormat format, MtpObjectHandle parent) { MtpObjectHandle parent) { Loading Loading @@ -1311,6 +1324,11 @@ int register_android_mtp_MtpDatabase(JNIEnv *env) ALOGE("Can't find endSendObject"); ALOGE("Can't find endSendObject"); return -1; return -1; } } method_doScanDirectory = env->GetMethodID(clazz, "doScanDirectory", "(Ljava/lang/String;)V"); if (method_doScanDirectory == NULL) { ALOGE("Can't find doScanDirectory"); return -1; } method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I"); method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I"); if (method_getObjectList == NULL) { if (method_getObjectList == NULL) { ALOGE("Can't find getObjectList"); ALOGE("Can't find getObjectList"); Loading Loading
media/java/android/mtp/MtpDatabase.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -423,6 +423,12 @@ public class MtpDatabase implements AutoCloseable { } } } } private void doScanDirectory(String path) { String[] scanPath; scanPath = new String[] { path }; mMediaScanner.scanDirectories(scanPath); } private Cursor createObjectQuery(int storageID, int format, int parent) throws RemoteException { private Cursor createObjectQuery(int storageID, int format, int parent) throws RemoteException { String where; String where; String[] whereArgs; String[] whereArgs; Loading
media/jni/android_mtp_MtpDatabase.cpp +18 −0 Original line number Original line Diff line number Diff line Loading @@ -55,6 +55,7 @@ using namespace android; static jmethodID method_beginSendObject; static jmethodID method_beginSendObject; static jmethodID method_endSendObject; static jmethodID method_endSendObject; static jmethodID method_doScanDirectory; static jmethodID method_getObjectList; static jmethodID method_getObjectList; static jmethodID method_getNumObjects; static jmethodID method_getNumObjects; static jmethodID method_getSupportedPlaybackFormats; static jmethodID method_getSupportedPlaybackFormats; Loading Loading @@ -119,6 +120,8 @@ public: MtpObjectFormat format, MtpObjectFormat format, bool succeeded); bool succeeded); virtual void doScanDirectory(const char* path); virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, virtual MtpObjectHandleList* getObjectList(MtpStorageID storageID, MtpObjectFormat format, MtpObjectFormat format, MtpObjectHandle parent); MtpObjectHandle parent); Loading Loading @@ -265,6 +268,16 @@ void MyMtpDatabase::endSendObject(const char* path, MtpObjectHandle handle, checkAndClearExceptionFromCallback(env, __FUNCTION__); checkAndClearExceptionFromCallback(env, __FUNCTION__); } } void MyMtpDatabase::doScanDirectory(const char* path) { JNIEnv* env = AndroidRuntime::getJNIEnv(); jstring pathStr = env->NewStringUTF(path); env->CallVoidMethod(mDatabase, method_doScanDirectory, pathStr); if (pathStr) env->DeleteLocalRef(pathStr); checkAndClearExceptionFromCallback(env, __FUNCTION__); } MtpObjectHandleList* MyMtpDatabase::getObjectList(MtpStorageID storageID, MtpObjectHandleList* MyMtpDatabase::getObjectList(MtpStorageID storageID, MtpObjectFormat format, MtpObjectFormat format, MtpObjectHandle parent) { MtpObjectHandle parent) { Loading Loading @@ -1311,6 +1324,11 @@ int register_android_mtp_MtpDatabase(JNIEnv *env) ALOGE("Can't find endSendObject"); ALOGE("Can't find endSendObject"); return -1; return -1; } } method_doScanDirectory = env->GetMethodID(clazz, "doScanDirectory", "(Ljava/lang/String;)V"); if (method_doScanDirectory == NULL) { ALOGE("Can't find doScanDirectory"); return -1; } method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I"); method_getObjectList = env->GetMethodID(clazz, "getObjectList", "(III)[I"); if (method_getObjectList == NULL) { if (method_getObjectList == NULL) { ALOGE("Can't find getObjectList"); ALOGE("Can't find getObjectList"); Loading