use of android.mtp.MtpStorageInfo in project platform_frameworks_base by android.
the class MtpManager method getRoots.
private MtpRoot[] getRoots(int deviceId) throws IOException {
final MtpDevice device = getDevice(deviceId);
synchronized (device) {
final int[] storageIds = ensureNotNull(device.getStorageIds(), "Failed to obtain storage IDs.");
final ArrayList<MtpRoot> roots = new ArrayList<>();
for (int i = 0; i < storageIds.length; i++) {
final MtpStorageInfo info = device.getStorageInfo(storageIds[i]);
if (info == null) {
continue;
}
roots.add(new MtpRoot(device.getDeviceId(), info));
}
return roots.toArray(new MtpRoot[roots.size()]);
}
}
use of android.mtp.MtpStorageInfo in project android_frameworks_base by ParanoidAndroid.
the class MtpClient method getStorageList.
/**
* Retrieves a list of all {@link android.mtp.MtpStorageInfo}
* for the MTP or PTP device with the given USB device name
*
* @param deviceName the name of the USB device
* @return the list of MtpStorageInfo
*/
public List<MtpStorageInfo> getStorageList(String deviceName) {
MtpDevice device = getDevice(deviceName);
if (device == null) {
return null;
}
int[] storageIds = device.getStorageIds();
if (storageIds == null) {
return null;
}
int length = storageIds.length;
ArrayList<MtpStorageInfo> storageList = new ArrayList<MtpStorageInfo>(length);
for (int i = 0; i < length; i++) {
MtpStorageInfo info = device.getStorageInfo(storageIds[i]);
if (info == null) {
Log.w(TAG, "getStorageInfo failed");
} else {
storageList.add(info);
}
}
return storageList;
}
use of android.mtp.MtpStorageInfo in project android_frameworks_base by ResurrectionRemix.
the class MtpClient method getStorageList.
/**
* Retrieves a list of all {@link android.mtp.MtpStorageInfo}
* for the MTP or PTP device with the given USB device name
*
* @param deviceName the name of the USB device
* @return the list of MtpStorageInfo
*/
public List<MtpStorageInfo> getStorageList(String deviceName) {
MtpDevice device = getDevice(deviceName);
if (device == null) {
return null;
}
int[] storageIds = device.getStorageIds();
if (storageIds == null) {
return null;
}
int length = storageIds.length;
ArrayList<MtpStorageInfo> storageList = new ArrayList<MtpStorageInfo>(length);
for (int i = 0; i < length; i++) {
MtpStorageInfo info = device.getStorageInfo(storageIds[i]);
if (info == null) {
Log.w(TAG, "getStorageInfo failed");
} else {
storageList.add(info);
}
}
return storageList;
}
use of android.mtp.MtpStorageInfo in project android_frameworks_base by ResurrectionRemix.
the class MtpManager method getRoots.
private MtpRoot[] getRoots(int deviceId) throws IOException {
final MtpDevice device = getDevice(deviceId);
synchronized (device) {
final int[] storageIds = ensureNotNull(device.getStorageIds(), "Failed to obtain storage IDs.");
final ArrayList<MtpRoot> roots = new ArrayList<>();
for (int i = 0; i < storageIds.length; i++) {
final MtpStorageInfo info = device.getStorageInfo(storageIds[i]);
if (info == null) {
continue;
}
roots.add(new MtpRoot(device.getDeviceId(), info));
}
return roots.toArray(new MtpRoot[roots.size()]);
}
}
use of android.mtp.MtpStorageInfo in project android_frameworks_base by DirtyUnicorns.
the class MtpClient method getStorageList.
/**
* Retrieves a list of all {@link android.mtp.MtpStorageInfo}
* for the MTP or PTP device with the given USB device name
*
* @param deviceName the name of the USB device
* @return the list of MtpStorageInfo
*/
public List<MtpStorageInfo> getStorageList(String deviceName) {
MtpDevice device = getDevice(deviceName);
if (device == null) {
return null;
}
int[] storageIds = device.getStorageIds();
if (storageIds == null) {
return null;
}
int length = storageIds.length;
ArrayList<MtpStorageInfo> storageList = new ArrayList<MtpStorageInfo>(length);
for (int i = 0; i < length; i++) {
MtpStorageInfo info = device.getStorageInfo(storageIds[i]);
if (info == null) {
Log.w(TAG, "getStorageInfo failed");
} else {
storageList.add(info);
}
}
return storageList;
}
Aggregations