use of com.android.ddmlib.FileListingService.FileEntry in project VideoOptimzer by attdevsupport.
the class AdbServiceImpl method locate.
/**
* traverse Android filesystem to locate file/folder
*
* @param root of current directory
* @param path to follow
* @return FileEntry of target
*/
@Override
public FileEntry locate(IDevice device, FileEntry rootPath, String path) {
FileListingService fileService = device.getFileListingService();
FileEntry root = rootPath;
if (root == null) {
root = fileService.getRoot();
}
// root gets populated with children
fileService.getChildren(root, false, null);
if (path == null) {
return root;
}
String[] pathNodes = path.split("/");
FileEntry node = root;
FileEntry nnode = root;
for (String pathNode : pathNodes) {
if (!"".equals(pathNode)) {
nnode = node.findChild(pathNode);
if (nnode == null) {
return null;
}
// nnode gets populated with children
fileService.getChildren(nnode, false, null);
// traverse to next node
node = nnode;
}
}
return node;
}
use of com.android.ddmlib.FileListingService.FileEntry in project VideoOptimzer by attdevsupport.
the class ScreenRecorderImpl method pullVideos.
/**
* @throws IOException
* @throws AdbCommandRejectedException
* @throws TimeoutException
*/
@Override
public boolean pullVideos() throws Exception {
SyncService service = null;
FileEntry files = adbservice.locate(device, null, remoteVideoPath);
if (files == null) {
throw new Exception("Failed to locate files :" + remoteVideoPath);
}
filemanager.directoryDeleteInnerFiles(localVidsFolder);
service = device.getSyncService();
service.pull(files.getCachedChildren(), localVidsFolder, SyncService.getNullProgressMonitor());
if (adbservice.pullFile(service, remoteVideoPath, "video-time", localVidsFolder)) {
setState(State.PullComplete);
}
return true;
}
Aggregations