Loading media/java/android/media/MtpDatabase.java +20 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class MtpDatabase { Files.FileColumns.DATE_MODIFIED, // 5 }; private static final String ID_WHERE = Files.FileColumns._ID + "=?"; private static final String PATH_WHERE = Files.FileColumns.DATA + "=?"; private static final String PARENT_WHERE = Files.FileColumns.PARENT + "=?"; private static final String PARENT_FORMAT_WHERE = PARENT_WHERE + " AND " + Files.FileColumns.FORMAT + "=?"; Loading Loading @@ -154,6 +155,25 @@ public class MtpDatabase { private int beginSendObject(String path, int format, int parent, int storage, long size, long modified) { // first make sure the object does not exist if (path != null) { Cursor c = null; try { c = mMediaProvider.query(mObjectsUri, ID_PROJECTION, PATH_WHERE, new String[] { path }, null); if (c != null && c.getCount() > 0) { Log.w(TAG, "file already exists in beginSendObject: " + path); return -1; } } catch (RemoteException e) { Log.e(TAG, "RemoteException in beginSendObject", e); } finally { if (c != null) { c.close(); } } } mDatabaseModified = true; ContentValues values = new ContentValues(); values.put(Files.FileColumns.DATA, path); Loading media/mtp/MtpServer.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -683,10 +683,6 @@ MtpResponseCode MtpServer::doSendObjectInfo() { path += "/"; path += (const char *)name; // file should not already exist if (access(path, R_OK) == 0) return MTP_RESPONSE_GENERAL_ERROR; // check space first if (mSendObjectFileSize > storage->getFreeSpace()) return MTP_RESPONSE_STORAGE_FULL; Loading Loading
media/java/android/media/MtpDatabase.java +20 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,7 @@ public class MtpDatabase { Files.FileColumns.DATE_MODIFIED, // 5 }; private static final String ID_WHERE = Files.FileColumns._ID + "=?"; private static final String PATH_WHERE = Files.FileColumns.DATA + "=?"; private static final String PARENT_WHERE = Files.FileColumns.PARENT + "=?"; private static final String PARENT_FORMAT_WHERE = PARENT_WHERE + " AND " + Files.FileColumns.FORMAT + "=?"; Loading Loading @@ -154,6 +155,25 @@ public class MtpDatabase { private int beginSendObject(String path, int format, int parent, int storage, long size, long modified) { // first make sure the object does not exist if (path != null) { Cursor c = null; try { c = mMediaProvider.query(mObjectsUri, ID_PROJECTION, PATH_WHERE, new String[] { path }, null); if (c != null && c.getCount() > 0) { Log.w(TAG, "file already exists in beginSendObject: " + path); return -1; } } catch (RemoteException e) { Log.e(TAG, "RemoteException in beginSendObject", e); } finally { if (c != null) { c.close(); } } } mDatabaseModified = true; ContentValues values = new ContentValues(); values.put(Files.FileColumns.DATA, path); Loading
media/mtp/MtpServer.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -683,10 +683,6 @@ MtpResponseCode MtpServer::doSendObjectInfo() { path += "/"; path += (const char *)name; // file should not already exist if (access(path, R_OK) == 0) return MTP_RESPONSE_GENERAL_ERROR; // check space first if (mSendObjectFileSize > storage->getFreeSpace()) return MTP_RESPONSE_STORAGE_FULL; Loading