static final int STATE_ERROR = 2;
final MtpDatabase mDatabase;
- int[] mOperationsSupported;
+ final int[] mOperationsSupported;
final Identifier mIdentifier;
final int[] mObjectHandles;
Date mLastNotified;
LoaderTask(MtpDatabase database, int[] operationsSupported, Identifier identifier,
int[] objectHandles) {
+ Preconditions.checkNotNull(operationsSupported);
+ Preconditions.checkNotNull(objectHandles);
mDatabase = database;
mOperationsSupported = operationsSupported;
mIdentifier = identifier;
throws IOException {
final MtpDevice device = getDevice(deviceId);
synchronized (device) {
- return device.getObjectHandles(storageId, 0 /* all format */, parentObjectHandle);
+ final int[] handles =
+ device.getObjectHandles(storageId, 0 /* all format */, parentObjectHandle);
+ if (handles == null) {
+ throw new IOException("Failed to fetch object handles.");
+ }
+ return handles;
}
}
0,
"Device A",
"device key",
- true /* unopened */,
+ true /* opened */,
new MtpRoot[] {
new MtpRoot(
0 /* deviceId */,
2048 /* total space */,
"" /* no volume identifier */)
},
- null,
+ OPERATIONS_SUPPORTED,
null));
final String[] names = strings("Directory A", "Directory B", "Directory C");
mDevices.put(
deviceId,
new MtpDeviceRecord(device.deviceId, device.name, device.deviceKey, false,
- device.roots, null, null));
+ device.roots, device.operationsSupported, device.eventsSupported));
}
@Override