mDatabase.getMapper().stopAddingDocuments(null);
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 1, "Device", "Storage", 1000, 2000, "")
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 1, "Storage", 1000, 2000, "")
});
mDatabase.getMapper().stopAddingDocuments("1");
assertEquals(1, getInt(cursor, COLUMN_STORAGE_ID));
assertTrue(isNull(cursor, COLUMN_OBJECT_HANDLE));
assertEquals(DocumentsContract.Document.MIME_TYPE_DIR, getString(cursor, COLUMN_MIME_TYPE));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
assertTrue(isNull(cursor, COLUMN_SUMMARY));
assertTrue(isNull(cursor, COLUMN_LAST_MODIFIED));
assertEquals(R.drawable.ic_root_mtp, getInt(cursor, COLUMN_ICON));
}
{
- final Cursor cursor = mDatabase.queryRoots(new String [] {
+ final Cursor cursor = mDatabase.queryRoots(resources, new String [] {
Root.COLUMN_ROOT_ID,
Root.COLUMN_FLAGS,
Root.COLUMN_ICON,
public void testPutStorageDocuments() throws Exception {
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 1, "Device", "Storage", 1000, 2000, ""),
- new MtpRoot(0, 2, "Device", "Storage", 2000, 4000, ""),
- new MtpRoot(0, 3, "Device", "/@#%&<>Storage", 3000, 6000,"")
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 1, "Storage", 1000, 2000, ""),
+ new MtpRoot(0, 2, "Storage", 2000, 4000, ""),
+ new MtpRoot(0, 3, "/@#%&<>Storage", 3000, 6000,"")
});
{
assertEquals(1, getInt(cursor, COLUMN_STORAGE_ID));
assertTrue(isNull(cursor, COLUMN_OBJECT_HANDLE));
assertEquals(DocumentsContract.Document.MIME_TYPE_DIR, getString(cursor, COLUMN_MIME_TYPE));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
assertTrue(isNull(cursor, COLUMN_SUMMARY));
assertTrue(isNull(cursor, COLUMN_LAST_MODIFIED));
assertEquals(R.drawable.ic_root_mtp, getInt(cursor, COLUMN_ICON));
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(3, getInt(cursor, COLUMN_DOCUMENT_ID));
- assertEquals("Device /@#%&<>Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("/@#%&<>Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
};
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 1000, 0, ""),
- new MtpRoot(0, 101, "Device", "Storage B", 1001, 0, "")
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 1000, 0, ""),
+ new MtpRoot(0, 101, "Storage B", 1001, 0, "")
});
{
cursor.moveToNext();
assertEquals(1, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(100, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(101, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
cursor.moveToNext();
assertEquals(1, getInt(cursor, COLUMN_DOCUMENT_ID));
assertTrue(isNull(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertTrue(isNull(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 200, "Device", "Storage A", 2000, 0, ""),
- new MtpRoot(0, 202, "Device", "Storage C", 2002, 0, "")
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 200, "Storage A", 2000, 0, ""),
+ new MtpRoot(0, 202, "Storage C", 2002, 0, "")
});
{
cursor.moveToNext();
assertEquals(1, getInt(cursor, COLUMN_DOCUMENT_ID));
assertTrue(isNull(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertTrue(isNull(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(4, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(202, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage C", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage C", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
cursor.moveToNext();
assertEquals(1, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(200, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage A", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(4, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(202, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage C", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage C", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
}
mDatabase.getMapper().startAddingDocuments("1");
mDatabase.getMapper().startAddingDocuments("2");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device A", "Storage", 0, 0, "")
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage", 0, 0, "")
});
- mDatabase.getMapper().putStorageDocuments("2", resources, new MtpRoot[] {
- new MtpRoot(1, 100, "Device B", "Storage", 0, 0, "")
+ mDatabase.getMapper().putStorageDocuments("2", new MtpRoot[] {
+ new MtpRoot(1, 100, "Storage", 0, 0, "")
});
{
cursor.moveToNext();
assertEquals(3, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(100, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device A Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(4, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(100, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device B Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
{
- final Cursor cursor = mDatabase.queryRoots(rootColumns);
+ final Cursor cursor = mDatabase.queryRoots(resources, rootColumns);
assertEquals(2, cursor.getCount());
cursor.moveToNext();
assertEquals(1, getInt(cursor, Root.COLUMN_ROOT_ID));
mDatabase.getMapper().startAddingDocuments("1");
mDatabase.getMapper().startAddingDocuments("2");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 200, "Device", "Storage", 2000, 0, "")
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 200, "Storage", 2000, 0, "")
});
- mDatabase.getMapper().putStorageDocuments("2", resources, new MtpRoot[] {
- new MtpRoot(1, 300, "Device", "Storage", 3000, 0, "")
+ mDatabase.getMapper().putStorageDocuments("2", new MtpRoot[] {
+ new MtpRoot(1, 300, "Storage", 3000, 0, "")
});
mDatabase.getMapper().stopAddingDocuments("1");
mDatabase.getMapper().stopAddingDocuments("2");
final Cursor cursor = mDatabase.queryRootDocuments(columns);
assertEquals(2, cursor.getCount());
cursor.moveToNext();
- assertEquals(5, getInt(cursor, COLUMN_DOCUMENT_ID));
+ assertEquals(3, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(200, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
- assertEquals(6, getInt(cursor, COLUMN_DOCUMENT_ID));
+ assertEquals(4, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(300, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
{
- final Cursor cursor = mDatabase.queryRoots(rootColumns);
+ final Cursor cursor = mDatabase.queryRoots(resources, rootColumns);
assertEquals(2, cursor.getCount());
cursor.moveToNext();
assertEquals(1, getInt(cursor, Root.COLUMN_ROOT_ID));
mDatabase.getMapper().startAddingDocuments(null);
mDatabase.getMapper().putDeviceDocument(
- new MtpDeviceRecord(0, "Device", false, new MtpRoot[0], null, null));
+ new MtpDeviceRecord(0, "Device", false, new MtpRoot[0], null, null));
mDatabase.getMapper().stopAddingDocuments(null);
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage", 0, 0, ""),
});
mDatabase.getMapper().clearMapping();
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 200, "Device", "Storage", 2000, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 200, "Storage", 2000, 0, ""),
});
mDatabase.getMapper().clearMapping();
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 300, "Device", "Storage", 3000, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 300, "Storage", 3000, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("1");
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(300, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
{
- final Cursor cursor = mDatabase.queryRoots(rootColumns);
+ final Cursor cursor = mDatabase.queryRoots(resources, rootColumns);
assertEquals(1, cursor.getCount());
cursor.moveToNext();
assertEquals(1, getInt(cursor, Root.COLUMN_ROOT_ID));
};
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage", 0, 0, ""),
});
mDatabase.getMapper().clearMapping();
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 200, "Device", "Storage", 2000, 0, ""),
- new MtpRoot(0, 201, "Device", "Storage", 2001, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 200, "Storage", 2000, 0, ""),
+ new MtpRoot(0, 201, "Storage", 2001, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("deviceDocId");
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(200, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.moveToNext();
assertEquals(3, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(201, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
}
// The client code should be able to replace existing rows with new information.
// Add one.
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("1");
// Replace it.
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage B", 1000, 1000, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage B", 1000, 1000, ""),
});
mDatabase.getMapper().stopAddingDocuments("1");
{
cursor.moveToNext();
assertEquals(2, getInt(cursor, COLUMN_DOCUMENT_ID));
assertEquals(100, getInt(cursor, COLUMN_STORAGE_ID));
- assertEquals("Device Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
+ assertEquals("Storage B", getString(cursor, COLUMN_DISPLAY_NAME));
cursor.close();
}
{
Root.COLUMN_TITLE,
Root.COLUMN_AVAILABLE_BYTES
};
- final Cursor cursor = mDatabase.queryRoots(columns);
+ final Cursor cursor = mDatabase.queryRoots(resources, columns);
assertEquals(1, cursor.getCount());
cursor.moveToNext();
assertEquals(1, getInt(cursor, Root.COLUMN_ROOT_ID));
mDatabase.getMapper().stopAddingDocuments(null);
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().clearMapping();
- final Cursor oldCursor = mDatabase.queryRoots(strings(Root.COLUMN_ROOT_ID));
+ final Cursor oldCursor = mDatabase.queryRoots(resources, strings(Root.COLUMN_ROOT_ID));
assertEquals(1, oldCursor.getCount());
// Add one.
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 101, "Device", "Storage B", 1000, 1000, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 101, "Storage B", 1000, 1000, ""),
});
// Add one more before resolving unmapped documents.
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 102, "Device", "Storage B", 1000, 1000, ""),
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 102, "Storage B", 1000, 1000, ""),
});
mDatabase.getMapper().stopAddingDocuments("1");
public void testQueryDocuments() {
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("deviceDocId");
final Cursor cursor = mDatabase.queryDocument("1", strings(Document.COLUMN_DISPLAY_NAME));
assertEquals(1, cursor.getCount());
cursor.moveToNext();
- assertEquals("Device Storage A", getString(cursor, Document.COLUMN_DISPLAY_NAME));
+ assertEquals("Storage A", getString(cursor, Document.COLUMN_DISPLAY_NAME));
cursor.close();
}
// It the device does not have storages, it shows a device root.
{
- final Cursor cursor = mDatabase.queryRoots(strings(Root.COLUMN_TITLE));
+ final Cursor cursor = mDatabase.queryRoots(resources, strings(Root.COLUMN_TITLE));
assertEquals(1, cursor.getCount());
cursor.moveToNext();
assertEquals("Device", cursor.getString(0));
}
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, "")
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, "")
});
mDatabase.getMapper().stopAddingDocuments("1");
// It the device has single storage, it shows a storage root.
{
- final Cursor cursor = mDatabase.queryRoots(strings(Root.COLUMN_TITLE));
+ final Cursor cursor = mDatabase.queryRoots(resources, strings(Root.COLUMN_TITLE));
assertEquals(1, cursor.getCount());
cursor.moveToNext();
assertEquals("Device Storage A", cursor.getString(0));
}
mDatabase.getMapper().startAddingDocuments("1");
- mDatabase.getMapper().putStorageDocuments("1", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
- new MtpRoot(0, 101, "Device", "Storage B", 0, 0, "")
+ mDatabase.getMapper().putStorageDocuments("1", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
+ new MtpRoot(0, 101, "Storage B", 0, 0, "")
});
mDatabase.getMapper().stopAddingDocuments("1");
// It the device has multiple storages, it shows a device root.
{
- final Cursor cursor = mDatabase.queryRoots(strings(Root.COLUMN_TITLE));
+ final Cursor cursor = mDatabase.queryRoots(resources, strings(Root.COLUMN_TITLE));
assertEquals(1, cursor.getCount());
cursor.moveToNext();
assertEquals("Device", cursor.getString(0));
public void testGetParentId() throws FileNotFoundException {
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("deviceDocId");
public void testDeleteDocument() {
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("deviceDocId");
public void testPutNewDocument() {
mDatabase.getMapper().startAddingDocuments("deviceDocId");
- mDatabase.getMapper().putStorageDocuments("deviceDocId", resources, new MtpRoot[] {
- new MtpRoot(0, 100, "Device", "Storage A", 0, 0, ""),
+ mDatabase.getMapper().putStorageDocuments("deviceDocId", new MtpRoot[] {
+ new MtpRoot(0, 100, "Storage A", 0, 0, ""),
});
mDatabase.getMapper().stopAddingDocuments("deviceDocId");
DocumentsContract.Root.COLUMN_TITLE,
DocumentsContract.Root.COLUMN_AVAILABLE_BYTES
};
- try (final Cursor cursor = mDatabase.queryRoots(columns)) {
+ try (final Cursor cursor = mDatabase.queryRoots(resources, columns)) {
assertEquals(1, cursor.getCount());
assertTrue(cursor.moveToNext());
assertEquals(1, cursor.getLong(0));
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
mMtpManager.addValidDevice(new MtpDeviceRecord(
0,
- "Device",
+ "Device A",
false /* unopened */,
new MtpRoot[] {
new MtpRoot(
0 /* deviceId */,
1 /* storageId */,
- "Device A" /* device model name */,
"Storage A" /* volume description */,
1024 /* free space */,
2048 /* total space */,
// Check if the following notification is the first one or not.
mMtpManager.addValidDevice(new MtpDeviceRecord(
0,
- "Device",
+ "Device A",
false /* unopened */,
new MtpRoot[] {
new MtpRoot(
0 /* deviceId */,
1 /* storageId */,
- "Device A" /* device model name */,
"Storage A" /* volume description */,
1024 /* free space */,
2048 /* total space */,
new MtpRoot(
0 /* deviceId */,
1 /* storageId */,
- "Device A" /* device model name */,
"Storage A" /* volume description */,
1024 /* free space */,
2048 /* total space */,
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
mMtpManager.addValidDevice(new MtpDeviceRecord(
0,
- "Device",
+ "Device A",
false /* unopened */,
new MtpRoot[] {
new MtpRoot(
0 /* deviceId */,
1 /* storageId */,
- "Device A" /* device model name */,
"Storage A" /* volume description */,
1024 /* free space */,
2048 /* total space */,
null));
mMtpManager.addValidDevice(new MtpDeviceRecord(
1,
- "Device",
+ "Device B",
false /* unopened */,
new MtpRoot[] {
new MtpRoot(
1 /* deviceId */,
1 /* storageId */,
- "Device B" /* device model name */,
"Storage B" /* volume description */,
2048 /* free space */,
4096 /* total space */,
new MtpRoot(
1 /* deviceId */,
1 /* storageId */,
- "Device B" /* device model name */,
"Storage B" /* volume description */,
2048 /* free space */,
4096 /* total space */,
public void testQueryDocument() throws IOException, InterruptedException, TimeoutException {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
- setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 1000, 1000, "") });
+ setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Storage", 1000, 1000, "") });
setupDocuments(
0,
0,
public void testQueryDocument_directory()
throws IOException, InterruptedException, TimeoutException {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
- setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 1000, 1000, "") });
+ setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Storage", 1000, 1000, "") });
setupDocuments(
0,
0,
new MtpRoot(
0 /* deviceId */,
1 /* storageId */,
- "Device A" /* device model name */,
"Storage A" /* volume description */,
1024 /* free space */,
4096 /* total space */,
cursor.moveToNext();
assertEquals("2", cursor.getString(0));
assertEquals(DocumentsContract.Document.MIME_TYPE_DIR, cursor.getString(1));
- assertEquals("Device A Storage A", cursor.getString(2));
+ assertEquals("Storage A", cursor.getString(2));
assertTrue(cursor.isNull(3));
assertEquals(0, cursor.getInt(4));
assertEquals(3072, cursor.getInt(5));
public void testQueryChildDocuments() throws Exception {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
- setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 1000, 1000, "") });
+ setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Storage", 1000, 1000, "") });
setupDocuments(
0,
0,
public void testQueryChildDocuments_documentError() throws Exception {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
- setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Device", "Storage", 1000, 1000, "") });
+ setupRoots(0, new MtpRoot[] { new MtpRoot(0, 0, "Storage", 1000, 1000, "") });
mMtpManager.setObjectHandles(0, 0, -1, new int[] { 1 });
try {
mProvider.queryChildDocuments("1", null, null);
public void testDeleteDocument() throws IOException, InterruptedException, TimeoutException {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
setupRoots(0, new MtpRoot[] {
- new MtpRoot(0, 0, "Device", "Storage", 0, 0, "")
+ new MtpRoot(0, 0, "Storage", 0, 0, "")
});
setupDocuments(0, 0, MtpManager.OBJECT_HANDLE_ROOT_CHILDREN, "1", new MtpObjectInfo[] {
new MtpObjectInfo.Builder()
throws IOException, InterruptedException, TimeoutException {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
setupRoots(0, new MtpRoot[] {
- new MtpRoot(0, 0, "Device", "Storage", 0, 0, "")
+ new MtpRoot(0, 0, "Storage", 0, 0, "")
});
setupDocuments(0, 0, MtpManager.OBJECT_HANDLE_ROOT_CHILDREN, "1", new MtpObjectInfo[] {
new MtpObjectInfo.Builder()
public void testOpenDocument() throws Exception {
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
setupRoots(0, new MtpRoot[] {
- new MtpRoot(0, 0, "Device", "Storage", 0, 0, "")
+ new MtpRoot(0, 0, "Storage", 0, 0, "")
});
final byte[] bytes = "Hello world".getBytes();
setupDocuments(0, 0, MtpManager.OBJECT_HANDLE_ROOT_CHILDREN, "1", new MtpObjectInfo[] {
};
setupProvider(MtpDatabaseConstants.FLAG_DATABASE_IN_MEMORY);
setupRoots(0, new MtpRoot[] {
- new MtpRoot(0, 0, "Device", "Storage", 0, 0, "")
+ new MtpRoot(0, 0, "Storage", 0, 0, "")
});
final byte[] bytes = "Hello world".getBytes();
setupDocuments(0, 0, MtpManager.OBJECT_HANDLE_ROOT_CHILDREN, "1", new MtpObjectInfo[] {