Lines Matching full:device
17 package com.android.hierarchyviewer.device;
66 public static boolean isViewServerRunning(IDevice device) {
70 if (device.isOnline()) {
71 device.executeShellCommand(buildIsServerRunningShellCommand(),
80 public static boolean startViewServer(IDevice device) {
81 return startViewServer(device, Configuration.DEFAULT_SERVER_PORT);
84 public static boolean startViewServer(IDevice device, int port) {
88 if (device.isOnline()) {
89 device.executeShellCommand(buildStartServerShellCommand(port),
98 public static boolean stopViewServer(IDevice device) {
102 if (device.isOnline()) {
103 device.executeShellCommand(buildStopServerShellCommand(),
117 * Sets up a just-connected device to work with the view server.
118 * <p/>This starts a port forwarding between a local port and a port on the device.
119 * @param device
121 public static void setupDeviceForward(IDevice device) {
123 if (device.getState() == IDevice.DeviceState.ONLINE) {
126 device.createForward(localPort, Configuration.DEFAULT_SERVER_PORT);
127 devicePortMap.put(device, localPort);
129 Log.e("hierarchy", "Timeout setting up port forwarding for " + device);
132 "Adb rejected forward command for device %1$s: %2$s",
133 device, e.getMessage()));
136 "Failed to create forward for device %1$s: %2$s",
137 device, e.getMessage()));
143 public static void removeDeviceForward(IDevice device) {
145 final Integer localPort = devicePortMap.get(device);
148 device.removeForward(localPort, Configuration.DEFAULT_SERVER_PORT);
149 devicePortMap.remove(device);
151 Log.e("hierarchy", "Timeout removing port forwarding for " + device);
154 "Adb rejected remove-forward command for device %1$s: %2$s",
155 device, e.getMessage()));
158 "Failed to remove forward for device %1$s: %2$s",
159 device, e.getMessage()));
165 public static int getDeviceLocalPort(IDevice device) {
167 Integer port = devicePortMap.get(device);
172 Log.e("hierarchy", "Missing forwarded port for " + device.getSerialNumber());