Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76725902 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'am-2f7a5b3d426742748bd60ca695e3c03a'

* changes:
  Merge changes I37c8daa6,I5a05b65d,If56347fd am: 9309f1cb am: b4248148 am: f9e5488b am: 6edb9856
  Preload2: Add isSingleThreaded am: 3bf65c91 am: 57c14c8e am: 80ae2ed2 am: 190dbbd0
  Preload2: Fix action inheritance am: 1c809a3d am: 24cd3418 am: 2b34ac2b am: 26c94b74
  Preload2: Abstract out UI am: 5cb89983 am: 826ec71e am: eab0eadb am: af5b2c30
parents b6504180 a89cdda2
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ import com.android.preload.actions.ShowDataAction;
import com.android.preload.classdataretrieval.ClassDataRetriever;
import com.android.preload.classdataretrieval.hprof.Hprof;
import com.android.preload.classdataretrieval.jdwp.JDWPClassDataRetriever;
import com.android.preload.ui.UI;
import com.android.preload.ui.IUI;
import com.android.preload.ui.SwingUI;

import java.util.ArrayList;
import java.util.Collection;
@@ -66,7 +67,7 @@ public class Main {
    private DumpTableModel dataTableModel;
    private DefaultListModel<Client> clientListModel;

    private UI ui;
    private IUI ui;

    // Actions that need to be updated once a device is selected.
    private Collection<DeviceSpecific> deviceSpecificActions;
@@ -89,13 +90,15 @@ public class Main {
     * @param args
     */
    public static void main(String[] args) {
        Main m = new Main();
        Main m = new Main(new SwingUI());
        top = m;

        m.startUp();
    }

    public Main() {
    public Main(IUI ui) {
        this.ui = ui;

        clientListModel = new DefaultListModel<Client>();
        dataTableModel = new DumpTableModel();

@@ -124,11 +127,10 @@ public class Main {
            }
        }

        ui = new UI(clientListModel, dataTableModel, actions);
        ui.setVisible(true);
        ui.prepare(clientListModel, dataTableModel, actions);
    }

    public static UI getUI() {
    public static IUI getUI() {
        return top.ui;
    }

@@ -176,6 +178,7 @@ public class Main {
        new ReloadListAction(clientUtils, getDevice(), clientListModel).run();

        getUI().hideWaitDialog();
        getUI().ready();
    }

    private void initDevice() {
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.preload.actions;

import com.android.preload.Main;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
@@ -28,7 +29,11 @@ public abstract class AbstractThreadedAction extends AbstractAction implements R

    @Override
    public void actionPerformed(ActionEvent e) {
        if (Main.getUI().isSingleThreaded()) {
            run();
        } else {
            new Thread(this).start();
        }
    }

}
+4 −7
Original line number Diff line number Diff line
@@ -32,14 +32,13 @@ import java.util.TreeSet;
import java.util.regex.Pattern;

import javax.swing.AbstractAction;
import javax.swing.JFileChooser;

/**
 * Compute an intersection of classes from the given data. A class is in the intersection if it
 * appears in at least the number of threshold given packages. An optional blacklist can be
 * used to filter classes from the intersection.
 */
public class ComputeThresholdAction extends AbstractAction implements Runnable {
public class ComputeThresholdAction extends AbstractThreadedAction {
    protected int threshold;
    private Pattern blacklist;
    private DumpTableModel dataTableModel;
@@ -72,7 +71,7 @@ public class ComputeThresholdAction extends AbstractAction implements Runnable {
            return;
        }

        new Thread(this).start();
        super.actionPerformed(e);
    }

    @Override
@@ -92,10 +91,8 @@ public class ComputeThresholdAction extends AbstractAction implements Runnable {
        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();
            File f = Main.getUI().showSaveDialog();
            if (f != null) {
                saveSet(result, f);
            }
        }
+2 −5
Original line number Diff line number Diff line
@@ -19,14 +19,11 @@ package com.android.preload.actions;
import com.android.preload.DumpDataIO;
import com.android.preload.DumpTableModel;
import com.android.preload.Main;

import java.awt.event.ActionEvent;
import java.io.File;
import java.io.PrintWriter;

import javax.swing.AbstractAction;

public class ExportAction extends AbstractAction implements Runnable {
public class ExportAction extends AbstractThreadedAction {
    private File lastSaveFile;
    private DumpTableModel dataTableModel;

@@ -39,7 +36,7 @@ public class ExportAction extends AbstractAction implements Runnable {
    public void actionPerformed(ActionEvent e) {
        lastSaveFile = Main.getUI().showSaveDialog();
        if (lastSaveFile != null) {
            new Thread(this).start();
            super.actionPerformed(e);
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ import java.util.Collection;

import javax.swing.AbstractAction;

public class ImportAction extends AbstractAction implements Runnable {
public class ImportAction extends AbstractThreadedAction {
    private File[] lastOpenFiles;
    private DumpTableModel dataTableModel;

@@ -40,7 +40,7 @@ public class ImportAction extends AbstractAction implements Runnable {
    public void actionPerformed(ActionEvent e) {
        lastOpenFiles = Main.getUI().showOpenDialog(true);
        if (lastOpenFiles != null) {
            new Thread(this).start();
            super.actionPerformed(e);
        }
    }

Loading