Make the ddmlib API use IDevice instead of Device
Device is now private. All the API is using IDevice. Updated ddms, ADT, hierarchyviewer and other tools that relied on ddmlib.
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddms;
|
package com.android.ddms;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
|
import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
|
||||||
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
@@ -53,15 +53,15 @@ public class DebugPortProvider implements IDebugPortProvider {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a static debug port for the specified application running on the
|
* Returns a static debug port for the specified application running on the
|
||||||
* specified {@link Device}.
|
* specified {@link IDevice}.
|
||||||
* @param device The device the application is running on.
|
* @param device The device the application is running on.
|
||||||
* @param appName The application name, as defined in the
|
* @param appName The application name, as defined in the
|
||||||
* AndroidManifest.xml package attribute.
|
* AndroidManifest.xml package attribute.
|
||||||
* @return The static debug port or {@link #NO_STATIC_PORT} if there is none setup.
|
* @return The static debug port or {@link #NO_STATIC_PORT} if there is none setup.
|
||||||
*
|
*
|
||||||
* @see IDebugPortProvider#getPort(Device, String)
|
* @see IDebugPortProvider#getPort(IDevice, String)
|
||||||
*/
|
*/
|
||||||
public int getPort(Device device, String appName) {
|
public int getPort(IDevice device, String appName) {
|
||||||
if (mMap != null) {
|
if (mMap != null) {
|
||||||
Map<String, Integer> deviceMap = mMap.get(device.getSerialNumber());
|
Map<String, Integer> deviceMap = mMap.get(device.getSerialNumber());
|
||||||
if (deviceMap != null) {
|
if (deviceMap != null) {
|
||||||
@@ -107,7 +107,7 @@ public class DebugPortProvider implements IDebugPortProvider {
|
|||||||
if (entry.length == 3) {
|
if (entry.length == 3) {
|
||||||
deviceName = entry[2];
|
deviceName = entry[2];
|
||||||
} else {
|
} else {
|
||||||
deviceName = Device.FIRST_EMULATOR_SN;
|
deviceName = IDevice.FIRST_EMULATOR_SN;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the device map
|
// get the device map
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package com.android.ddms;
|
package com.android.ddms;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.IShellOutputReceiver;
|
import com.android.ddmlib.IShellOutputReceiver;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public class DeviceCommandDialog extends Dialog {
|
|||||||
* Prepare and display the dialog.
|
* Prepare and display the dialog.
|
||||||
* @param currentDevice
|
* @param currentDevice
|
||||||
*/
|
*/
|
||||||
public void open(Device currentDevice) {
|
public void open(IDevice currentDevice) {
|
||||||
Shell parent = getParent();
|
Shell parent = getParent();
|
||||||
Shell shell = new Shell(parent, getStyle());
|
Shell shell = new Shell(parent, getStyle());
|
||||||
shell.setText("Remote Command");
|
shell.setText("Remote Command");
|
||||||
@@ -219,13 +219,13 @@ public class DeviceCommandDialog extends Dialog {
|
|||||||
private String mCommand;
|
private String mCommand;
|
||||||
private Text mText;
|
private Text mText;
|
||||||
private int mResult;
|
private int mResult;
|
||||||
private Device mDevice;
|
private IDevice mDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor; pass in the text widget that will receive the output.
|
* Constructor; pass in the text widget that will receive the output.
|
||||||
* @param device
|
* @param device
|
||||||
*/
|
*/
|
||||||
public Gatherer(Shell shell, Device device, String command, Text text) {
|
public Gatherer(Shell shell, IDevice device, String command, Text text) {
|
||||||
mShell = shell;
|
mShell = shell;
|
||||||
mDevice = device;
|
mDevice = device;
|
||||||
mCommand = command;
|
mCommand = command;
|
||||||
@@ -307,7 +307,7 @@ public class DeviceCommandDialog extends Dialog {
|
|||||||
* We have to run the command in a thread so that the UI continues
|
* We have to run the command in a thread so that the UI continues
|
||||||
* to work.
|
* to work.
|
||||||
*/
|
*/
|
||||||
private void executeCommand(Shell shell, Device device) {
|
private void executeCommand(Shell shell, IDevice device) {
|
||||||
Gatherer gath = new Gatherer(shell, device, commandString(), mText);
|
Gatherer gath = new Gatherer(shell, device, commandString(), mText);
|
||||||
gath.start();
|
gath.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddms;
|
package com.android.ddms;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
@@ -75,7 +75,7 @@ public class StaticPortEditDialog extends Dialog {
|
|||||||
public StaticPortEditDialog(Shell parent, ArrayList<Integer> ports) {
|
public StaticPortEditDialog(Shell parent, ArrayList<Integer> ports) {
|
||||||
super(parent, SWT.DIALOG_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL);
|
super(parent, SWT.DIALOG_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL);
|
||||||
mPorts = ports;
|
mPorts = ports;
|
||||||
mDeviceSn = Device.FIRST_EMULATOR_SN;
|
mDeviceSn = IDevice.FIRST_EMULATOR_SN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package com.android.ddms;
|
|||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.Log.ILogOutput;
|
import com.android.ddmlib.Log.ILogOutput;
|
||||||
import com.android.ddmlib.Log.LogLevel;
|
import com.android.ddmlib.Log.LogLevel;
|
||||||
@@ -90,7 +90,7 @@ import java.util.ArrayList;
|
|||||||
/**
|
/**
|
||||||
* This acts as the UI builder. This cannot be its own thread since this prevent using AWT in an
|
* This acts as the UI builder. This cannot be its own thread since this prevent using AWT in an
|
||||||
* SWT application. So this class mainly builds the ui, and manages communication between the panels
|
* SWT application. So this class mainly builds the ui, and manages communication between the panels
|
||||||
* when {@link Device} / {@link Client} selection changes.
|
* when {@link IDevice} / {@link Client} selection changes.
|
||||||
*/
|
*/
|
||||||
public class UIThread implements IUiSelectionListener {
|
public class UIThread implements IUiSelectionListener {
|
||||||
/*
|
/*
|
||||||
@@ -153,7 +153,7 @@ public class UIThread implements IUiSelectionListener {
|
|||||||
// the table we show in the left-hand pane
|
// the table we show in the left-hand pane
|
||||||
private DevicePanel mDevicePanel;
|
private DevicePanel mDevicePanel;
|
||||||
|
|
||||||
private Device mCurrentDevice = null;
|
private IDevice mCurrentDevice = null;
|
||||||
private Client mCurrentClient = null;
|
private Client mCurrentClient = null;
|
||||||
|
|
||||||
// status line at the bottom of the app window
|
// status line at the bottom of the app window
|
||||||
@@ -1450,13 +1450,13 @@ public class UIThread implements IUiSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when a new {@link Device} and {@link Client} are selected.
|
* Sent when a new {@link IDevice} and {@link Client} are selected.
|
||||||
* @param selectedDevice the selected device. If null, no devices are selected.
|
* @param selectedDevice the selected device. If null, no devices are selected.
|
||||||
* @param selectedClient The selected client. If null, no clients are selected.
|
* @param selectedClient The selected client. If null, no clients are selected.
|
||||||
*
|
*
|
||||||
* @see IUiSelectionListener
|
* @see IUiSelectionListener
|
||||||
*/
|
*/
|
||||||
public void selectionChanged(Device selectedDevice, Client selectedClient) {
|
public void selectionChanged(IDevice selectedDevice, Client selectedClient) {
|
||||||
if (mCurrentDevice != selectedDevice) {
|
if (mCurrentDevice != selectedDevice) {
|
||||||
mCurrentDevice = selectedDevice;
|
mCurrentDevice = selectedDevice;
|
||||||
for (TablePanel panel : mPanels) {
|
for (TablePanel panel : mPanels) {
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ final class AdbHelper {
|
|||||||
|
|
||||||
byte[] request = formAdbRequest(String.format(
|
byte[] request = formAdbRequest(String.format(
|
||||||
"host-serial:%1$s:forward:tcp:%2$d;tcp:%3$d", //$NON-NLS-1$
|
"host-serial:%1$s:forward:tcp:%2$d;tcp:%3$d", //$NON-NLS-1$
|
||||||
device.serialNumber, localPort, remotePort));
|
device.getSerialNumber(), localPort, remotePort));
|
||||||
|
|
||||||
if (write(adbChan, request) == false) {
|
if (write(adbChan, request) == false) {
|
||||||
throw new IOException("failed to submit the forward command.");
|
throw new IOException("failed to submit the forward command.");
|
||||||
@@ -523,7 +523,7 @@ final class AdbHelper {
|
|||||||
|
|
||||||
byte[] request = formAdbRequest(String.format(
|
byte[] request = formAdbRequest(String.format(
|
||||||
"host-serial:%1$s:killforward:tcp:%2$d;tcp:%3$d", //$NON-NLS-1$
|
"host-serial:%1$s:killforward:tcp:%2$d;tcp:%3$d", //$NON-NLS-1$
|
||||||
device.serialNumber, localPort, remotePort));
|
device.getSerialNumber(), localPort, remotePort));
|
||||||
|
|
||||||
if (!write(adbChan, request)) {
|
if (!write(adbChan, request)) {
|
||||||
throw new IOException("failed to submit the remove forward command.");
|
throw new IOException("failed to submit the remove forward command.");
|
||||||
@@ -697,7 +697,7 @@ final class AdbHelper {
|
|||||||
// if the device is not -1, then we first tell adb we're looking to talk
|
// if the device is not -1, then we first tell adb we're looking to talk
|
||||||
// to a specific device
|
// to a specific device
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
String msg = "host:transport:" + device.serialNumber; //$NON-NLS-1$
|
String msg = "host:transport:" + device.getSerialNumber(); //$NON-NLS-1$
|
||||||
byte[] device_query = formAdbRequest(msg);
|
byte[] device_query = formAdbRequest(msg);
|
||||||
|
|
||||||
if (write(adbChan, device_query) == false)
|
if (write(adbChan, device_query) == false)
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public final class AndroidDebugBridge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Classes which implement this interface provide methods that deal
|
* Classes which implement this interface provide methods that deal
|
||||||
* with {@link Device} addition, deletion, and changes.
|
* with {@link IDevice} addition, deletion, and changes.
|
||||||
*/
|
*/
|
||||||
public interface IDeviceChangeListener {
|
public interface IDeviceChangeListener {
|
||||||
/**
|
/**
|
||||||
@@ -116,7 +116,7 @@ public final class AndroidDebugBridge {
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device);
|
public void deviceConnected(IDevice device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when the a device is connected to the {@link AndroidDebugBridge}.
|
* Sent when the a device is connected to the {@link AndroidDebugBridge}.
|
||||||
@@ -124,7 +124,7 @@ public final class AndroidDebugBridge {
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*/
|
*/
|
||||||
public void deviceDisconnected(Device device);
|
public void deviceDisconnected(IDevice device);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when a device data changed, or when clients are started/terminated on the device.
|
* Sent when a device data changed, or when clients are started/terminated on the device.
|
||||||
@@ -132,10 +132,10 @@ public final class AndroidDebugBridge {
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the device that was updated.
|
* @param device the device that was updated.
|
||||||
* @param changeMask the mask describing what changed. It can contain any of the following
|
* @param changeMask the mask describing what changed. It can contain any of the following
|
||||||
* values: {@link Device#CHANGE_BUILD_INFO}, {@link Device#CHANGE_STATE},
|
* values: {@link IDevice#CHANGE_BUILD_INFO}, {@link IDevice#CHANGE_STATE},
|
||||||
* {@link Device#CHANGE_CLIENT_LIST}
|
* {@link IDevice#CHANGE_CLIENT_LIST}
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(Device device, int changeMask);
|
public void deviceChanged(IDevice device, int changeMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,7 +215,7 @@ public final class AndroidDebugBridge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the ddmlib is setup to support monitoring and interacting with
|
* Returns whether the ddmlib is setup to support monitoring and interacting with
|
||||||
* {@link Client}s running on the {@link Device}s.
|
* {@link Client}s running on the {@link IDevice}s.
|
||||||
*/
|
*/
|
||||||
static boolean getClientSupport() {
|
static boolean getClientSupport() {
|
||||||
return sClientSupport;
|
return sClientSupport;
|
||||||
@@ -391,7 +391,7 @@ public final class AndroidDebugBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the listener to the collection of listeners who will be notified when a {@link Device}
|
* Adds the listener to the collection of listeners who will be notified when a {@link IDevice}
|
||||||
* is connected, disconnected, or when its properties or its {@link Client} list changed,
|
* is connected, disconnected, or when its properties or its {@link Client} list changed,
|
||||||
* by sending it one of the messages defined in the {@link IDeviceChangeListener} interface.
|
* by sending it one of the messages defined in the {@link IDeviceChangeListener} interface.
|
||||||
* @param listener The listener which should be notified.
|
* @param listener The listener which should be notified.
|
||||||
@@ -406,7 +406,7 @@ public final class AndroidDebugBridge {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the listener from the collection of listeners who will be notified when a
|
* Removes the listener from the collection of listeners who will be notified when a
|
||||||
* {@link Device} is connected, disconnected, or when its properties or its {@link Client}
|
* {@link IDevice} is connected, disconnected, or when its properties or its {@link Client}
|
||||||
* list changed.
|
* list changed.
|
||||||
* @param listener The listener which should no longer be notified.
|
* @param listener The listener which should no longer be notified.
|
||||||
*/
|
*/
|
||||||
@@ -446,23 +446,23 @@ public final class AndroidDebugBridge {
|
|||||||
* Returns the devices.
|
* Returns the devices.
|
||||||
* @see #hasInitialDeviceList()
|
* @see #hasInitialDeviceList()
|
||||||
*/
|
*/
|
||||||
public Device[] getDevices() {
|
public IDevice[] getDevices() {
|
||||||
synchronized (sLock) {
|
synchronized (sLock) {
|
||||||
if (mDeviceMonitor != null) {
|
if (mDeviceMonitor != null) {
|
||||||
return mDeviceMonitor.getDevices();
|
return mDeviceMonitor.getDevices();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Device[0];
|
return new IDevice[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the bridge has acquired the initial list from adb after being created.
|
* Returns whether the bridge has acquired the initial list from adb after being created.
|
||||||
* <p/>Calling {@link #getDevices()} right after {@link #createBridge(String, boolean)} will
|
* <p/>Calling {@link #getDevices()} right after {@link #createBridge(String, boolean)} will
|
||||||
* generally result in an empty list. This is due to the internal asynchronous communication
|
* generally result in an empty list. This is due to the internal asynchronous communication
|
||||||
* mechanism with <code>adb</code> that does not guarantee that the {@link Device} list has been
|
* mechanism with <code>adb</code> that does not guarantee that the {@link IDevice} list has been
|
||||||
* built before the call to {@link #getDevices()}.
|
* built before the call to {@link #getDevices()}.
|
||||||
* <p/>The recommended way to get the list of {@link Device} objects is to create a
|
* <p/>The recommended way to get the list of {@link IDevice} objects is to create a
|
||||||
* {@link IDeviceChangeListener} object.
|
* {@link IDeviceChangeListener} object.
|
||||||
*/
|
*/
|
||||||
public boolean hasInitialDeviceList() {
|
public boolean hasInitialDeviceList() {
|
||||||
@@ -719,19 +719,19 @@ public final class AndroidDebugBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the listener of a new {@link Device}.
|
* Notify the listener of a new {@link IDevice}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The notification of the listeners is done in a synchronized block. It is important to
|
* The notification of the listeners is done in a synchronized block. It is important to
|
||||||
* expect the listeners to potentially access various methods of {@link Device} as well as
|
* expect the listeners to potentially access various methods of {@link IDevice} as well as
|
||||||
* {@link #getDevices()} which use internal locks.
|
* {@link #getDevices()} which use internal locks.
|
||||||
* <p/>
|
* <p/>
|
||||||
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
||||||
* {@link Device} which is also inside a synchronized block, should first synchronize on
|
* {@link IDevice} which is also inside a synchronized block, should first synchronize on
|
||||||
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
||||||
* @param device the new <code>Device</code>.
|
* @param device the new <code>IDevice</code>.
|
||||||
* @see #getLock()
|
* @see #getLock()
|
||||||
*/
|
*/
|
||||||
void deviceConnected(Device device) {
|
void deviceConnected(IDevice device) {
|
||||||
// because the listeners could remove themselves from the list while processing
|
// because the listeners could remove themselves from the list while processing
|
||||||
// their event callback, we make a copy of the list and iterate on it instead of
|
// their event callback, we make a copy of the list and iterate on it instead of
|
||||||
// the main list.
|
// the main list.
|
||||||
@@ -755,19 +755,19 @@ public final class AndroidDebugBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the listener of a disconnected {@link Device}.
|
* Notify the listener of a disconnected {@link IDevice}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The notification of the listeners is done in a synchronized block. It is important to
|
* The notification of the listeners is done in a synchronized block. It is important to
|
||||||
* expect the listeners to potentially access various methods of {@link Device} as well as
|
* expect the listeners to potentially access various methods of {@link IDevice} as well as
|
||||||
* {@link #getDevices()} which use internal locks.
|
* {@link #getDevices()} which use internal locks.
|
||||||
* <p/>
|
* <p/>
|
||||||
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
||||||
* {@link Device} which is also inside a synchronized block, should first synchronize on
|
* {@link IDevice} which is also inside a synchronized block, should first synchronize on
|
||||||
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
||||||
* @param device the disconnected <code>Device</code>.
|
* @param device the disconnected <code>IDevice</code>.
|
||||||
* @see #getLock()
|
* @see #getLock()
|
||||||
*/
|
*/
|
||||||
void deviceDisconnected(Device device) {
|
void deviceDisconnected(IDevice device) {
|
||||||
// because the listeners could remove themselves from the list while processing
|
// because the listeners could remove themselves from the list while processing
|
||||||
// their event callback, we make a copy of the list and iterate on it instead of
|
// their event callback, we make a copy of the list and iterate on it instead of
|
||||||
// the main list.
|
// the main list.
|
||||||
@@ -791,19 +791,19 @@ public final class AndroidDebugBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify the listener of a modified {@link Device}.
|
* Notify the listener of a modified {@link IDevice}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The notification of the listeners is done in a synchronized block. It is important to
|
* The notification of the listeners is done in a synchronized block. It is important to
|
||||||
* expect the listeners to potentially access various methods of {@link Device} as well as
|
* expect the listeners to potentially access various methods of {@link IDevice} as well as
|
||||||
* {@link #getDevices()} which use internal locks.
|
* {@link #getDevices()} which use internal locks.
|
||||||
* <p/>
|
* <p/>
|
||||||
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
||||||
* {@link Device} which is also inside a synchronized block, should first synchronize on
|
* {@link IDevice} which is also inside a synchronized block, should first synchronize on
|
||||||
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
||||||
* @param device the modified <code>Device</code>.
|
* @param device the modified <code>IDevice</code>.
|
||||||
* @see #getLock()
|
* @see #getLock()
|
||||||
*/
|
*/
|
||||||
void deviceChanged(Device device, int changeMask) {
|
void deviceChanged(IDevice device, int changeMask) {
|
||||||
// because the listeners could remove themselves from the list while processing
|
// because the listeners could remove themselves from the list while processing
|
||||||
// their event callback, we make a copy of the list and iterate on it instead of
|
// their event callback, we make a copy of the list and iterate on it instead of
|
||||||
// the main list.
|
// the main list.
|
||||||
@@ -830,11 +830,11 @@ public final class AndroidDebugBridge {
|
|||||||
* Notify the listener of a modified {@link Client}.
|
* Notify the listener of a modified {@link Client}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The notification of the listeners is done in a synchronized block. It is important to
|
* The notification of the listeners is done in a synchronized block. It is important to
|
||||||
* expect the listeners to potentially access various methods of {@link Device} as well as
|
* expect the listeners to potentially access various methods of {@link IDevice} as well as
|
||||||
* {@link #getDevices()} which use internal locks.
|
* {@link #getDevices()} which use internal locks.
|
||||||
* <p/>
|
* <p/>
|
||||||
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
* For this reason, any call to this method from a method of {@link DeviceMonitor},
|
||||||
* {@link Device} which is also inside a synchronized block, should first synchronize on
|
* {@link IDevice} which is also inside a synchronized block, should first synchronize on
|
||||||
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
* the {@link AndroidDebugBridge} lock. Access to this lock is done through {@link #getLock()}.
|
||||||
* @param device the modified <code>Client</code>.
|
* @param device the modified <code>Client</code>.
|
||||||
* @param changeMask the mask indicating what changed in the <code>Client</code>
|
* @param changeMask the mask indicating what changed in the <code>Client</code>
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ abstract class ChunkHandler {
|
|||||||
protected static Client checkDebuggerPortForAppName(Client client, String appName) {
|
protected static Client checkDebuggerPortForAppName(Client client, String appName) {
|
||||||
IDebugPortProvider provider = DebugPortManager.getProvider();
|
IDebugPortProvider provider = DebugPortManager.getProvider();
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
Device device = client.getDevice();
|
Device device = client.getDeviceImpl();
|
||||||
int newPort = provider.getPort(device, appName);
|
int newPort = provider.getPort(device, appName);
|
||||||
|
|
||||||
if (newPort != IDebugPortProvider.NO_STATIC_PORT &&
|
if (newPort != IDebugPortProvider.NO_STATIC_PORT &&
|
||||||
|
|||||||
@@ -147,9 +147,15 @@ public class Client {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the {@link Device} on which this Client is running.
|
* Returns the {@link IDevice} on which this Client is running.
|
||||||
*/
|
*/
|
||||||
public Device getDevice() {
|
public IDevice getDevice() {
|
||||||
|
return mDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the {@link Device} on which this Client is running.
|
||||||
|
*/
|
||||||
|
Device getDeviceImpl() {
|
||||||
return mDevice;
|
return mDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class DebugPortManager {
|
|||||||
* @return The non-random debugger port or {@link #NO_STATIC_PORT} if the {@link Client}
|
* @return The non-random debugger port or {@link #NO_STATIC_PORT} if the {@link Client}
|
||||||
* should use the automatic debugger port provider.
|
* should use the automatic debugger port provider.
|
||||||
*/
|
*/
|
||||||
public int getPort(Device device, String appName);
|
public int getPort(IDevice device, String appName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IDebugPortProvider sProvider = null;
|
private static IDebugPortProvider sProvider = null;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.ddmlib;
|
package com.android.ddmlib;
|
||||||
|
|
||||||
import com.android.ddmlib.Client;
|
|
||||||
import com.android.ddmlib.log.LogReceiver;
|
import com.android.ddmlib.log.LogReceiver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -30,50 +29,20 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Device. It can be a physical device or an emulator.
|
* A Device. It can be a physical device or an emulator.
|
||||||
*
|
|
||||||
* TODO: make this class package-protected, and shift all callers to use IDevice
|
|
||||||
*/
|
*/
|
||||||
public final class Device implements IDevice {
|
final class Device implements IDevice {
|
||||||
/**
|
|
||||||
* The state of a device.
|
|
||||||
*/
|
|
||||||
public static enum DeviceState {
|
|
||||||
BOOTLOADER("bootloader"), //$NON-NLS-1$
|
|
||||||
OFFLINE("offline"), //$NON-NLS-1$
|
|
||||||
ONLINE("device"); //$NON-NLS-1$
|
|
||||||
|
|
||||||
private String mState;
|
|
||||||
|
|
||||||
DeviceState(String state) {
|
|
||||||
mState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a {@link DeviceState} from the string returned by <code>adb devices</code>.
|
|
||||||
* @param state the device state.
|
|
||||||
* @return a {@link DeviceState} object or <code>null</code> if the state is unknown.
|
|
||||||
*/
|
|
||||||
public static DeviceState getState(String state) {
|
|
||||||
for (DeviceState deviceState : values()) {
|
|
||||||
if (deviceState.mState.equals(state)) {
|
|
||||||
return deviceState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Emulator Serial Number regexp. */
|
/** Emulator Serial Number regexp. */
|
||||||
final static String RE_EMULATOR_SN = "emulator-(\\d+)"; //$NON-NLS-1$
|
final static String RE_EMULATOR_SN = "emulator-(\\d+)"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** Serial number of the device */
|
/** Serial number of the device */
|
||||||
String serialNumber = null;
|
private String mSerialNumber = null;
|
||||||
|
|
||||||
/** Name of the AVD */
|
/** Name of the AVD */
|
||||||
String mAvdName = null;
|
private String mAvdName = null;
|
||||||
|
|
||||||
/** State of the device. */
|
/** State of the device. */
|
||||||
DeviceState state = null;
|
private DeviceState mState = null;
|
||||||
|
|
||||||
/** Device properties. */
|
/** Device properties. */
|
||||||
private final Map<String, String> mProperties = new HashMap<String, String>();
|
private final Map<String, String> mProperties = new HashMap<String, String>();
|
||||||
@@ -91,22 +60,42 @@ public final class Device implements IDevice {
|
|||||||
* @see com.android.ddmlib.IDevice#getSerialNumber()
|
* @see com.android.ddmlib.IDevice#getSerialNumber()
|
||||||
*/
|
*/
|
||||||
public String getSerialNumber() {
|
public String getSerialNumber() {
|
||||||
return serialNumber;
|
return mSerialNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
public String getAvdName() {
|
public String getAvdName() {
|
||||||
return mAvdName;
|
return mAvdName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the name of the AVD
|
||||||
|
*/
|
||||||
|
void setAvdName(String avdName) {
|
||||||
|
if (isEmulator() == false) {
|
||||||
|
throw new IllegalArgumentException(
|
||||||
|
"Cannot set the AVD name of the device is not an emulator");
|
||||||
|
}
|
||||||
|
|
||||||
|
mAvdName = avdName;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.android.ddmlib.IDevice#getState()
|
* @see com.android.ddmlib.IDevice#getState()
|
||||||
*/
|
*/
|
||||||
public DeviceState getState() {
|
public DeviceState getState() {
|
||||||
return state;
|
return mState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the state of the device.
|
||||||
|
*/
|
||||||
|
void setState(DeviceState state) {
|
||||||
|
mState = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.android.ddmlib.IDevice#getProperties()
|
* @see com.android.ddmlib.IDevice#getProperties()
|
||||||
@@ -134,7 +123,7 @@ public final class Device implements IDevice {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return serialNumber;
|
return mSerialNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -142,7 +131,7 @@ public final class Device implements IDevice {
|
|||||||
* @see com.android.ddmlib.IDevice#isOnline()
|
* @see com.android.ddmlib.IDevice#isOnline()
|
||||||
*/
|
*/
|
||||||
public boolean isOnline() {
|
public boolean isOnline() {
|
||||||
return state == DeviceState.ONLINE;
|
return mState == DeviceState.ONLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -150,7 +139,7 @@ public final class Device implements IDevice {
|
|||||||
* @see com.android.ddmlib.IDevice#isEmulator()
|
* @see com.android.ddmlib.IDevice#isEmulator()
|
||||||
*/
|
*/
|
||||||
public boolean isEmulator() {
|
public boolean isEmulator() {
|
||||||
return serialNumber.matches(RE_EMULATOR_SN);
|
return mSerialNumber.matches(RE_EMULATOR_SN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -158,7 +147,7 @@ public final class Device implements IDevice {
|
|||||||
* @see com.android.ddmlib.IDevice#isOffline()
|
* @see com.android.ddmlib.IDevice#isOffline()
|
||||||
*/
|
*/
|
||||||
public boolean isOffline() {
|
public boolean isOffline() {
|
||||||
return state == DeviceState.OFFLINE;
|
return mState == DeviceState.OFFLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -166,7 +155,7 @@ public final class Device implements IDevice {
|
|||||||
* @see com.android.ddmlib.IDevice#isBootLoader()
|
* @see com.android.ddmlib.IDevice#isBootLoader()
|
||||||
*/
|
*/
|
||||||
public boolean isBootLoader() {
|
public boolean isBootLoader() {
|
||||||
return state == DeviceState.BOOTLOADER;
|
return mState == DeviceState.BOOTLOADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -305,8 +294,10 @@ public final class Device implements IDevice {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Device(DeviceMonitor monitor) {
|
Device(DeviceMonitor monitor, String serialNumber, DeviceState deviceState) {
|
||||||
mMonitor = monitor;
|
mMonitor = monitor;
|
||||||
|
mSerialNumber = serialNumber;
|
||||||
|
mState = deviceState;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceMonitor getMonitor() {
|
DeviceMonitor getMonitor() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ package com.android.ddmlib;
|
|||||||
|
|
||||||
import com.android.ddmlib.AdbHelper.AdbResponse;
|
import com.android.ddmlib.AdbHelper.AdbResponse;
|
||||||
import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
|
import com.android.ddmlib.DebugPortManager.IDebugPortProvider;
|
||||||
import com.android.ddmlib.Device.DeviceState;
|
import com.android.ddmlib.IDevice.DeviceState;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
@@ -289,9 +289,8 @@ final class DeviceMonitor {
|
|||||||
String[] param = d.split("\t"); // $NON-NLS-1$
|
String[] param = d.split("\t"); // $NON-NLS-1$
|
||||||
if (param.length == 2) {
|
if (param.length == 2) {
|
||||||
// new adb uses only serial numbers to identify devices
|
// new adb uses only serial numbers to identify devices
|
||||||
Device device = new Device(this);
|
Device device = new Device(this, param[0] /*serialnumber*/,
|
||||||
device.serialNumber = param[0];
|
DeviceState.getState(param[1]));
|
||||||
device.state = DeviceState.getState(param[1]);
|
|
||||||
|
|
||||||
//add the device to the list
|
//add the device to the list
|
||||||
list.add(device);
|
list.add(device);
|
||||||
@@ -329,12 +328,12 @@ final class DeviceMonitor {
|
|||||||
for (int dd = 0 ; dd < count ; dd++) {
|
for (int dd = 0 ; dd < count ; dd++) {
|
||||||
Device newDevice = newList.get(dd);
|
Device newDevice = newList.get(dd);
|
||||||
// see if it matches in id and serial number.
|
// see if it matches in id and serial number.
|
||||||
if (newDevice.serialNumber.equals(device.serialNumber)) {
|
if (newDevice.getSerialNumber().equals(device.getSerialNumber())) {
|
||||||
foundMatch = true;
|
foundMatch = true;
|
||||||
|
|
||||||
// update the state if needed.
|
// update the state if needed.
|
||||||
if (device.state != newDevice.state) {
|
if (device.getState() != newDevice.getState()) {
|
||||||
device.state = newDevice.state;
|
device.setState(newDevice.getState());
|
||||||
device.update(Device.CHANGE_STATE);
|
device.update(Device.CHANGE_STATE);
|
||||||
|
|
||||||
// if the device just got ready/online, we need to start
|
// if the device just got ready/online, we need to start
|
||||||
@@ -344,7 +343,7 @@ final class DeviceMonitor {
|
|||||||
if (startMonitoringDevice(device) == false) {
|
if (startMonitoringDevice(device) == false) {
|
||||||
Log.e("DeviceMonitor",
|
Log.e("DeviceMonitor",
|
||||||
"Failed to start monitoring "
|
"Failed to start monitoring "
|
||||||
+ device.serialNumber);
|
+ device.getSerialNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,7 +423,7 @@ final class DeviceMonitor {
|
|||||||
if (device.isEmulator()) {
|
if (device.isEmulator()) {
|
||||||
EmulatorConsole console = EmulatorConsole.getConsole(device);
|
EmulatorConsole console = EmulatorConsole.getConsole(device);
|
||||||
if (console != null) {
|
if (console != null) {
|
||||||
device.mAvdName = console.getAvdName();
|
device.setAvdName(console.getAvdName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -510,7 +509,7 @@ final class DeviceMonitor {
|
|||||||
MonitorThread monitorThread = MonitorThread.getInstance();
|
MonitorThread monitorThread = MonitorThread.getInstance();
|
||||||
|
|
||||||
for (Client client : clients) {
|
for (Client client : clients) {
|
||||||
Device device = client.getDevice();
|
Device device = client.getDeviceImpl();
|
||||||
int pid = client.getClientData().getPid();
|
int pid = client.getClientData().getPid();
|
||||||
|
|
||||||
monitorThread.dropClient(client, false /* notify */);
|
monitorThread.dropClient(client, false /* notify */);
|
||||||
|
|||||||
@@ -202,9 +202,9 @@ public final class EmulatorConsole {
|
|||||||
* @param d The device that the console links to.
|
* @param d The device that the console links to.
|
||||||
* @return an <code>EmulatorConsole</code> object or <code>null</code> if the connection failed.
|
* @return an <code>EmulatorConsole</code> object or <code>null</code> if the connection failed.
|
||||||
*/
|
*/
|
||||||
public static synchronized EmulatorConsole getConsole(Device d) {
|
public static synchronized EmulatorConsole getConsole(IDevice d) {
|
||||||
// we need to make sure that the device is an emulator
|
// we need to make sure that the device is an emulator
|
||||||
Matcher m = sEmulatorRegexp.matcher(d.serialNumber);
|
Matcher m = sEmulatorRegexp.matcher(d.getSerialNumber());
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
// get the port number. This is the console port.
|
// get the port number. This is the console port.
|
||||||
int port;
|
int port;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
package com.android.ddmlib;
|
package com.android.ddmlib;
|
||||||
|
|
||||||
import com.android.ddmlib.Device.DeviceState;
|
|
||||||
import com.android.ddmlib.log.LogReceiver;
|
import com.android.ddmlib.log.LogReceiver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -40,6 +39,35 @@ public interface IDevice {
|
|||||||
/** Device change bit mask: build info change. */
|
/** Device change bit mask: build info change. */
|
||||||
public static final int CHANGE_BUILD_INFO = 0x0004;
|
public static final int CHANGE_BUILD_INFO = 0x0004;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state of a device.
|
||||||
|
*/
|
||||||
|
public static enum DeviceState {
|
||||||
|
BOOTLOADER("bootloader"), //$NON-NLS-1$
|
||||||
|
OFFLINE("offline"), //$NON-NLS-1$
|
||||||
|
ONLINE("device"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
private String mState;
|
||||||
|
|
||||||
|
DeviceState(String state) {
|
||||||
|
mState = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a {@link DeviceState} from the string returned by <code>adb devices</code>.
|
||||||
|
* @param state the device state.
|
||||||
|
* @return a {@link DeviceState} object or <code>null</code> if the state is unknown.
|
||||||
|
*/
|
||||||
|
public static DeviceState getState(String state) {
|
||||||
|
for (DeviceState deviceState : values()) {
|
||||||
|
if (deviceState.mState.equals(state)) {
|
||||||
|
return deviceState;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the serial number of the device.
|
* Returns the serial number of the device.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -551,13 +551,13 @@ final class MonitorThread extends Thread {
|
|||||||
|
|
||||||
// we should drop the client, but also attempt to reopen it.
|
// we should drop the client, but also attempt to reopen it.
|
||||||
// This is done by the DeviceMonitor.
|
// This is done by the DeviceMonitor.
|
||||||
client.getDevice().getMonitor().addClientToDropAndReopen(client,
|
client.getDeviceImpl().getMonitor().addClientToDropAndReopen(client,
|
||||||
IDebugPortProvider.NO_STATIC_PORT);
|
IDebugPortProvider.NO_STATIC_PORT);
|
||||||
} else {
|
} else {
|
||||||
Log.i("ddms", " (recycling client connection as well)");
|
Log.i("ddms", " (recycling client connection as well)");
|
||||||
// we should drop the client, but also attempt to reopen it.
|
// we should drop the client, but also attempt to reopen it.
|
||||||
// This is done by the DeviceMonitor.
|
// This is done by the DeviceMonitor.
|
||||||
client.getDevice().getMonitor().addClientToDropAndReopen(client,
|
client.getDeviceImpl().getMonitor().addClientToDropAndReopen(client,
|
||||||
IDebugPortProvider.NO_STATIC_PORT);
|
IDebugPortProvider.NO_STATIC_PORT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddmlib.log;
|
package com.android.ddmlib.log;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.MultiLineReceiver;
|
import com.android.ddmlib.MultiLineReceiver;
|
||||||
import com.android.ddmlib.log.EventContainer.EventValueType;
|
import com.android.ddmlib.log.EventContainer.EventValueType;
|
||||||
@@ -82,7 +82,7 @@ public final class EventLogParser {
|
|||||||
* @param device The device.
|
* @param device The device.
|
||||||
* @return <code>true</code> if success, <code>false</code> if failure or cancellation.
|
* @return <code>true</code> if success, <code>false</code> if failure or cancellation.
|
||||||
*/
|
*/
|
||||||
public boolean init(Device device) {
|
public boolean init(IDevice device) {
|
||||||
// read the event tag map file on the device.
|
// read the event tag map file on the device.
|
||||||
try {
|
try {
|
||||||
device.executeShellCommand("cat " + EVENT_TAG_MAP_FILE, //$NON-NLS-1$
|
device.executeShellCommand("cat " + EVENT_TAG_MAP_FILE, //$NON-NLS-1$
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.android.ddmlib.IDevice;
|
|||||||
import com.android.ddmlib.IShellOutputReceiver;
|
import com.android.ddmlib.IShellOutputReceiver;
|
||||||
import com.android.ddmlib.RawImage;
|
import com.android.ddmlib.RawImage;
|
||||||
import com.android.ddmlib.SyncService;
|
import com.android.ddmlib.SyncService;
|
||||||
import com.android.ddmlib.Device.DeviceState;
|
|
||||||
import com.android.ddmlib.log.LogReceiver;
|
import com.android.ddmlib.log.LogReceiver;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ import com.android.ddmlib.AndroidDebugBridge;
|
|||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.ClientData;
|
import com.android.ddmlib.ClientData;
|
||||||
import com.android.ddmlib.DdmPreferences;
|
import com.android.ddmlib.DdmPreferences;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IClientChangeListener;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
||||||
import com.android.ddmlib.Device.DeviceState;
|
import com.android.ddmlib.IDevice.DeviceState;
|
||||||
|
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
@@ -76,7 +76,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
public final static String ICON_HALT = "halt.png"; //$NON-NLS-1$
|
public final static String ICON_HALT = "halt.png"; //$NON-NLS-1$
|
||||||
public final static String ICON_GC = "gc.png"; //$NON-NLS-1$
|
public final static String ICON_GC = "gc.png"; //$NON-NLS-1$
|
||||||
|
|
||||||
private Device mCurrentDevice;
|
private IDevice mCurrentDevice;
|
||||||
private Client mCurrentClient;
|
private Client mCurrentClient;
|
||||||
|
|
||||||
private Tree mTree;
|
private Tree mTree;
|
||||||
@@ -93,7 +93,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
|
|
||||||
private final ArrayList<IUiSelectionListener> mListeners = new ArrayList<IUiSelectionListener>();
|
private final ArrayList<IUiSelectionListener> mListeners = new ArrayList<IUiSelectionListener>();
|
||||||
|
|
||||||
private final ArrayList<Device> mDevicesToExpand = new ArrayList<Device>();
|
private final ArrayList<IDevice> mDevicesToExpand = new ArrayList<IDevice>();
|
||||||
|
|
||||||
private IImageLoader mLoader;
|
private IImageLoader mLoader;
|
||||||
|
|
||||||
@@ -102,13 +102,13 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
/**
|
/**
|
||||||
* A Content provider for the {@link TreeViewer}.
|
* A Content provider for the {@link TreeViewer}.
|
||||||
* <p/>
|
* <p/>
|
||||||
* The input is a {@link AndroidDebugBridge}. First level elements are {@link Device} objects,
|
* The input is a {@link AndroidDebugBridge}. First level elements are {@link IDevice} objects,
|
||||||
* and second level elements are {@link Client} object.
|
* and second level elements are {@link Client} object.
|
||||||
*/
|
*/
|
||||||
private class ContentProvider implements ITreeContentProvider {
|
private class ContentProvider implements ITreeContentProvider {
|
||||||
public Object[] getChildren(Object parentElement) {
|
public Object[] getChildren(Object parentElement) {
|
||||||
if (parentElement instanceof Device) {
|
if (parentElement instanceof IDevice) {
|
||||||
return ((Device)parentElement).getClients();
|
return ((IDevice)parentElement).getClients();
|
||||||
}
|
}
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
}
|
}
|
||||||
@@ -121,8 +121,8 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
if (element instanceof Device) {
|
if (element instanceof IDevice) {
|
||||||
return ((Device)element).hasClients();
|
return ((IDevice)element).hasClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clients never have children.
|
// Clients never have children.
|
||||||
@@ -147,13 +147,13 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Label Provider for the {@link TreeViewer} in {@link DevicePanel}. It provides
|
* A Label Provider for the {@link TreeViewer} in {@link DevicePanel}. It provides
|
||||||
* labels and images for {@link Device} and {@link Client} objects.
|
* labels and images for {@link IDevice} and {@link Client} objects.
|
||||||
*/
|
*/
|
||||||
private class LabelProvider implements ITableLabelProvider {
|
private class LabelProvider implements ITableLabelProvider {
|
||||||
|
|
||||||
public Image getColumnImage(Object element, int columnIndex) {
|
public Image getColumnImage(Object element, int columnIndex) {
|
||||||
if (columnIndex == DEVICE_COL_SERIAL && element instanceof Device) {
|
if (columnIndex == DEVICE_COL_SERIAL && element instanceof IDevice) {
|
||||||
Device device = (Device)element;
|
IDevice device = (IDevice)element;
|
||||||
if (device.isEmulator()) {
|
if (device.isEmulator()) {
|
||||||
return mEmulatorImage;
|
return mEmulatorImage;
|
||||||
}
|
}
|
||||||
@@ -192,17 +192,17 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
if (element instanceof Device) {
|
if (element instanceof IDevice) {
|
||||||
Device device = (Device)element;
|
IDevice device = (IDevice)element;
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case DEVICE_COL_SERIAL:
|
case DEVICE_COL_SERIAL:
|
||||||
return device.getSerialNumber();
|
return device.getSerialNumber();
|
||||||
case DEVICE_COL_STATE:
|
case DEVICE_COL_STATE:
|
||||||
return getStateString(device);
|
return getStateString(device);
|
||||||
case DEVICE_COL_BUILD: {
|
case DEVICE_COL_BUILD: {
|
||||||
String version = device.getProperty(Device.PROP_BUILD_VERSION);
|
String version = device.getProperty(IDevice.PROP_BUILD_VERSION);
|
||||||
if (version != null) {
|
if (version != null) {
|
||||||
String debuggable = device.getProperty(Device.PROP_DEBUGGABLE);
|
String debuggable = device.getProperty(IDevice.PROP_DEBUGGABLE);
|
||||||
if (device.isEmulator()) {
|
if (device.isEmulator()) {
|
||||||
String avdName = device.getAvdName();
|
String avdName = device.getAvdName();
|
||||||
if (avdName == null) {
|
if (avdName == null) {
|
||||||
@@ -279,15 +279,15 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Classes which implement this interface provide methods that deals
|
* Classes which implement this interface provide methods that deals
|
||||||
* with {@link Device} and {@link Client} selection changes coming from the ui.
|
* with {@link IDevice} and {@link Client} selection changes coming from the ui.
|
||||||
*/
|
*/
|
||||||
public interface IUiSelectionListener {
|
public interface IUiSelectionListener {
|
||||||
/**
|
/**
|
||||||
* Sent when a new {@link Device} and {@link Client} are selected.
|
* Sent when a new {@link IDevice} and {@link Client} are selected.
|
||||||
* @param selectedDevice the selected device. If null, no devices are selected.
|
* @param selectedDevice the selected device. If null, no devices are selected.
|
||||||
* @param selectedClient The selected client. If null, no clients are selected.
|
* @param selectedClient The selected client. If null, no clients are selected.
|
||||||
*/
|
*/
|
||||||
public void selectionChanged(Device selectedDevice, Client selectedClient);
|
public void selectionChanged(IDevice selectedDevice, Client selectedClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -371,7 +371,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
@Override
|
@Override
|
||||||
protected void postCreation() {
|
protected void postCreation() {
|
||||||
// ask for notification of changes in AndroidDebugBridge (a new one is created when
|
// ask for notification of changes in AndroidDebugBridge (a new one is created when
|
||||||
// adb is restarted from a different location), Device and Client objects.
|
// adb is restarted from a different location), IDevice and Client objects.
|
||||||
AndroidDebugBridge.addDebugBridgeChangeListener(this);
|
AndroidDebugBridge.addDebugBridgeChangeListener(this);
|
||||||
AndroidDebugBridge.addDeviceChangeListener(this);
|
AndroidDebugBridge.addDeviceChangeListener(this);
|
||||||
AndroidDebugBridge.addClientChangeListener(this);
|
AndroidDebugBridge.addClientChangeListener(this);
|
||||||
@@ -391,10 +391,10 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the selected {@link Device}. If a {@link Client} is selected, it returns the
|
* Returns the selected {@link IDevice}. If a {@link Client} is selected, it returns the
|
||||||
* Device object containing the client.
|
* IDevice object containing the client.
|
||||||
*/
|
*/
|
||||||
public Device getSelectedDevice() {
|
public IDevice getSelectedDevice() {
|
||||||
return mCurrentDevice;
|
return mCurrentDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -476,9 +476,9 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceConnected(Device)
|
* @see IDeviceChangeListener#deviceConnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device) {
|
public void deviceConnected(IDevice device) {
|
||||||
exec(new Runnable() {
|
exec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (mTree.isDisposed() == false) {
|
if (mTree.isDisposed() == false) {
|
||||||
@@ -511,9 +511,9 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceDisconnected(Device)
|
* @see IDeviceChangeListener#deviceDisconnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceDisconnected(Device device) {
|
public void deviceDisconnected(IDevice device) {
|
||||||
deviceConnected(device);
|
deviceConnected(device);
|
||||||
|
|
||||||
// just in case, we remove it from the list of devices to expand.
|
// just in case, we remove it from the list of devices to expand.
|
||||||
@@ -529,9 +529,9 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
* @param device the device that was updated.
|
* @param device the device that was updated.
|
||||||
* @param changeMask the mask indicating what changed.
|
* @param changeMask the mask indicating what changed.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceChanged(Device)
|
* @see IDeviceChangeListener#deviceChanged(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(final Device device, int changeMask) {
|
public void deviceChanged(final IDevice device, int changeMask) {
|
||||||
boolean expand = false;
|
boolean expand = false;
|
||||||
synchronized (mDevicesToExpand) {
|
synchronized (mDevicesToExpand) {
|
||||||
int index = mDevicesToExpand.indexOf(device);
|
int index = mDevicesToExpand.indexOf(device);
|
||||||
@@ -550,7 +550,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
// client of this particular device was killed. In this case, we'll need to
|
// client of this particular device was killed. In this case, we'll need to
|
||||||
// manually reselect the device.
|
// manually reselect the device.
|
||||||
|
|
||||||
Device selectedDevice = getSelectedDevice();
|
IDevice selectedDevice = getSelectedDevice();
|
||||||
|
|
||||||
// refresh the device
|
// refresh the device
|
||||||
mTreeViewer.refresh(device);
|
mTreeViewer.refresh(device);
|
||||||
@@ -606,7 +606,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
// make sure the device is expanded. Normally the setSelection below
|
// make sure the device is expanded. Normally the setSelection below
|
||||||
// will auto expand, but the children of device may not already exist
|
// will auto expand, but the children of device may not already exist
|
||||||
// at this time. Forcing an expand will make the TreeViewer create them.
|
// at this time. Forcing an expand will make the TreeViewer create them.
|
||||||
Device device = client.getDevice();
|
IDevice device = client.getDevice();
|
||||||
if (mTreeViewer.getExpandedState(device) == false) {
|
if (mTreeViewer.getExpandedState(device) == false) {
|
||||||
mTreeViewer.setExpandedState(device, true);
|
mTreeViewer.setExpandedState(device, true);
|
||||||
}
|
}
|
||||||
@@ -676,7 +676,7 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
* Returns a display string representing the state of the device.
|
* Returns a display string representing the state of the device.
|
||||||
* @param d the device
|
* @param d the device
|
||||||
*/
|
*/
|
||||||
private static String getStateString(Device d) {
|
private static String getStateString(IDevice d) {
|
||||||
DeviceState deviceState = d.getState();
|
DeviceState deviceState = d.getState();
|
||||||
if (deviceState == DeviceState.ONLINE) {
|
if (deviceState == DeviceState.ONLINE) {
|
||||||
return "Online";
|
return "Online";
|
||||||
@@ -710,22 +710,22 @@ public final class DevicePanel extends Panel implements IDebugBridgeChangeListen
|
|||||||
TreeItem[] items = mTree.getSelection();
|
TreeItem[] items = mTree.getSelection();
|
||||||
|
|
||||||
Client client = null;
|
Client client = null;
|
||||||
Device device = null;
|
IDevice device = null;
|
||||||
|
|
||||||
if (items.length == 1) {
|
if (items.length == 1) {
|
||||||
Object object = items[0].getData();
|
Object object = items[0].getData();
|
||||||
if (object instanceof Client) {
|
if (object instanceof Client) {
|
||||||
client = (Client)object;
|
client = (Client)object;
|
||||||
device = client.getDevice();
|
device = client.getDevice();
|
||||||
} else if (object instanceof Device) {
|
} else if (object instanceof IDevice) {
|
||||||
device = (Device)object;
|
device = (IDevice)object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners(device, client);
|
notifyListeners(device, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyListeners(Device selectedDevice, Client selectedClient) {
|
private void notifyListeners(IDevice selectedDevice, Client selectedClient) {
|
||||||
if (selectedDevice != mCurrentDevice || selectedClient != mCurrentClient) {
|
if (selectedDevice != mCurrentDevice || selectedClient != mCurrentClient) {
|
||||||
mCurrentDevice = selectedDevice;
|
mCurrentDevice = selectedDevice;
|
||||||
mCurrentClient = selectedClient;
|
mCurrentClient = selectedClient;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddmuilib;
|
package com.android.ddmuilib;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.EmulatorConsole;
|
import com.android.ddmlib.EmulatorConsole;
|
||||||
import com.android.ddmlib.EmulatorConsole.GsmMode;
|
import com.android.ddmlib.EmulatorConsole.GsmMode;
|
||||||
import com.android.ddmlib.EmulatorConsole.GsmStatus;
|
import com.android.ddmlib.EmulatorConsole.GsmStatus;
|
||||||
@@ -1039,7 +1039,7 @@ public class EmulatorControlPanel extends SelectionDependentPanel {
|
|||||||
* Callback on device selection change.
|
* Callback on device selection change.
|
||||||
* @param device the new selected device
|
* @param device the new selected device
|
||||||
*/
|
*/
|
||||||
public void handleNewDevice(Device device) {
|
public void handleNewDevice(IDevice device) {
|
||||||
if (mParent.isDisposed()) {
|
if (mParent.isDisposed()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddmuilib;
|
package com.android.ddmuilib;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.RawImage;
|
import com.android.ddmlib.RawImage;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class ScreenShotDialog extends Dialog {
|
|||||||
private Label mBusyLabel;
|
private Label mBusyLabel;
|
||||||
private Label mImageLabel;
|
private Label mImageLabel;
|
||||||
private Button mSave;
|
private Button mSave;
|
||||||
private Device mDevice;
|
private IDevice mDevice;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,9 +66,9 @@ public class ScreenShotDialog extends Dialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare and display the dialog.
|
* Prepare and display the dialog.
|
||||||
* @param device The {@link Device} from which to get the screenshot.
|
* @param device The {@link IDevice} from which to get the screenshot.
|
||||||
*/
|
*/
|
||||||
public void open(Device device) {
|
public void open(IDevice device) {
|
||||||
mDevice = device;
|
mDevice = device;
|
||||||
|
|
||||||
Shell parent = getParent();
|
Shell parent = getParent();
|
||||||
|
|||||||
@@ -17,20 +17,20 @@
|
|||||||
package com.android.ddmuilib;
|
package com.android.ddmuilib;
|
||||||
|
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Panel that requires {@link Device}/{@link Client} selection notifications.
|
* A Panel that requires {@link Device}/{@link Client} selection notifications.
|
||||||
*/
|
*/
|
||||||
public abstract class SelectionDependentPanel extends Panel {
|
public abstract class SelectionDependentPanel extends Panel {
|
||||||
private Device mCurrentDevice = null;
|
private IDevice mCurrentDevice = null;
|
||||||
private Client mCurrentClient = null;
|
private Client mCurrentClient = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current {@link Device}.
|
* Returns the current {@link Device}.
|
||||||
* @return the current device or null if none are selected.
|
* @return the current device or null if none are selected.
|
||||||
*/
|
*/
|
||||||
protected final Device getCurrentDevice() {
|
protected final IDevice getCurrentDevice() {
|
||||||
return mCurrentDevice;
|
return mCurrentDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public abstract class SelectionDependentPanel extends Panel {
|
|||||||
* Sent when a new device is selected.
|
* Sent when a new device is selected.
|
||||||
* @param selectedDevice the selected device.
|
* @param selectedDevice the selected device.
|
||||||
*/
|
*/
|
||||||
public final void deviceSelected(Device selectedDevice) {
|
public final void deviceSelected(IDevice selectedDevice) {
|
||||||
if (selectedDevice != mCurrentDevice) {
|
if (selectedDevice != mCurrentDevice) {
|
||||||
mCurrentDevice = selectedDevice;
|
mCurrentDevice = selectedDevice;
|
||||||
deviceSelected();
|
deviceSelected();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddmuilib.explorer;
|
package com.android.ddmuilib.explorer;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.FileListingService;
|
import com.android.ddmlib.FileListingService;
|
||||||
import com.android.ddmlib.IShellOutputReceiver;
|
import com.android.ddmlib.IShellOutputReceiver;
|
||||||
import com.android.ddmlib.SyncService;
|
import com.android.ddmlib.SyncService;
|
||||||
@@ -99,7 +99,7 @@ public class DeviceExplorer extends Panel {
|
|||||||
private Image mPackageImage;
|
private Image mPackageImage;
|
||||||
private Image mOtherImage;
|
private Image mOtherImage;
|
||||||
|
|
||||||
private Device mCurrentDevice;
|
private IDevice mCurrentDevice;
|
||||||
|
|
||||||
private String mDefaultSave;
|
private String mDefaultSave;
|
||||||
|
|
||||||
@@ -631,7 +631,7 @@ public class DeviceExplorer extends Panel {
|
|||||||
/**
|
/**
|
||||||
* Sets the new device to explorer
|
* Sets the new device to explorer
|
||||||
*/
|
*/
|
||||||
public void switchDevice(final Device device) {
|
public void switchDevice(final IDevice device) {
|
||||||
if (device != mCurrentDevice) {
|
if (device != mCurrentDevice) {
|
||||||
mCurrentDevice = device;
|
mCurrentDevice = device;
|
||||||
// now we change the input. but we need to do that in the
|
// now we change the input. but we need to do that in the
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.ddmuilib.log.event;
|
package com.android.ddmuilib.log.event;
|
||||||
|
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.Log.LogLevel;
|
import com.android.ddmlib.Log.LogLevel;
|
||||||
import com.android.ddmlib.log.EventContainer;
|
import com.android.ddmlib.log.EventContainer;
|
||||||
@@ -80,7 +80,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
|
|||||||
|
|
||||||
private IImageLoader mImageLoader;
|
private IImageLoader mImageLoader;
|
||||||
|
|
||||||
private Device mCurrentLoggedDevice;
|
private IDevice mCurrentLoggedDevice;
|
||||||
private String mCurrentLogFile;
|
private String mCurrentLogFile;
|
||||||
private LogReceiver mCurrentLogReceiver;
|
private LogReceiver mCurrentLogReceiver;
|
||||||
private EventLogParser mCurrentEventLogParser;
|
private EventLogParser mCurrentEventLogParser;
|
||||||
@@ -407,7 +407,7 @@ public class EventLogPanel extends TablePanel implements ILogListener,
|
|||||||
* Starts a new logcat and set mCurrentLogCat as the current receiver.
|
* Starts a new logcat and set mCurrentLogCat as the current receiver.
|
||||||
* @param device the device to connect logcat to.
|
* @param device the device to connect logcat to.
|
||||||
*/
|
*/
|
||||||
private void startEventLog(final Device device) {
|
private void startEventLog(final IDevice device) {
|
||||||
if (device == mCurrentLoggedDevice) {
|
if (device == mCurrentLoggedDevice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.ddmuilib.logcat;
|
package com.android.ddmuilib.logcat;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.MultiLineReceiver;
|
import com.android.ddmlib.MultiLineReceiver;
|
||||||
import com.android.ddmlib.Log.LogLevel;
|
import com.android.ddmlib.Log.LogLevel;
|
||||||
@@ -163,7 +163,7 @@ public class LogPanel extends SelectionDependentPanel {
|
|||||||
private int mFilterMode = FILTER_NONE;
|
private int mFilterMode = FILTER_NONE;
|
||||||
|
|
||||||
/** Device currently running logcat */
|
/** Device currently running logcat */
|
||||||
private Device mCurrentLoggedDevice = null;
|
private IDevice mCurrentLoggedDevice = null;
|
||||||
|
|
||||||
private ICommonAction mDeleteFilterAction;
|
private ICommonAction mDeleteFilterAction;
|
||||||
private ICommonAction mEditFilterAction;
|
private ICommonAction mEditFilterAction;
|
||||||
@@ -481,7 +481,7 @@ public class LogPanel extends SelectionDependentPanel {
|
|||||||
* Starts a new logcat and set mCurrentLogCat as the current receiver.
|
* Starts a new logcat and set mCurrentLogCat as the current receiver.
|
||||||
* @param device the device to connect logcat to.
|
* @param device the device to connect logcat to.
|
||||||
*/
|
*/
|
||||||
public void startLogCat(final Device device) {
|
public void startLogCat(final IDevice device) {
|
||||||
if (device == mCurrentLoggedDevice) {
|
if (device == mCurrentLoggedDevice) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.dumpeventlog;
|
package com.android.dumpeventlog;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.Log.ILogOutput;
|
import com.android.ddmlib.Log.ILogOutput;
|
||||||
import com.android.ddmlib.Log.LogLevel;
|
import com.android.ddmlib.Log.LogLevel;
|
||||||
@@ -112,9 +112,9 @@ public class DumpEventLog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now get the devices
|
// now get the devices
|
||||||
Device[] devices = bridge.getDevices();
|
IDevice[] devices = bridge.getDevices();
|
||||||
|
|
||||||
for (Device device : devices) {
|
for (IDevice device : devices) {
|
||||||
if (device.getSerialNumber().equals(args[0])) {
|
if (device.getSerialNumber().equals(args[0])) {
|
||||||
try {
|
try {
|
||||||
grabLogFrom(device, args[1]);
|
grabLogFrom(device, args[1]);
|
||||||
@@ -133,7 +133,7 @@ public class DumpEventLog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void grabLogFrom(Device device, String filePath) throws IOException {
|
private static void grabLogFrom(IDevice device, String filePath) throws IOException {
|
||||||
LogWriter writer = new LogWriter(filePath);
|
LogWriter writer = new LogWriter(filePath);
|
||||||
LogReceiver receiver = new LogReceiver(writer);
|
LogReceiver receiver = new LogReceiver(writer);
|
||||||
writer.setReceiver(receiver);
|
writer.setReceiver(receiver);
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ package com.android.ide.eclipse.adt.internal.launch;
|
|||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.ClientData;
|
import com.android.ddmlib.ClientData;
|
||||||
import com.android.ddmlib.Device;
|
|
||||||
import com.android.ddmlib.IDevice;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.MultiLineReceiver;
|
import com.android.ddmlib.MultiLineReceiver;
|
||||||
@@ -1381,9 +1380,9 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceConnected(Device)
|
* @see IDeviceChangeListener#deviceConnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device) {
|
public void deviceConnected(IDevice device) {
|
||||||
synchronized (sListLock) {
|
synchronized (sListLock) {
|
||||||
// look if there's an app waiting for a device
|
// look if there's an app waiting for a device
|
||||||
if (mWaitingForEmulatorLaunches.size() > 0) {
|
if (mWaitingForEmulatorLaunches.size() > 0) {
|
||||||
@@ -1415,10 +1414,10 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceDisconnected(Device)
|
* @see IDeviceChangeListener#deviceDisconnected(IDevice)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void deviceDisconnected(Device device) {
|
public void deviceDisconnected(IDevice device) {
|
||||||
// any pending launch on this device must be canceled.
|
// any pending launch on this device must be canceled.
|
||||||
String message = "%1$s disconnected! Cancelling '%2$s'!";
|
String message = "%1$s disconnected! Cancelling '%2$s'!";
|
||||||
synchronized (sListLock) {
|
synchronized (sListLock) {
|
||||||
@@ -1451,9 +1450,9 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
|
|||||||
* @param device the device that was updated.
|
* @param device the device that was updated.
|
||||||
* @param changeMask the mask indicating what changed.
|
* @param changeMask the mask indicating what changed.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceChanged(Device, int)
|
* @see IDeviceChangeListener#deviceChanged(IDevice, int)
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(Device device, int changeMask) {
|
public void deviceChanged(IDevice device, int changeMask) {
|
||||||
// We could check if any starting device we care about is now ready, but we can wait for
|
// We could check if any starting device we care about is now ready, but we can wait for
|
||||||
// its home app to show up, so...
|
// its home app to show up, so...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,10 +18,9 @@ package com.android.ide.eclipse.adt.internal.launch;
|
|||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.Device;
|
|
||||||
import com.android.ddmlib.IDevice;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
||||||
import com.android.ddmlib.Device.DeviceState;
|
import com.android.ddmlib.IDevice.DeviceState;
|
||||||
import com.android.ddmuilib.IImageLoader;
|
import com.android.ddmuilib.IImageLoader;
|
||||||
import com.android.ddmuilib.ImageHelper;
|
import com.android.ddmuilib.ImageHelper;
|
||||||
import com.android.ddmuilib.TableHelper;
|
import com.android.ddmuilib.TableHelper;
|
||||||
@@ -99,7 +98,7 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
private boolean mDisableAvdSelectionChange = false;
|
private boolean mDisableAvdSelectionChange = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic Content Provider for a table full of {@link Device} objects. The input is
|
* Basic Content Provider for a table full of {@link IDevice} objects. The input is
|
||||||
* a {@link AndroidDebugBridge}.
|
* a {@link AndroidDebugBridge}.
|
||||||
*/
|
*/
|
||||||
private class ContentProvider implements IStructuredContentProvider {
|
private class ContentProvider implements IStructuredContentProvider {
|
||||||
@@ -123,13 +122,13 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A Label Provider for the {@link TableViewer} in {@link DeviceChooserDialog}.
|
* A Label Provider for the {@link TableViewer} in {@link DeviceChooserDialog}.
|
||||||
* It provides labels and images for {@link Device} objects.
|
* It provides labels and images for {@link IDevice} objects.
|
||||||
*/
|
*/
|
||||||
private class LabelProvider implements ITableLabelProvider {
|
private class LabelProvider implements ITableLabelProvider {
|
||||||
|
|
||||||
public Image getColumnImage(Object element, int columnIndex) {
|
public Image getColumnImage(Object element, int columnIndex) {
|
||||||
if (element instanceof Device) {
|
if (element instanceof IDevice) {
|
||||||
Device device = (Device)element;
|
IDevice device = (IDevice)element;
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return device.isEmulator() ? mEmulatorImage : mDeviceImage;
|
return device.isEmulator() ? mEmulatorImage : mDeviceImage;
|
||||||
@@ -175,8 +174,8 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
if (element instanceof Device) {
|
if (element instanceof IDevice) {
|
||||||
Device device = (Device)element;
|
IDevice device = (IDevice)element;
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return device.getSerialNumber();
|
return device.getSerialNumber();
|
||||||
@@ -514,7 +513,7 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
* Returns a display string representing the state of the device.
|
* Returns a display string representing the state of the device.
|
||||||
* @param d the device
|
* @param d the device
|
||||||
*/
|
*/
|
||||||
private static String getStateString(Device d) {
|
private static String getStateString(IDevice d) {
|
||||||
DeviceState deviceState = d.getState();
|
DeviceState deviceState = d.getState();
|
||||||
if (deviceState == DeviceState.ONLINE) {
|
if (deviceState == DeviceState.ONLINE) {
|
||||||
return "Online";
|
return "Online";
|
||||||
@@ -533,9 +532,9 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceConnected(Device)
|
* @see IDeviceChangeListener#deviceConnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device) {
|
public void deviceConnected(IDevice device) {
|
||||||
final DeviceChooserDialog dialog = this;
|
final DeviceChooserDialog dialog = this;
|
||||||
exec(new Runnable() {
|
exec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -565,9 +564,9 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceDisconnected(Device)
|
* @see IDeviceChangeListener#deviceDisconnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceDisconnected(Device device) {
|
public void deviceDisconnected(IDevice device) {
|
||||||
deviceConnected(device);
|
deviceConnected(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,10 +577,10 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
* @param device the device that was updated.
|
* @param device the device that was updated.
|
||||||
* @param changeMask the mask indicating what changed.
|
* @param changeMask the mask indicating what changed.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceChanged(Device, int)
|
* @see IDeviceChangeListener#deviceChanged(IDevice, int)
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(final Device device, int changeMask) {
|
public void deviceChanged(final IDevice device, int changeMask) {
|
||||||
if ((changeMask & (Device.CHANGE_STATE | Device.CHANGE_BUILD_INFO)) != 0) {
|
if ((changeMask & (IDevice.CHANGE_STATE | IDevice.CHANGE_BUILD_INFO)) != 0) {
|
||||||
final DeviceChooserDialog dialog = this;
|
final DeviceChooserDialog dialog = this;
|
||||||
exec(new Runnable() {
|
exec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -663,15 +662,15 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
} else {
|
} else {
|
||||||
int index = mDeviceTable.getSelectionIndex();
|
int index = mDeviceTable.getSelectionIndex();
|
||||||
Object data = mViewer.getElementAt(index);
|
Object data = mViewer.getElementAt(index);
|
||||||
if (data instanceof Device) {
|
if (data instanceof IDevice) {
|
||||||
handleSelection((Device)data);
|
handleSelection((IDevice)data);
|
||||||
} else {
|
} else {
|
||||||
handleSelection(null);
|
handleSelection(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleSelection(Device device) {
|
private void handleSelection(IDevice device) {
|
||||||
mResponse.setDeviceToUse(device);
|
mResponse.setDeviceToUse(device);
|
||||||
enableOkButton();
|
enableOkButton();
|
||||||
}
|
}
|
||||||
@@ -686,9 +685,9 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
if (mDeviceTable.getSelectionCount() == 0) {
|
if (mDeviceTable.getSelectionCount() == 0) {
|
||||||
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
|
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
|
||||||
|
|
||||||
Device[] devices = bridge.getDevices();
|
IDevice[] devices = bridge.getDevices();
|
||||||
|
|
||||||
for (Device device : devices) {
|
for (IDevice device : devices) {
|
||||||
Client[] clients = device.getClients();
|
Client[] clients = device.getClients();
|
||||||
|
|
||||||
for (Client client : clients) {
|
for (Client client : clients) {
|
||||||
@@ -724,9 +723,9 @@ public class DeviceChooserDialog extends Dialog implements IDeviceChangeListener
|
|||||||
|
|
||||||
// loop through all the Avd and put the one that are not running in the list.
|
// loop through all the Avd and put the one that are not running in the list.
|
||||||
if (mFullAvdList != null) {
|
if (mFullAvdList != null) {
|
||||||
Device[] devices = AndroidDebugBridge.getBridge().getDevices();
|
IDevice[] devices = AndroidDebugBridge.getBridge().getDevices();
|
||||||
avdLoop: for (AvdInfo info : mFullAvdList) {
|
avdLoop: for (AvdInfo info : mFullAvdList) {
|
||||||
for (Device d : devices) {
|
for (IDevice d : devices) {
|
||||||
if (info.getName().equals(d.getAvdName())) {
|
if (info.getName().equals(d.getAvdName())) {
|
||||||
continue avdLoop;
|
continue avdLoop;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
package com.android.ide.eclipse.adt.internal.project;
|
package com.android.ide.eclipse.adt.internal.project;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
|
||||||
import com.android.ddmlib.IDevice;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDebugBridgeChangeListener;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
||||||
@@ -138,7 +137,7 @@ public class ApkInstallManager implements IDeviceChangeListener, IDebugBridgeCha
|
|||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceDisconnected(com.android.ddmlib.Device)
|
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceDisconnected(com.android.ddmlib.Device)
|
||||||
*/
|
*/
|
||||||
public void deviceDisconnected(Device device) {
|
public void deviceDisconnected(IDevice device) {
|
||||||
synchronized (mInstallList) {
|
synchronized (mInstallList) {
|
||||||
for (int i = 0 ; i < mInstallList.size() ;) {
|
for (int i = 0 ; i < mInstallList.size() ;) {
|
||||||
ApkInstall install = mInstallList.get(i);
|
ApkInstall install = mInstallList.get(i);
|
||||||
@@ -174,7 +173,7 @@ public class ApkInstallManager implements IDeviceChangeListener, IDebugBridgeCha
|
|||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceChanged(com.android.ddmlib.Device, int)
|
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceChanged(com.android.ddmlib.Device, int)
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(Device device, int changeMask) {
|
public void deviceChanged(IDevice device, int changeMask) {
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +182,7 @@ public class ApkInstallManager implements IDeviceChangeListener, IDebugBridgeCha
|
|||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceConnected(com.android.ddmlib.Device)
|
* @see com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener#deviceConnected(com.android.ddmlib.Device)
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device) {
|
public void deviceConnected(IDevice device) {
|
||||||
// nothing to do.
|
// nothing to do.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ package com.android.ide.eclipse.ddms;
|
|||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.DdmPreferences;
|
import com.android.ddmlib.DdmPreferences;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
|
||||||
import com.android.ddmlib.Log.ILogOutput;
|
import com.android.ddmlib.Log.ILogOutput;
|
||||||
@@ -77,7 +77,7 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
/** Image loader object */
|
/** Image loader object */
|
||||||
private ImageLoader mLoader;
|
private ImageLoader mLoader;
|
||||||
|
|
||||||
private Device mCurrentDevice;
|
private IDevice mCurrentDevice;
|
||||||
private Client mCurrentClient;
|
private Client mCurrentClient;
|
||||||
private boolean mListeningToUiSelection = false;
|
private boolean mListeningToUiSelection = false;
|
||||||
|
|
||||||
@@ -96,7 +96,7 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Classes which implement this interface provide methods that deals
|
* Classes which implement this interface provide methods that deals
|
||||||
* with {@link Device} and {@link Client} selectionchanges.
|
* with {@link IDevice} and {@link Client} selectionchanges.
|
||||||
*/
|
*/
|
||||||
public interface ISelectionListener {
|
public interface ISelectionListener {
|
||||||
|
|
||||||
@@ -107,10 +107,10 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
public void selectionChanged(Client selectedClient);
|
public void selectionChanged(Client selectedClient);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when a new {@link Device} is selected.
|
* Sent when a new {@link IDevice} is selected.
|
||||||
* @param selectedDevice the selected device. If null, no devices are selected.
|
* @param selectedDevice the selected device. If null, no devices are selected.
|
||||||
*/
|
*/
|
||||||
public void selectionChanged(Device selectedDevice);
|
public void selectionChanged(IDevice selectedDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -365,9 +365,9 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceConnected(Device)
|
* @see IDeviceChangeListener#deviceConnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceConnected(Device device) {
|
public void deviceConnected(IDevice device) {
|
||||||
// if we are listening to selection coming from the ui, then we do nothing, as
|
// if we are listening to selection coming from the ui, then we do nothing, as
|
||||||
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
||||||
// selection notification through our implementation of IUiSelectionListener.
|
// selection notification through our implementation of IUiSelectionListener.
|
||||||
@@ -384,9 +384,9 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
* This is sent from a non UI thread.
|
* This is sent from a non UI thread.
|
||||||
* @param device the new device.
|
* @param device the new device.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceDisconnected(Device)
|
* @see IDeviceChangeListener#deviceDisconnected(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceDisconnected(Device device) {
|
public void deviceDisconnected(IDevice device) {
|
||||||
// if we are listening to selection coming from the ui, then we do nothing, as
|
// if we are listening to selection coming from the ui, then we do nothing, as
|
||||||
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
||||||
// selection notification through our implementation of IUiSelectionListener.
|
// selection notification through our implementation of IUiSelectionListener.
|
||||||
@@ -397,16 +397,16 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
|
AndroidDebugBridge bridge = AndroidDebugBridge.getBridge();
|
||||||
if (bridge != null) {
|
if (bridge != null) {
|
||||||
// get the device list
|
// get the device list
|
||||||
Device[] devices = bridge.getDevices();
|
IDevice[] devices = bridge.getDevices();
|
||||||
|
|
||||||
// check if we still have devices
|
// check if we still have devices
|
||||||
if (devices.length == 0) {
|
if (devices.length == 0) {
|
||||||
handleDefaultSelection((Device)null);
|
handleDefaultSelection((IDevice)null);
|
||||||
} else {
|
} else {
|
||||||
handleDefaultSelection(devices[0]);
|
handleDefaultSelection(devices[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
handleDefaultSelection((Device)null);
|
handleDefaultSelection((IDevice)null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,9 +419,9 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
* @param device the device that was updated.
|
* @param device the device that was updated.
|
||||||
* @param changeMask the mask indicating what changed.
|
* @param changeMask the mask indicating what changed.
|
||||||
*
|
*
|
||||||
* @see IDeviceChangeListener#deviceChanged(Device)
|
* @see IDeviceChangeListener#deviceChanged(IDevice)
|
||||||
*/
|
*/
|
||||||
public void deviceChanged(Device device, int changeMask) {
|
public void deviceChanged(IDevice device, int changeMask) {
|
||||||
// if we are listening to selection coming from the ui, then we do nothing, as
|
// if we are listening to selection coming from the ui, then we do nothing, as
|
||||||
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
// any change in the devices/clients, will be handled by the UI, and we'll receive
|
||||||
// selection notification through our implementation of IUiSelectionListener.
|
// selection notification through our implementation of IUiSelectionListener.
|
||||||
@@ -453,11 +453,11 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when a new {@link Device} and {@link Client} are selected.
|
* Sent when a new {@link IDevice} and {@link Client} are selected.
|
||||||
* @param selectedDevice the selected device. If null, no devices are selected.
|
* @param selectedDevice the selected device. If null, no devices are selected.
|
||||||
* @param selectedClient The selected client. If null, no clients are selected.
|
* @param selectedClient The selected client. If null, no clients are selected.
|
||||||
*/
|
*/
|
||||||
public synchronized void selectionChanged(Device selectedDevice, Client selectedClient) {
|
public synchronized void selectionChanged(IDevice selectedDevice, Client selectedClient) {
|
||||||
if (mCurrentDevice != selectedDevice) {
|
if (mCurrentDevice != selectedDevice) {
|
||||||
mCurrentDevice = selectedDevice;
|
mCurrentDevice = selectedDevice;
|
||||||
|
|
||||||
@@ -478,10 +478,10 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles a default selection of a {@link Device} and {@link Client}.
|
* Handles a default selection of a {@link IDevice} and {@link Client}.
|
||||||
* @param device the selected device
|
* @param device the selected device
|
||||||
*/
|
*/
|
||||||
private void handleDefaultSelection(final Device device) {
|
private void handleDefaultSelection(final IDevice device) {
|
||||||
// because the listener expect to receive this from the UI thread, and this is called
|
// because the listener expect to receive this from the UI thread, and this is called
|
||||||
// from the AndroidDebugBridge notifications, we need to run this in the UI thread.
|
// from the AndroidDebugBridge notifications, we need to run this in the UI thread.
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ package com.android.ide.eclipse.ddms.views;
|
|||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.ClientData;
|
import com.android.ddmlib.ClientData;
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmuilib.DevicePanel;
|
import com.android.ddmuilib.DevicePanel;
|
||||||
import com.android.ddmuilib.ScreenShotDialog;
|
import com.android.ddmuilib.ScreenShotDialog;
|
||||||
import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
|
import com.android.ddmuilib.DevicePanel.IUiSelectionListener;
|
||||||
@@ -243,11 +243,11 @@ public class DeviceView extends ViewPart implements IUiSelectionListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sent when a new {@link Device} and {@link Client} are selected.
|
* Sent when a new {@link IDevice} and {@link Client} are selected.
|
||||||
* @param selectedDevice the selected device. If null, no devices are selected.
|
* @param selectedDevice the selected device. If null, no devices are selected.
|
||||||
* @param selectedClient The selected client. If null, no clients are selected.
|
* @param selectedClient The selected client. If null, no clients are selected.
|
||||||
*/
|
*/
|
||||||
public void selectionChanged(Device selectedDevice, Client selectedClient) {
|
public void selectionChanged(IDevice selectedDevice, Client selectedClient) {
|
||||||
// update the buttons
|
// update the buttons
|
||||||
doSelectionChanged(selectedClient);
|
doSelectionChanged(selectedClient);
|
||||||
doSelectionChanged(selectedDevice);
|
doSelectionChanged(selectedDevice);
|
||||||
@@ -289,7 +289,7 @@ public class DeviceView extends ViewPart implements IUiSelectionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doSelectionChanged(Device selectedDevice) {
|
private void doSelectionChanged(IDevice selectedDevice) {
|
||||||
mCaptureAction.setEnabled(selectedDevice != null);
|
mCaptureAction.setEnabled(selectedDevice != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.ide.eclipse.ddms.views;
|
package com.android.ide.eclipse.ddms.views;
|
||||||
|
|
||||||
import com.android.ddmlib.Client;
|
import com.android.ddmlib.Client;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmuilib.explorer.DeviceExplorer;
|
import com.android.ddmuilib.explorer.DeviceExplorer;
|
||||||
import com.android.ide.eclipse.ddms.CommonAction;
|
import com.android.ide.eclipse.ddms.CommonAction;
|
||||||
import com.android.ide.eclipse.ddms.DdmsPlugin;
|
import com.android.ide.eclipse.ddms.DdmsPlugin;
|
||||||
@@ -26,6 +26,7 @@ import com.android.ide.eclipse.ddms.DdmsPlugin.ISelectionListener;
|
|||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.IToolBarManager;
|
import org.eclipse.jface.action.IToolBarManager;
|
||||||
import org.eclipse.jface.action.Separator;
|
import org.eclipse.jface.action.Separator;
|
||||||
|
import org.eclipse.swt.graphics.Device;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
@@ -151,7 +152,7 @@ public class FileExplorerView extends ViewPart implements ISelectionListener {
|
|||||||
* Sent when a new {@link Device} is selected.
|
* Sent when a new {@link Device} is selected.
|
||||||
* @param selectedDevice the selected device.
|
* @param selectedDevice the selected device.
|
||||||
*/
|
*/
|
||||||
public void selectionChanged(Device selectedDevice) {
|
public void selectionChanged(IDevice selectedDevice) {
|
||||||
mExplorer.switchDevice(selectedDevice);
|
mExplorer.switchDevice(selectedDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,13 @@
|
|||||||
|
|
||||||
package com.android.ide.eclipse.ddms.views;
|
package com.android.ide.eclipse.ddms.views;
|
||||||
|
|
||||||
|
import com.android.ddmlib.Client;
|
||||||
|
import com.android.ddmlib.IDevice;
|
||||||
|
import com.android.ddmuilib.SelectionDependentPanel;
|
||||||
import com.android.ide.eclipse.ddms.DdmsPlugin;
|
import com.android.ide.eclipse.ddms.DdmsPlugin;
|
||||||
import com.android.ide.eclipse.ddms.DdmsPlugin.ISelectionListener;
|
import com.android.ide.eclipse.ddms.DdmsPlugin.ISelectionListener;
|
||||||
import com.android.ddmlib.Client;
|
|
||||||
import com.android.ddmlib.Device;
|
|
||||||
import com.android.ddmuilib.SelectionDependentPanel;
|
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Device;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -62,7 +63,7 @@ public abstract class SelectionDependentViewPart extends ViewPart implements ISe
|
|||||||
*
|
*
|
||||||
* @see ISelectionListener
|
* @see ISelectionListener
|
||||||
*/
|
*/
|
||||||
public final void selectionChanged(Device selectedDevice) {
|
public final void selectionChanged(IDevice selectedDevice) {
|
||||||
mPanel.deviceSelected(selectedDevice);
|
mPanel.deviceSelected(selectedDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.eventanalyzer;
|
package com.android.eventanalyzer;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.Log.ILogOutput;
|
import com.android.ddmlib.Log.ILogOutput;
|
||||||
import com.android.ddmlib.Log.LogLevel;
|
import com.android.ddmlib.Log.LogLevel;
|
||||||
@@ -253,9 +253,9 @@ public class EventAnalyzer implements ILogListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now get the devices
|
// now get the devices
|
||||||
Device[] devices = bridge.getDevices();
|
IDevice[] devices = bridge.getDevices();
|
||||||
|
|
||||||
for (Device device : devices) {
|
for (IDevice device : devices) {
|
||||||
if (device.getSerialNumber().equals(mInputDevice)) {
|
if (device.getSerialNumber().equals(mInputDevice)) {
|
||||||
grabLogFrom(device);
|
grabLogFrom(device);
|
||||||
return;
|
return;
|
||||||
@@ -300,7 +300,7 @@ public class EventAnalyzer implements ILogListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void grabLogFrom(Device device) throws IOException {
|
private void grabLogFrom(IDevice device) throws IOException {
|
||||||
mParser = new EventLogParser();
|
mParser = new EventLogParser();
|
||||||
if (mParser.init(device) == false) {
|
if (mParser.init(device) == false) {
|
||||||
printAndExit("Failed to get event-log-tags from " + device.getSerialNumber(),
|
printAndExit("Failed to get event-log-tags from " + device.getSerialNumber(),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.hierarchyviewer.device;
|
package com.android.hierarchyviewer.device;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.MultiLineReceiver;
|
import com.android.ddmlib.MultiLineReceiver;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ import java.util.regex.Pattern;
|
|||||||
public class DeviceBridge {
|
public class DeviceBridge {
|
||||||
private static AndroidDebugBridge bridge;
|
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;
|
private static int nextLocalPort = Configuration.DEFAULT_SERVER_PORT;
|
||||||
|
|
||||||
public static void initDebugBridge() {
|
public static void initDebugBridge() {
|
||||||
@@ -57,11 +57,11 @@ public class DeviceBridge {
|
|||||||
AndroidDebugBridge.removeDeviceChangeListener(listener);
|
AndroidDebugBridge.removeDeviceChangeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Device[] getDevices() {
|
public static IDevice[] getDevices() {
|
||||||
return bridge.getDevices();
|
return bridge.getDevices();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isViewServerRunning(Device device) {
|
public static boolean isViewServerRunning(IDevice device) {
|
||||||
initDebugBridge();
|
initDebugBridge();
|
||||||
final boolean[] result = new boolean[1];
|
final boolean[] result = new boolean[1];
|
||||||
try {
|
try {
|
||||||
@@ -75,11 +75,11 @@ public class DeviceBridge {
|
|||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean startViewServer(Device device) {
|
public static boolean startViewServer(IDevice device) {
|
||||||
return startViewServer(device, Configuration.DEFAULT_SERVER_PORT);
|
return startViewServer(device, Configuration.DEFAULT_SERVER_PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean startViewServer(Device device, int port) {
|
public static boolean startViewServer(IDevice device, int port) {
|
||||||
initDebugBridge();
|
initDebugBridge();
|
||||||
final boolean[] result = new boolean[1];
|
final boolean[] result = new boolean[1];
|
||||||
try {
|
try {
|
||||||
@@ -93,7 +93,7 @@ public class DeviceBridge {
|
|||||||
return result[0];
|
return result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean stopViewServer(Device device) {
|
public static boolean stopViewServer(IDevice device) {
|
||||||
initDebugBridge();
|
initDebugBridge();
|
||||||
final boolean[] result = new boolean[1];
|
final boolean[] result = new boolean[1];
|
||||||
try {
|
try {
|
||||||
@@ -116,9 +116,9 @@ public class DeviceBridge {
|
|||||||
* <p/>This starts a port forwarding between a local port and a port on the device.
|
* <p/>This starts a port forwarding between a local port and a port on the device.
|
||||||
* @param device
|
* @param device
|
||||||
*/
|
*/
|
||||||
public static void setupDeviceForward(Device device) {
|
public static void setupDeviceForward(IDevice device) {
|
||||||
synchronized (devicePortMap) {
|
synchronized (devicePortMap) {
|
||||||
if (device.getState() == Device.DeviceState.ONLINE) {
|
if (device.getState() == IDevice.DeviceState.ONLINE) {
|
||||||
int localPort = nextLocalPort++;
|
int localPort = nextLocalPort++;
|
||||||
device.createForward(localPort, Configuration.DEFAULT_SERVER_PORT);
|
device.createForward(localPort, Configuration.DEFAULT_SERVER_PORT);
|
||||||
devicePortMap.put(device, localPort);
|
devicePortMap.put(device, localPort);
|
||||||
@@ -126,7 +126,7 @@ public class DeviceBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void removeDeviceForward(Device device) {
|
public static void removeDeviceForward(IDevice device) {
|
||||||
synchronized (devicePortMap) {
|
synchronized (devicePortMap) {
|
||||||
final Integer localPort = devicePortMap.get(device);
|
final Integer localPort = devicePortMap.get(device);
|
||||||
if (localPort != null) {
|
if (localPort != null) {
|
||||||
@@ -136,7 +136,7 @@ public class DeviceBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getDeviceLocalPort(Device device) {
|
public static int getDeviceLocalPort(IDevice device) {
|
||||||
synchronized (devicePortMap) {
|
synchronized (devicePortMap) {
|
||||||
Integer port = devicePortMap.get(device);
|
Integer port = devicePortMap.get(device);
|
||||||
if (port != null) {
|
if (port != null) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.hierarchyviewer.scene;
|
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.Configuration;
|
||||||
import com.android.hierarchyviewer.device.Window;
|
import com.android.hierarchyviewer.device.Window;
|
||||||
import com.android.hierarchyviewer.device.DeviceBridge;
|
import com.android.hierarchyviewer.device.DeviceBridge;
|
||||||
@@ -31,7 +31,7 @@ import java.net.Socket;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
public class CaptureLoader {
|
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;
|
Socket socket = null;
|
||||||
BufferedInputStream in = null;
|
BufferedInputStream in = null;
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.hierarchyviewer.scene;
|
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.Window;
|
||||||
import com.android.hierarchyviewer.device.DeviceBridge;
|
import com.android.hierarchyviewer.device.DeviceBridge;
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ import java.io.BufferedReader;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
public class ProfilesLoader {
|
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;
|
Socket socket = null;
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.hierarchyviewer.scene;
|
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.DeviceBridge;
|
||||||
import com.android.hierarchyviewer.device.Window;
|
import com.android.hierarchyviewer.device.Window;
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class ViewHierarchyLoader {
|
public class ViewHierarchyLoader {
|
||||||
@SuppressWarnings("empty-statement")
|
@SuppressWarnings("empty-statement")
|
||||||
public static ViewHierarchyScene loadScene(Device device, Window window) {
|
public static ViewHierarchyScene loadScene(IDevice device, Window window) {
|
||||||
ViewHierarchyScene scene = new ViewHierarchyScene();
|
ViewHierarchyScene scene = new ViewHierarchyScene();
|
||||||
|
|
||||||
// Read the views tree
|
// Read the views tree
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.hierarchyviewer.scene;
|
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.Window;
|
||||||
import com.android.hierarchyviewer.device.DeviceBridge;
|
import com.android.hierarchyviewer.device.DeviceBridge;
|
||||||
|
|
||||||
@@ -27,15 +27,15 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
|
|
||||||
public class ViewManager {
|
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);
|
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);
|
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;
|
Socket socket = null;
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.hierarchyviewer.scene;
|
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.DeviceBridge;
|
||||||
import com.android.hierarchyviewer.device.Window;
|
import com.android.hierarchyviewer.device.Window;
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ import java.net.Socket;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class WindowsLoader {
|
public class WindowsLoader {
|
||||||
public static Window[] loadWindows(Device device) {
|
public static Window[] loadWindows(IDevice device) {
|
||||||
Socket socket = null;
|
Socket socket = null;
|
||||||
BufferedReader in = null;
|
BufferedReader in = null;
|
||||||
BufferedWriter out = null;
|
BufferedWriter out = null;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.android.hierarchyviewer.ui;
|
package com.android.hierarchyviewer.ui;
|
||||||
|
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.RawImage;
|
import com.android.ddmlib.RawImage;
|
||||||
import com.android.hierarchyviewer.util.WorkerThread;
|
import com.android.hierarchyviewer.util.WorkerThread;
|
||||||
import com.android.hierarchyviewer.scene.ViewNode;
|
import com.android.hierarchyviewer.scene.ViewNode;
|
||||||
@@ -51,7 +51,7 @@ import java.util.concurrent.ExecutionException;
|
|||||||
|
|
||||||
class ScreenViewer extends JPanel implements ActionListener {
|
class ScreenViewer extends JPanel implements ActionListener {
|
||||||
private final Workspace workspace;
|
private final Workspace workspace;
|
||||||
private final Device device;
|
private final IDevice device;
|
||||||
|
|
||||||
private GetScreenshotTask task;
|
private GetScreenshotTask task;
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
@@ -73,7 +73,7 @@ class ScreenViewer extends JPanel implements ActionListener {
|
|||||||
|
|
||||||
private JSlider zoomSlider;
|
private JSlider zoomSlider;
|
||||||
|
|
||||||
ScreenViewer(Workspace workspace, Device device, int spacing) {
|
ScreenViewer(Workspace workspace, IDevice device, int spacing) {
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
setOpaque(false);
|
setOpaque(false);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.hierarchyviewer.ui;
|
package com.android.hierarchyviewer.ui;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
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.DeviceBridge;
|
||||||
import com.android.hierarchyviewer.device.Window;
|
import com.android.hierarchyviewer.device.Window;
|
||||||
import com.android.hierarchyviewer.laf.UnifiedContentBorder;
|
import com.android.hierarchyviewer.laf.UnifiedContentBorder;
|
||||||
@@ -147,7 +147,7 @@ public class Workspace extends JFrame {
|
|||||||
private DevicesTableModel devicesTableModel;
|
private DevicesTableModel devicesTableModel;
|
||||||
private WindowsTableModel windowsTableModel;
|
private WindowsTableModel windowsTableModel;
|
||||||
|
|
||||||
private Device currentDevice;
|
private IDevice currentDevice;
|
||||||
private Window currentWindow = Window.FOCUSED_WINDOW;
|
private Window currentWindow = Window.FOCUSED_WINDOW;
|
||||||
|
|
||||||
private JButton displayNodeButton;
|
private JButton displayNodeButton;
|
||||||
@@ -235,7 +235,7 @@ public class Workspace extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
devicesTableModel = new DevicesTableModel();
|
devicesTableModel = new DevicesTableModel();
|
||||||
for (Device device : DeviceBridge.getDevices()) {
|
for (IDevice device : DeviceBridge.getDevices()) {
|
||||||
DeviceBridge.setupDeviceForward(device);
|
DeviceBridge.setupDeviceForward(device);
|
||||||
devicesTableModel.addDevice(device);
|
devicesTableModel.addDevice(device);
|
||||||
}
|
}
|
||||||
@@ -926,7 +926,7 @@ public class Workspace extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void cleanupDevices() {
|
public void cleanupDevices() {
|
||||||
for (Device device : devicesTableModel.getDevices()) {
|
for (IDevice device : devicesTableModel.getDevices()) {
|
||||||
DeviceBridge.removeDeviceForward(device);
|
DeviceBridge.removeDeviceForward(device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1293,10 +1293,10 @@ public class Workspace extends JFrame {
|
|||||||
private class DevicesTableModel extends DefaultTableModel implements
|
private class DevicesTableModel extends DefaultTableModel implements
|
||||||
AndroidDebugBridge.IDeviceChangeListener {
|
AndroidDebugBridge.IDeviceChangeListener {
|
||||||
|
|
||||||
private ArrayList<Device> devices;
|
private ArrayList<IDevice> devices;
|
||||||
|
|
||||||
private DevicesTableModel() {
|
private DevicesTableModel() {
|
||||||
devices = new ArrayList<Device>();
|
devices = new ArrayList<IDevice>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1320,7 +1320,7 @@ public class Workspace extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void deviceConnected(final Device device) {
|
public void deviceConnected(final IDevice device) {
|
||||||
DeviceBridge.setupDeviceForward(device);
|
DeviceBridge.setupDeviceForward(device);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
@@ -1331,7 +1331,7 @@ public class Workspace extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void deviceDisconnected(final Device device) {
|
public void deviceDisconnected(final IDevice device) {
|
||||||
DeviceBridge.removeDeviceForward(device);
|
DeviceBridge.removeDeviceForward(device);
|
||||||
|
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
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)) {
|
if (!devices.contains(device)) {
|
||||||
devices.add(device);
|
devices.add(device);
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeDevice(Device device) {
|
public void removeDevice(IDevice device) {
|
||||||
if (device.equals(currentDevice)) {
|
if (device.equals(currentDevice)) {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
@@ -1360,12 +1360,12 @@ public class Workspace extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@WorkerThread
|
@WorkerThread
|
||||||
public void deviceChanged(Device device, int changeMask) {
|
public void deviceChanged(IDevice device, int changeMask) {
|
||||||
if ((changeMask & Device.CHANGE_STATE) != 0 &&
|
if ((changeMask & IDevice.CHANGE_STATE) != 0 &&
|
||||||
device.isOnline()) {
|
device.isOnline()) {
|
||||||
// if the device state changed and it's now online, we set up its port forwarding.
|
// if the device state changed and it's now online, we set up its port forwarding.
|
||||||
DeviceBridge.setupDeviceForward(device);
|
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
|
// if the changed device is the current one and the client list changed, we update
|
||||||
// the UI.
|
// the UI.
|
||||||
loadWindows().execute();
|
loadWindows().execute();
|
||||||
@@ -1378,12 +1378,12 @@ public class Workspace extends JFrame {
|
|||||||
return devices == null ? 0 : devices.size();
|
return devices == null ? 0 : devices.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Device getDevice(int index) {
|
public IDevice getDevice(int index) {
|
||||||
return index < devices.size() ? devices.get(index) : null;
|
return index < devices.size() ? devices.get(index) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Device[] getDevices() {
|
public IDevice[] getDevices() {
|
||||||
return devices.toArray(new Device[devices.size()]);
|
return devices.toArray(new IDevice[devices.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
package com.android.screenshot;
|
package com.android.screenshot;
|
||||||
|
|
||||||
import com.android.ddmlib.AndroidDebugBridge;
|
import com.android.ddmlib.AndroidDebugBridge;
|
||||||
import com.android.ddmlib.Device;
|
import com.android.ddmlib.IDevice;
|
||||||
import com.android.ddmlib.Log;
|
import com.android.ddmlib.Log;
|
||||||
import com.android.ddmlib.RawImage;
|
import com.android.ddmlib.RawImage;
|
||||||
import com.android.ddmlib.Log.ILogOutput;
|
import com.android.ddmlib.Log.ILogOutput;
|
||||||
@@ -133,16 +133,16 @@ public class Screenshot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// now get the devices
|
// now get the devices
|
||||||
Device[] devices = bridge.getDevices();
|
IDevice[] devices = bridge.getDevices();
|
||||||
|
|
||||||
if (devices.length == 0) {
|
if (devices.length == 0) {
|
||||||
printAndExit("No devices found!", true /* terminate */);
|
printAndExit("No devices found!", true /* terminate */);
|
||||||
}
|
}
|
||||||
|
|
||||||
Device target = null;
|
IDevice target = null;
|
||||||
|
|
||||||
if (emulator || device) {
|
if (emulator || device) {
|
||||||
for (Device d : devices) {
|
for (IDevice d : devices) {
|
||||||
// this test works because emulator and device can't both be true at the same
|
// this test works because emulator and device can't both be true at the same
|
||||||
// time.
|
// time.
|
||||||
if (d.isEmulator() == emulator) {
|
if (d.isEmulator() == emulator) {
|
||||||
@@ -159,7 +159,7 @@ public class Screenshot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (serial != null) {
|
} else if (serial != null) {
|
||||||
for (Device d : devices) {
|
for (IDevice d : devices) {
|
||||||
if (serial.equals(d.getSerialNumber())) {
|
if (serial.equals(d.getSerialNumber())) {
|
||||||
target = d;
|
target = d;
|
||||||
break;
|
break;
|
||||||
@@ -192,7 +192,7 @@ public class Screenshot {
|
|||||||
/*
|
/*
|
||||||
* Grab an image from an ADB-connected device.
|
* Grab an image from an ADB-connected device.
|
||||||
*/
|
*/
|
||||||
private static void getDeviceImage(Device device, String filepath, boolean landscape)
|
private static void getDeviceImage(IDevice device, String filepath, boolean landscape)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
RawImage rawImage;
|
RawImage rawImage;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user