use of com.android.ddmlib.FileListingService in project android by JetBrains.
the class AndroidDataSourcePropertiesDialog method loadDatabases.
private void loadDatabases(@NotNull IDevice device) {
myDatabaseMap.clear();
final FileListingService service = device.getFileListingService();
if (service == null)
return;
final Set<String> packages = new HashSet<String>();
for (AndroidFacet facet : ProjectFacetManager.getInstance(myProject).getFacets(AndroidFacet.ID)) {
final Manifest manifest = facet.getManifest();
if (manifest != null) {
final String aPackage = manifest.getPackage().getStringValue();
if (aPackage != null && aPackage.length() > 0) {
packages.add(aPackage);
}
}
}
if (packages.isEmpty())
return;
final long startTime = System.currentTimeMillis();
boolean tooLong = false;
for (String aPackage : packages) {
myDatabaseMap.put(aPackage, tooLong ? Collections.<String>emptyList() : loadDatabases(device, aPackage));
if (System.currentTimeMillis() - startTime > 4000) {
tooLong = true;
}
}
}
Aggregations