Lines Matching refs:device
17 package com.android.hierarchyviewer.device;
64 public static boolean isViewServerRunning(IDevice device) { in isViewServerRunning() argument
68 if (device.isOnline()) { in isViewServerRunning()
69 device.executeShellCommand(buildIsServerRunningShellCommand(), in isViewServerRunning()
72 if (VersionLoader.loadProtocolVersion(device) > 2) { in isViewServerRunning()
89 public static boolean startViewServer(IDevice device) { in startViewServer() argument
90 return startViewServer(device, Configuration.DEFAULT_SERVER_PORT); in startViewServer()
93 public static boolean startViewServer(IDevice device, int port) { in startViewServer() argument
97 if (device.isOnline()) { in startViewServer()
98 device.executeShellCommand(buildStartServerShellCommand(port), in startViewServer()
113 public static boolean stopViewServer(IDevice device) { in stopViewServer() argument
117 if (device.isOnline()) { in stopViewServer()
118 device.executeShellCommand(buildStopServerShellCommand(), in stopViewServer()
142 public static void setupDeviceForward(IDevice device) { in setupDeviceForward() argument
144 if (device.getState() == IDevice.DeviceState.ONLINE) { in setupDeviceForward()
147 device.createForward(localPort, Configuration.DEFAULT_SERVER_PORT); in setupDeviceForward()
148 devicePortMap.put(device, localPort); in setupDeviceForward()
150 Log.e("hierarchy", "Timeout setting up port forwarding for " + device); in setupDeviceForward()
154 device, e.getMessage())); in setupDeviceForward()
158 device, e.getMessage())); in setupDeviceForward()
164 public static void removeDeviceForward(IDevice device) { in removeDeviceForward() argument
166 final Integer localPort = devicePortMap.get(device); in removeDeviceForward()
169 device.removeForward(localPort, Configuration.DEFAULT_SERVER_PORT); in removeDeviceForward()
170 devicePortMap.remove(device); in removeDeviceForward()
172 Log.e("hierarchy", "Timeout removing port forwarding for " + device); in removeDeviceForward()
176 device, e.getMessage())); in removeDeviceForward()
180 device, e.getMessage())); in removeDeviceForward()
186 public static int getDeviceLocalPort(IDevice device) { in getDeviceLocalPort() argument
188 Integer port = devicePortMap.get(device); in getDeviceLocalPort()
193 Log.e("hierarchy", "Missing forwarded port for " + device.getSerialNumber()); in getDeviceLocalPort()