当前位置: 首页>>代码示例>>Java>>正文


Java AndroidDebugBridge.addDeviceChangeListener方法代码示例

本文整理汇总了Java中com.android.ddmlib.AndroidDebugBridge.addDeviceChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidDebugBridge.addDeviceChangeListener方法的具体用法?Java AndroidDebugBridge.addDeviceChangeListener怎么用?Java AndroidDebugBridge.addDeviceChangeListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.ddmlib.AndroidDebugBridge的用法示例。


在下文中一共展示了AndroidDebugBridge.addDeviceChangeListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:josesamuel,项目名称:logviewer,代码行数:28,代码来源:LogSourceManager.java

示例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);
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:27,代码来源:DeviceConnectHelper.java

示例3: main

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Runs main program.
 */
public static void main(String[] args) {
    try {
        Display display = new Display();
        FileViewer application = new FileViewer();
        Shell shell = application.open(display);
        AndroidDebugBridge.init(true);
        AndroidDebugBridge.createBridge("adb", true);
        AndroidDebugBridge.addDeviceChangeListener(application);
        application.showConnectDialog();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        application.close();
        display.dispose();
        System.exit(0);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:lrscp,项目名称:AndroidFileExplorer,代码行数:24,代码来源:FileViewer.java

示例4: connect

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * 
 * @param adbFilePath
 * @param listener
 * @return
 */
public boolean connect(String adbFilePath, DeviceConnectionListener listener) {
    if (!checkPath(adbFilePath)) {
        Util.DbgLog("Error occured in setting adb binary file path");
        return false;
    }

    if (mIsAdbInitialized) {
        Util.DbgLog("Already connected..");
        return false;
    }

    mDeviceStateListener = listener;

    AndroidDebugBridge.init(false /* no need to support debug*/);
    AndroidDebugBridge.addClientChangeListener(mClientChangeListener);
    AndroidDebugBridge.addDeviceChangeListener(mDeviceChangeListener);
    AndroidDebugBridge.createBridge(adbFilePath, true /* forceNewBridge */);
    mIsAdbInitialized = true;
    return true;
}
 
开发者ID:felixb,项目名称:logcat-gui,代码行数:27,代码来源:AdbWrapper.java

示例5: EmulatorLauncher

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public EmulatorLauncher(AndroidSdk sdk) {
        this.sdk = sdk;
        listener = new AdbListener();
//    AndroidDebugBridge.addDebugBridgeChangeListener(listener);
        AndroidDebugBridge.addDeviceChangeListener(listener);
//    AndroidDebugBridge.addClientChangeListener(listener);
    }
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:8,代码来源:EmulatorLauncher.java

示例6: LogDevicesComboBoxSupport

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
protected LogDevicesComboBoxSupport(LogReader reader) {
    this.reader = reader;

    // get notification for logged devices
    reader.addPropertyChangeListener(WeakListeners.propertyChange(this, reader));

    // get notifications for attached and detached devices
    AndroidDebugBridge.addDeviceChangeListener(this);

    Lookup lookup = Utilities.actionsGlobalContext();
    deviceLookup = lookup.lookupResult(IDevice.class);
    deviceLookup.addLookupListener(this);

    update();
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:16,代码来源:LogDevicesComboBoxSupport.java

示例7: EmulatorManager

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
private EmulatorManager() {
    sdkToolCommandSender = new SdkToolCommandSender();

    // Register the EmulatorManager for device change events so it can keep track of running emulators.
    AndroidDebugBridge.addDeviceChangeListener(this);

    // Get initial device list
    androidDebugBridge = AndroidDebugBridge.getBridge();
    List<IDevice> registeredDevices = getDeviceList();
    for (IDevice device : registeredDevices) {
        deviceConnected(device);
    }
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:14,代码来源:EmulatorManager.java

示例8: registerDeviceListener

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
private void registerDeviceListener() {
  AndroidDebugBridge.addDeviceChangeListener(myDeviceListener);
  Disposer.register(this, new Disposable() {
    @Override
    public void dispose() {
      AndroidDebugBridge.removeDeviceChangeListener(myDeviceListener);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AndroidDataSourcePropertiesDialog.java

示例9: 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);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DevicePanel.java

示例10: 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);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:9,代码来源:DevicePanel.java

示例11: LogCatPidToNameMapper

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
public LogCatPidToNameMapper(IDevice device) {
    mDevice = device;
    mClientChangeListener = constructClientChangeListener();
    AndroidDebugBridge.addClientChangeListener(mClientChangeListener);

    mDeviceChangeListener = constructDeviceChangeListener();
    AndroidDebugBridge.addDeviceChangeListener(mDeviceChangeListener);

    mPidToName = new HashMap<String, String>();

    updateClientList(device);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:13,代码来源:LogCatPidToNameMapper.java

示例12: ServerConnectionManager

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * 
 */
private ServerConnectionManager() {
	devices = new HashMap<String, AndroidDevice>();
	AndroidDebugBridge
			.addDeviceChangeListener(ServerConnectionManager.this);
	AndroidDebugBridge.init(false);
}
 
开发者ID:IPEldorado,项目名称:RemoteResources,代码行数:10,代码来源:ServerConnectionManager.java

示例13: windowOpened

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
@Override
public void windowOpened(WindowEvent e) {
    AndroidDebugBridge.addDeviceChangeListener(this);

    updateDeviceList();
       System.out.println("device number:" + mDevices.size());
}
 
开发者ID:HoneyFish,项目名称:SmartTools,代码行数:8,代码来源:SmartToolsApp.java

示例14: initializeADBConnection

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Initializes the AndroidDebugBridge and registers the TestDeviceManager
 * with the AndroidDebugBridge device change listener. It is recommended
 * that addConnectionListener(TestDeviceConnectionListener) be called with 
 * all listeners before calling this method.
 */
public void initializeADBConnection() {
	
	// Get a device bridge instance. Initialize, create and restart.
	try {
		AndroidDebugBridge.initIfNeeded(false);
	} catch (IllegalStateException ise) {
		ise.printStackTrace();
		System.out.println("The IllegalStateException is not a show " +
		"stopper. It has been handled. This is just debug spew." +
		" Please proceed.");
	}
	bridge = AndroidDebugBridge.getBridge();
	
	if (bridge == null) {		
		bridge = AndroidDebugBridge.createBridge(
                adbPath, 
                false);
	}
	
	// Add the existing devices to the list of devices we are tracking.
	if (bridge.isConnected() && bridge.hasInitialDeviceList()) {
		IDevice[] connectedDevices = bridge.getDevices();
		
		for (int i = 0; i < connectedDevices.length; i++) {
			TestDevice tDevice = new TestDevice(connectedDevices[i]);
			
			devices.add(tDevice);
			notifyListenersAddedDevice(tDevice);
		}
	}
       
       AndroidDebugBridge.addDeviceChangeListener(this);
}
 
开发者ID:eBay,项目名称:mtdtool,代码行数:40,代码来源:TestDeviceManager.java

示例15: addNotify

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
@Override
protected void addNotify() {
    AndroidDebugBridge.addDeviceChangeListener(this);
    updateKeys();
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:6,代码来源:MobileDeviceNode.java


注:本文中的com.android.ddmlib.AndroidDebugBridge.addDeviceChangeListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。