use of com.wuntee.oter.view.widgets.runnable.FsListToTreeRunnable in project otertool by wuntee.
the class PackageManagerController method loadPackageDetails.
public void loadPackageDetails(TableItem[] selection) {
if (selection.length > 1) {
return;
}
TableItem item = selection[0];
final PackageBean bean = (PackageBean) item.getData(PackageBean.class.getName());
logger.info("Loading package details for: " + bean.getApk());
gui.setStatus("Loading package details for: " + bean.getApk());
// Load file details
Thread details = new Thread(new Runnable() {
public void run() {
// Pull file
File apk = null;
try {
apk = AdbWorkshop.pullFile(bean.getApk());
} catch (Exception e) {
logger.error("Could not pull apk from device: ", e);
GuiWorkshop.messageErrorThreaded(gui, "Could not pull apk from device: " + e.getMessage());
}
if (apk != null) {
// Manifest
try {
final AndroidManifestObject root = AndroidManifestWorkshop.getAndroidManifestObjectsForApk(apk);
gui.runRunnableAsync(new Runnable() {
public void run() {
// Load data in gui
gui.getPackageManagerAndroidManifestTab().loadAndroidManifestObjects(root);
}
});
} catch (Exception e) {
logger.error("Could not parse the AndroidManifest.xml file: ", e);
GuiWorkshop.messageErrorThreaded(gui, "Could not parse the AndroidManifest.xml file: " + e.getMessage());
}
// AAPT
List<String> details = null;
try {
details = PackageManagerWorkshop.getDetailedPackageInfo(apk);
} catch (Exception e) {
logger.error("Could not get detailed package information: ", e);
GuiWorkshop.messageErrorThreaded(gui, "Could not get detailed package information: " + e.getMessage());
}
final StringBuffer sb = new StringBuffer();
if (details != null) {
for (String det : details) {
sb.append(det).append("\n");
}
}
gui.runRunnableAsync(new Runnable() {
public void run() {
// Load data in gui
gui.getPackageManagerStyledText().setText(sb.toString());
}
});
}
// Files
List<FsNode> files = null;
try {
files = FsWorkshop.getDirectoryRecursive("/data/data/" + bean.getClazz() + "/");
} catch (Exception e) {
logger.error("Could not get file listing: ", e);
GuiWorkshop.messageErrorThreaded(gui, "Could not get file listing: " + e.getMessage());
}
if (files != null) {
gui.runRunnableAsync(new FsListToTreeRunnable(files, gui.getPackageManagerFilesTree()));
}
gui.clearStatus();
}
});
details.start();
}
Aggregations