Search in sources :

Example 16 with DumpData

use of com.android.preload.DumpData in project android_frameworks_base by DirtyUnicorns.

the class ScanPackageAction method work.

private void work(Client c) {
    String pkg = c.getClientData().getClientDescription();
    Main.getUI().showWaitDialog();
    Main.getUI().updateWaitDialog("Retrieving heap data for " + pkg);
    try {
        Map<String, String> data = Main.findAndGetClassData(device, pkg);
        DumpData dumpData = new DumpData(pkg, data, new Date());
        dataTableModel.addData(dumpData);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : DumpData(com.android.preload.DumpData) Date(java.util.Date)

Example 17 with DumpData

use of com.android.preload.DumpData in project android_frameworks_base by DirtyUnicorns.

the class ShowDataAction method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    // TODO(agampe): Auto-generated method stub
    int selRow = Main.getUI().getSelectedDataTableRow();
    if (selRow != -1) {
        DumpData data = dataTableModel.getData().get(selRow);
        Map<String, Set<String>> inv = data.invertData();
        StringBuilder builder = new StringBuilder();
        // First bootclasspath.
        add(builder, "Boot classpath:", inv.get(null));
        // Now everything else.
        for (String k : inv.keySet()) {
            if (k != null) {
                builder.append("==================\n\n");
                add(builder, k, inv.get(k));
            }
        }
        JFrame newFrame = new JFrame(data.getPackageName() + " " + data.getDate());
        newFrame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
        newFrame.getContentPane().add(new JScrollPane(new JTextArea(builder.toString())), BorderLayout.CENTER);
        newFrame.setSize(800, 600);
        newFrame.setLocationRelativeTo(null);
        newFrame.setVisible(true);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) Set(java.util.Set) JTextArea(javax.swing.JTextArea) JFrame(javax.swing.JFrame) DumpData(com.android.preload.DumpData)

Example 18 with DumpData

use of com.android.preload.DumpData in project android_frameworks_base by ResurrectionRemix.

the class ComputeThresholdAction method run.

@Override
public void run() {
    Main.getUI().showWaitDialog();
    Map<String, Set<String>> uses = new HashMap<String, Set<String>>();
    for (DumpData d : dataTableModel.getData()) {
        Main.getUI().updateWaitDialog("Merging " + d.getPackageName());
        updateClassUse(d.getPackageName(), uses, getBootClassPathClasses(d.getDumpData()));
    }
    Main.getUI().updateWaitDialog("Computing thresholded set");
    Set<String> result = fromThreshold(uses, blacklist, threshold);
    Main.getUI().hideWaitDialog();
    boolean ret = Main.getUI().showConfirmDialog("Computed a set with " + result.size() + " classes, would you like to save to disk?", "Save?");
    if (ret) {
        JFileChooser jfc = new JFileChooser();
        int ret2 = jfc.showSaveDialog(Main.getUI());
        if (ret2 == JFileChooser.APPROVE_OPTION) {
            File f = jfc.getSelectedFile();
            saveSet(result, f);
        }
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) JFileChooser(javax.swing.JFileChooser) HashMap(java.util.HashMap) DumpData(com.android.preload.DumpData) File(java.io.File)

Example 19 with DumpData

use of com.android.preload.DumpData in project android_frameworks_base by crdroidandroid.

the class ScanAllPackagesAction method run.

@Override
public void run() {
    Main.getUI().showWaitDialog();
    try {
        Client[] clients = clientUtils.findAllClients(device);
        for (Client c : clients) {
            String pkg = c.getClientData().getClientDescription();
            Main.getUI().showWaitDialog();
            Main.getUI().updateWaitDialog("Retrieving heap data for " + pkg);
            try {
                Map<String, String> data = Main.getClassDataRetriever().getClassData(c);
                DumpData dumpData = new DumpData(pkg, data, new Date());
                dataTableModel.addData(dumpData);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    } finally {
        Main.getUI().hideWaitDialog();
    }
}
Also used : Client(com.android.ddmlib.Client) DumpData(com.android.preload.DumpData) Date(java.util.Date)

Example 20 with DumpData

use of com.android.preload.DumpData in project android_frameworks_base by crdroidandroid.

the class ComputeThresholdAction method run.

@Override
public void run() {
    Main.getUI().showWaitDialog();
    Map<String, Set<String>> uses = new HashMap<String, Set<String>>();
    for (DumpData d : dataTableModel.getData()) {
        Main.getUI().updateWaitDialog("Merging " + d.getPackageName());
        updateClassUse(d.getPackageName(), uses, getBootClassPathClasses(d.getDumpData()));
    }
    Main.getUI().updateWaitDialog("Computing thresholded set");
    Set<String> result = fromThreshold(uses, blacklist, threshold);
    Main.getUI().hideWaitDialog();
    boolean ret = Main.getUI().showConfirmDialog("Computed a set with " + result.size() + " classes, would you like to save to disk?", "Save?");
    if (ret) {
        JFileChooser jfc = new JFileChooser();
        int ret2 = jfc.showSaveDialog(Main.getUI());
        if (ret2 == JFileChooser.APPROVE_OPTION) {
            File f = jfc.getSelectedFile();
            saveSet(result, f);
        }
    }
}
Also used : Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) JFileChooser(javax.swing.JFileChooser) HashMap(java.util.HashMap) DumpData(com.android.preload.DumpData) File(java.io.File)

Aggregations

DumpData (com.android.preload.DumpData)20 Date (java.util.Date)10 Set (java.util.Set)10 Client (com.android.ddmlib.Client)5 File (java.io.File)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 TreeSet (java.util.TreeSet)5 JFrame (javax.swing.JFrame)5 JScrollPane (javax.swing.JScrollPane)5 JTextArea (javax.swing.JTextArea)5 JFileChooser (javax.swing.JFileChooser)4