本文整理汇总了Java中com.android.ddmlib.AndroidDebugBridge.addDebugBridgeChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidDebugBridge.addDebugBridgeChangeListener方法的具体用法?Java AndroidDebugBridge.addDebugBridgeChangeListener怎么用?Java AndroidDebugBridge.addDebugBridgeChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.ddmlib.AndroidDebugBridge
的用法示例。
在下文中一共展示了AndroidDebugBridge.addDebugBridgeChangeListener方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: observeForDeviceChange
import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
* Observe for deviec state changes
*/
private void observeForDeviceChange() {
deviceSelectionListener =
new DeviceContext.DeviceSelectionListener() {
@Override
public void deviceSelected(@Nullable IDevice device) {
notifyDeviceUpdated(device);
}
@Override
public void deviceChanged(@NotNull IDevice device, int changeMask) {
if ((changeMask & IDevice.CHANGE_STATE) == IDevice.CHANGE_STATE) {
notifyDeviceUpdated(device);
}
}
@Override
public void clientSelected(@Nullable final Client c) {
}
};
deviceContext.addListener(deviceSelectionListener, this);
AndroidDebugBridge.addClientChangeListener(this);
AndroidDebugBridge.addDeviceChangeListener(this);
AndroidDebugBridge.addDebugBridgeChangeListener(this);
}
示例2: waitForDeviceConnected
import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public IDevice waitForDeviceConnected(final String serialNumber, final long timeout) throws InterruptedException {
id = serialNumber;
Console.printLogMessage(serialNumber, "waitForDeviceConnected(" + serialNumber + " to be connected start");
IDevice [] devices = AndroidDebugBridge.getBridge().getDevices();
if (devices != null) {
for (IDevice device : devices) {
if (device.getSerialNumber() == serialNumber) {
Console.printLogMessage("", device.getSerialNumber());
return device;
}
}
}
AndroidDebugBridge.addDebugBridgeChangeListener(DeviceConnectHelper.this);
AndroidDebugBridge.addDeviceChangeListener(DeviceConnectHelper.this);
synchronized (this) {
while (getConnecedDevice(serialNumber) == null) {
Console.printLogMessage("", "wait");
wait(60000);
}
}
Console.printLogMessage(serialNumber, "waitForDeviceConnected(" + serialNumber + " to be connected end");
return getConnecedDevice(serialNumber);
}
示例3: DevicePanel
import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public DevicePanel(@NotNull Project project, @NotNull DeviceContext context) {
myProject = project;
myDeviceContext = context;
myPreferredClients = Maps.newHashMap();
myCandidateClientName = getApplicationName();
Disposer.register(myProject, this);
initializeDeviceCombo();
initializeClientCombo();
AndroidDebugBridge.addDeviceChangeListener(this);
AndroidDebugBridge.addClientChangeListener(this);
AndroidDebugBridge.addDebugBridgeChangeListener(this);
}
示例4: postCreation
import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
@Override
protected void postCreation() {
// ask for notification of changes in AndroidDebugBridge (a new one is created when
// adb is restarted from a different location), IDevice and Client objects.
AndroidDebugBridge.addDebugBridgeChangeListener(this);
AndroidDebugBridge.addDeviceChangeListener(this);
AndroidDebugBridge.addClientChangeListener(this);
}
示例5: startAdb
import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
* This method is executed in a worker thread started in {@link #start()}
*
* @param osLocation
* @param clientSupport
*/
private static void startAdb(String osLocation) {
synchronized (INSTANCE) {
INSTANCE.setState(DeviceManagerState.STARTING);
INSTANCE._osLocation = osLocation;
try {
AndroidDebugBridge.init(false); // true == Mode 1:The library
// monitors the devices and the
// applications running on them.
// false == Mode 2: The library only
// monitors devices
} catch (IllegalStateException e) {
LOG.trace("AndroidDebugBridge.init() has already been called. Caught exception.");
}
AndroidDebugBridge.addClientChangeListener(INSTANCE);
AndroidDebugBridge.addDebugBridgeChangeListener(INSTANCE);
AndroidDebugBridge.addDeviceChangeListener(INSTANCE);
LOG.trace("Attempting to connect to the currently running adb server");
AndroidDebugBridge.createBridge();
// FIXME: make this more fault tolerant (i.e. handle the condition
// where adb is not currently running)
// if (!AndroidDebugBridge.getBridge().isConnected()) {
// LOG.debug("failed to connect. attempting to start a server with "
// + osLocation);
// AndroidDebugBridge.createBridge(osLocation, false);
// if (!AndroidDebugBridge.getBridge().isConnected()) {
// LOG.warn("failed to connect!");
// stopAdb();
// INSTANCE.setState(DeviceManagerState.FAILED);
// return;
// }
// }
INSTANCE.setState(DeviceManagerState.RUNNING);
}
}