aboutsummaryrefslogtreecommitdiffstats
path: root/hierarchyviewer/src
diff options
context:
space:
mode:
Diffstat (limited to 'hierarchyviewer/src')
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/device/DeviceBridge.java32
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/scene/CaptureLoader.java10
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/scene/ProfilesLoader.java4
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewHierarchyLoader.java26
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewManager.java8
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/scene/WindowsLoader.java4
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/ScreenViewer.java12
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/ui/Workspace.java48
8 files changed, 72 insertions, 72 deletions
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/device/DeviceBridge.java b/hierarchyviewer/src/com/android/hierarchyviewer/device/DeviceBridge.java
index 850a238..0f60be6 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/device/DeviceBridge.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/device/DeviceBridge.java
@@ -17,7 +17,7 @@
package com.android.hierarchyviewer.device;
import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.Log;
import com.android.ddmlib.MultiLineReceiver;
@@ -29,8 +29,8 @@ import java.util.regex.Pattern;
public class DeviceBridge {
private static AndroidDebugBridge bridge;
-
- private static final HashMap<Device, Integer> devicePortMap = new HashMap<Device, Integer>();
+
+ private static final HashMap<IDevice, Integer> devicePortMap = new HashMap<IDevice, Integer>();
private static int nextLocalPort = Configuration.DEFAULT_SERVER_PORT;
public static void initDebugBridge() {
@@ -57,11 +57,11 @@ public class DeviceBridge {
AndroidDebugBridge.removeDeviceChangeListener(listener);
}
- public static Device[] getDevices() {
+ public static IDevice[] getDevices() {
return bridge.getDevices();
}
- public static boolean isViewServerRunning(Device device) {
+ public static boolean isViewServerRunning(IDevice device) {
initDebugBridge();
final boolean[] result = new boolean[1];
try {
@@ -75,11 +75,11 @@ public class DeviceBridge {
return result[0];
}
- public static boolean startViewServer(Device device) {
+ public static boolean startViewServer(IDevice device) {
return startViewServer(device, Configuration.DEFAULT_SERVER_PORT);
}
- public static boolean startViewServer(Device device, int port) {
+ public static boolean startViewServer(IDevice device, int port) {
initDebugBridge();
final boolean[] result = new boolean[1];
try {
@@ -93,7 +93,7 @@ public class DeviceBridge {
return result[0];
}
- public static boolean stopViewServer(Device device) {
+ public static boolean stopViewServer(IDevice device) {
initDebugBridge();
final boolean[] result = new boolean[1];
try {
@@ -116,17 +116,17 @@ public class DeviceBridge {
* <p/>This starts a port forwarding between a local port and a port on the device.
* @param device
*/
- public static void setupDeviceForward(Device device) {
+ public static void setupDeviceForward(IDevice device) {
synchronized (devicePortMap) {
- if (device.getState() == Device.DeviceState.ONLINE) {
+ if (device.getState() == IDevice.DeviceState.ONLINE) {
int localPort = nextLocalPort++;
device.createForward(localPort, Configuration.DEFAULT_SERVER_PORT);
devicePortMap.put(device, localPort);
}
}
}
-
- public static void removeDeviceForward(Device device) {
+
+ public static void removeDeviceForward(IDevice device) {
synchronized (devicePortMap) {
final Integer localPort = devicePortMap.get(device);
if (localPort != null) {
@@ -135,18 +135,18 @@ public class DeviceBridge {
}
}
}
-
- public static int getDeviceLocalPort(Device device) {
+
+ public static int getDeviceLocalPort(IDevice device) {
synchronized (devicePortMap) {
Integer port = devicePortMap.get(device);
if (port != null) {
return port;
}
-
+
Log.e("hierarchy", "Missing forwarded port for " + device.getSerialNumber());
return -1;
}
-
+
}
private static String buildStartServerShellCommand(int port) {
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/scene/CaptureLoader.java b/hierarchyviewer/src/com/android/hierarchyviewer/scene/CaptureLoader.java
index 7cc44bc..c512ac2 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/scene/CaptureLoader.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/scene/CaptureLoader.java
@@ -16,7 +16,7 @@
package com.android.hierarchyviewer.scene;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.Configuration;
import com.android.hierarchyviewer.device.Window;
import com.android.hierarchyviewer.device.DeviceBridge;
@@ -31,16 +31,16 @@ import java.net.Socket;
import javax.imageio.ImageIO;
public class CaptureLoader {
- public static Image loadCapture(Device device, Window window, String params) {
+ public static Image loadCapture(IDevice device, Window window, String params) {
Socket socket = null;
BufferedInputStream in = null;
BufferedWriter out = null;
-
+
try {
socket = new Socket();
socket.connect(new InetSocketAddress("127.0.0.1",
DeviceBridge.getDeviceLocalPort(device)));
-
+
out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
in = new BufferedInputStream(socket.getInputStream());
@@ -66,7 +66,7 @@ public class CaptureLoader {
ex.printStackTrace();
}
}
-
+
return null;
}
}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ProfilesLoader.java b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ProfilesLoader.java
index 83b9113..b91db79 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ProfilesLoader.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ProfilesLoader.java
@@ -16,7 +16,7 @@
package com.android.hierarchyviewer.scene;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.Window;
import com.android.hierarchyviewer.device.DeviceBridge;
@@ -29,7 +29,7 @@ import java.io.BufferedReader;
import java.io.InputStreamReader;
public class ProfilesLoader {
- public static double[] loadProfiles(Device device, Window window, String params) {
+ public static double[] loadProfiles(IDevice device, Window window, String params) {
Socket socket = null;
BufferedReader in = null;
BufferedWriter out = null;
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewHierarchyLoader.java b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewHierarchyLoader.java
index 1f3e278..6254262 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewHierarchyLoader.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewHierarchyLoader.java
@@ -16,7 +16,7 @@
package com.android.hierarchyviewer.scene;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.DeviceBridge;
import com.android.hierarchyviewer.device.Window;
@@ -36,19 +36,19 @@ import java.util.regex.Pattern;
public class ViewHierarchyLoader {
@SuppressWarnings("empty-statement")
- public static ViewHierarchyScene loadScene(Device device, Window window) {
+ public static ViewHierarchyScene loadScene(IDevice device, Window window) {
ViewHierarchyScene scene = new ViewHierarchyScene();
// Read the views tree
Socket socket = null;
BufferedReader in = null;
BufferedWriter out = null;
-
+
String line;
-
+
try {
System.out.println("==> Starting client");
-
+
socket = new Socket();
socket.connect(new InetSocketAddress("127.0.0.1",
DeviceBridge.getDeviceLocalPort(device)));
@@ -57,11 +57,11 @@ public class ViewHierarchyLoader {
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
System.out.println("==> DUMP");
-
+
out.write("DUMP " + window.encode());
out.newLine();
out.flush();
-
+
Stack<ViewNode> stack = new Stack<ViewNode>();
boolean setRoot = true;
@@ -72,7 +72,7 @@ public class ViewHierarchyLoader {
if ("DONE.".equalsIgnoreCase(line)) {
break;
}
-
+
int whitespaceCount = countFrontWhitespace(line);
if (lastWhitespaceCount < whitespaceCount) {
stack.push(lastNode);
@@ -86,7 +86,7 @@ public class ViewHierarchyLoader {
lastWhitespaceCount = whitespaceCount;
line = line.trim();
int index = line.indexOf(' ');
-
+
lastNode = new ViewNode();
lastNode.name = line.substring(0, index);
@@ -94,12 +94,12 @@ public class ViewHierarchyLoader {
loadProperties(lastNode, line);
scene.addNode(lastNode);
-
+
if (setRoot) {
scene.setRoot(lastNode);
setRoot = false;
}
-
+
if (!stack.isEmpty()) {
final ViewNode parent = stack.peek();
final String edge = parent.name + lastNode.name;
@@ -128,7 +128,7 @@ public class ViewHierarchyLoader {
Exceptions.printStackTrace(ex);
}
}
-
+
System.out.println("==> DONE");
return scene;
@@ -165,7 +165,7 @@ public class ViewHierarchyLoader {
int length = Integer.parseInt(data.substring(index + 1, index2));
start = index2 + 1 + length;
property.value = data.substring(index2 + 1, index2 + 1 + length);
-
+
node.properties.add(property);
node.namedProperties.put(property.name, property);
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewManager.java b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewManager.java
index 2b7efd6..df2a63e 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewManager.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/scene/ViewManager.java
@@ -16,7 +16,7 @@
package com.android.hierarchyviewer.scene;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.Window;
import com.android.hierarchyviewer.device.DeviceBridge;
@@ -27,15 +27,15 @@ import java.net.InetSocketAddress;
import java.net.Socket;
public class ViewManager {
- public static void invalidate(Device device, Window window, String params) {
+ public static void invalidate(IDevice device, Window window, String params) {
sendCommand("INVALIDATE", device, window, params);
}
- public static void requestLayout(Device device, Window window, String params) {
+ public static void requestLayout(IDevice device, Window window, String params) {
sendCommand("REQUEST_LAYOUT", device, window, params);
}
- private static void sendCommand(String command, Device device, Window window, String params) {
+ private static void sendCommand(String command, IDevice device, Window window, String params) {
Socket socket = null;
BufferedWriter out = null;
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/scene/WindowsLoader.java b/hierarchyviewer/src/com/android/hierarchyviewer/scene/WindowsLoader.java
index 6c14cb6..ef93707 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/scene/WindowsLoader.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/scene/WindowsLoader.java
@@ -16,7 +16,7 @@
package com.android.hierarchyviewer.scene;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.DeviceBridge;
import com.android.hierarchyviewer.device.Window;
@@ -30,7 +30,7 @@ import java.net.Socket;
import java.util.ArrayList;
public class WindowsLoader {
- public static Window[] loadWindows(Device device) {
+ public static Window[] loadWindows(IDevice device) {
Socket socket = null;
BufferedReader in = null;
BufferedWriter out = null;
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/ScreenViewer.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/ScreenViewer.java
index e4144b1..7c17c90 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/ui/ScreenViewer.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/ScreenViewer.java
@@ -1,6 +1,6 @@
package com.android.hierarchyviewer.ui;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.ddmlib.RawImage;
import com.android.hierarchyviewer.util.WorkerThread;
import com.android.hierarchyviewer.scene.ViewNode;
@@ -51,14 +51,14 @@ import java.util.concurrent.ExecutionException;
class ScreenViewer extends JPanel implements ActionListener {
private final Workspace workspace;
- private final Device device;
+ private final IDevice device;
private GetScreenshotTask task;
private BufferedImage image;
private int[] scanline;
private volatile boolean isLoading;
- private BufferedImage overlay;
+ private BufferedImage overlay;
private AlphaComposite overlayAlpha = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
private ScreenViewer.LoupeStatus status;
@@ -73,7 +73,7 @@ class ScreenViewer extends JPanel implements ActionListener {
private JSlider zoomSlider;
- ScreenViewer(Workspace workspace, Device device, int spacing) {
+ ScreenViewer(Workspace workspace, IDevice device, int spacing) {
setLayout(new BorderLayout());
setOpaque(false);
@@ -92,7 +92,7 @@ class ScreenViewer extends JPanel implements ActionListener {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
- timer.start();
+ timer.start();
}
});
}
@@ -463,7 +463,7 @@ class ScreenViewer extends JPanel implements ActionListener {
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(Color.WHITE);
- g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
+ g.drawRect(0, 0, getWidth() - 1, getHeight() - 1);
}
}
}
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/ui/Workspace.java b/hierarchyviewer/src/com/android/hierarchyviewer/ui/Workspace.java
index d530c35..1361243 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/ui/Workspace.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/ui/Workspace.java
@@ -17,7 +17,7 @@
package com.android.hierarchyviewer.ui;
import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.Device;
+import com.android.ddmlib.IDevice;
import com.android.hierarchyviewer.device.DeviceBridge;
import com.android.hierarchyviewer.device.Window;
import com.android.hierarchyviewer.laf.UnifiedContentBorder;
@@ -147,7 +147,7 @@ public class Workspace extends JFrame {
private DevicesTableModel devicesTableModel;
private WindowsTableModel windowsTableModel;
- private Device currentDevice;
+ private IDevice currentDevice;
private Window currentWindow = Window.FOCUSED_WINDOW;
private JButton displayNodeButton;
@@ -235,7 +235,7 @@ public class Workspace extends JFrame {
}
devicesTableModel = new DevicesTableModel();
- for (Device device : DeviceBridge.getDevices()) {
+ for (IDevice device : DeviceBridge.getDevices()) {
DeviceBridge.setupDeviceForward(device);
devicesTableModel.addDevice(device);
}
@@ -289,7 +289,7 @@ public class Workspace extends JFrame {
setVisibleRowCount(profilingTable, 5);
firstTableScroller.setMinimumSize(profilingTable.getPreferredScrollableViewportSize());
-
+
JSplitPane tablesSplitter = new JSplitPane();
tablesSplitter.setBorder(null);
tablesSplitter.setOrientation(JSplitPane.VERTICAL_SPLIT);
@@ -522,7 +522,7 @@ public class Workspace extends JFrame {
showDevicesMenuItem.setEnabled(false);
viewMenu.add(showDevicesMenuItem);
- menuBar.add(viewMenu);
+ menuBar.add(viewMenu);
viewHierarchyMenu.setText("Hierarchy");
@@ -855,7 +855,7 @@ public class Workspace extends JFrame {
public void showDevicesSelector() {
if (mainSplitter != null) {
if (pixelPerfectPanel != null) {
- screenViewer.start();
+ screenViewer.start();
}
mainPanel.remove(graphViewButton.isSelected() ? mainSplitter : pixelPerfectPanel);
mainPanel.add(deviceSelector, BorderLayout.CENTER);
@@ -864,7 +864,7 @@ public class Workspace extends JFrame {
hideStatusBarComponents();
- saveMenuItem.setEnabled(false);
+ saveMenuItem.setEnabled(false);
showDevicesMenuItem.setEnabled(false);
showDevicesButton.setEnabled(false);
displayNodeButton.setEnabled(false);
@@ -926,7 +926,7 @@ public class Workspace extends JFrame {
}
public void cleanupDevices() {
- for (Device device : devicesTableModel.getDevices()) {
+ for (IDevice device : devicesTableModel.getDevices()) {
DeviceBridge.removeDeviceForward(device);
}
}
@@ -989,7 +989,7 @@ public class Workspace extends JFrame {
return null;
}
return new CaptureNodeTask();
- }
+ }
public SwingWorker<?, ?> startServer() {
return new StartServerTask();
@@ -1232,7 +1232,7 @@ public class Workspace extends JFrame {
@Override
protected void done() {
- endTask();
+ endTask();
}
}
@@ -1293,10 +1293,10 @@ public class Workspace extends JFrame {
private class DevicesTableModel extends DefaultTableModel implements
AndroidDebugBridge.IDeviceChangeListener {
- private ArrayList<Device> devices;
+ private ArrayList<IDevice> devices;
private DevicesTableModel() {
- devices = new ArrayList<Device>();
+ devices = new ArrayList<IDevice>();
}
@Override
@@ -1320,7 +1320,7 @@ public class Workspace extends JFrame {
}
@WorkerThread
- public void deviceConnected(final Device device) {
+ public void deviceConnected(final IDevice device) {
DeviceBridge.setupDeviceForward(device);
SwingUtilities.invokeLater(new Runnable() {
@@ -1331,7 +1331,7 @@ public class Workspace extends JFrame {
}
@WorkerThread
- public void deviceDisconnected(final Device device) {
+ public void deviceDisconnected(final IDevice device) {
DeviceBridge.removeDeviceForward(device);
SwingUtilities.invokeLater(new Runnable() {
@@ -1341,14 +1341,14 @@ public class Workspace extends JFrame {
});
}
- public void addDevice(Device device) {
+ public void addDevice(IDevice device) {
if (!devices.contains(device)) {
devices.add(device);
fireTableDataChanged();
}
}
- public void removeDevice(Device device) {
+ public void removeDevice(IDevice device) {
if (device.equals(currentDevice)) {
reset();
}
@@ -1360,12 +1360,12 @@ public class Workspace extends JFrame {
}
@WorkerThread
- public void deviceChanged(Device device, int changeMask) {
- if ((changeMask & Device.CHANGE_STATE) != 0 &&
+ public void deviceChanged(IDevice device, int changeMask) {
+ if ((changeMask & IDevice.CHANGE_STATE) != 0 &&
device.isOnline()) {
// if the device state changed and it's now online, we set up its port forwarding.
DeviceBridge.setupDeviceForward(device);
- } else if (device == currentDevice && (changeMask & Device.CHANGE_CLIENT_LIST) != 0) {
+ } else if (device == currentDevice && (changeMask & IDevice.CHANGE_CLIENT_LIST) != 0) {
// if the changed device is the current one and the client list changed, we update
// the UI.
loadWindows().execute();
@@ -1378,12 +1378,12 @@ public class Workspace extends JFrame {
return devices == null ? 0 : devices.size();
}
- public Device getDevice(int index) {
+ public IDevice getDevice(int index) {
return index < devices.size() ? devices.get(index) : null;
}
- public Device[] getDevices() {
- return devices.toArray(new Device[devices.size()]);
+ public IDevice[] getDevices() {
+ return devices.toArray(new IDevice[devices.size()]);
}
}
@@ -1441,7 +1441,7 @@ public class Workspace extends JFrame {
public void clear() {
windows.clear();
- windows.add(Window.FOCUSED_WINDOW);
+ windows.add(Window.FOCUSED_WINDOW);
}
public Window getWindow(int index) {
@@ -1462,7 +1462,7 @@ public class Workspace extends JFrame {
if (currentDevice != null) {
if (!DeviceBridge.isViewServerRunning(currentDevice)) {
DeviceBridge.startViewServer(currentDevice);
- checkForServerOnCurrentDevice();
+ checkForServerOnCurrentDevice();
}
loadWindows().execute();
windowsTableModel.setVisible(true);