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


Java AndroidDebugBridge.addClientChangeListener方法代码示例

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


在下文中一共展示了AndroidDebugBridge.addClientChangeListener方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: run

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

  myClient.dumpHprof();
  synchronized (myEvents) {
     myEvent = myEvents.start(System.currentTimeMillis(), MemoryMonitorView.EVENT_HPROF);
  }
  try {
    myResponse.await(1, TimeUnit.MINUTES);
    // TODO Handle cases where it fails or times out.
  }
  catch (InterruptedException e) {
    // Interrupted
  }
  // If the event had not finished, finish it now
  synchronized (myEvents) {
    if (myEvent != null) {
      myEvent.stop(System.currentTimeMillis());
    }
  }
  AndroidDebugBridge.removeClientChangeListener(this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DumpHprofAction.java

示例3: 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

示例4: 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

示例5: start

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
@Override
public void start() {
  if (myExecutingTask == null && myClient != null) {
    AndroidDebugBridge.addClientChangeListener(this);
  }
  super.start();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MemorySampler.java

示例6: setUpForReattachingDebugger

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
/**
 * Wires up listeners to automatically reconnect the debugger for each test method. When you
 * `blaze test` an android_test in debug mode, it kills the instrumentation process between each
 * test method, disconnecting the debugger. We listen for the start of a new method waiting for a
 * debugger, and reconnect. TODO: Support stopping Blaze from the UI. This is hard because we have
 * no way to distinguish process handler termination/debug session ending initiated by the user.
 */
private void setUpForReattachingDebugger(
    String targetPackage,
    LaunchInfo launchInfo,
    ProcessHandlerLaunchStatus launchStatus,
    ProcessHandlerConsolePrinter printer) {
  final AndroidDebugBridge.IClientChangeListener reattachingListener =
      new AndroidDebugBridge.IClientChangeListener() {
        // The target application can either
        // 1. Match our target name, and become available for debugging.
        // 2. Be available for debugging, and suddenly have its name changed to match.
        static final int CHANGE_MASK = Client.CHANGE_DEBUGGER_STATUS | Client.CHANGE_NAME;

        @Override
        public void clientChanged(@NotNull Client client, int changeMask) {
          ClientData data = client.getClientData();
          String clientDescription = data.getClientDescription();
          if (clientDescription != null
              && clientDescription.equals(targetPackage)
              && (changeMask & CHANGE_MASK) != 0
              && data.getDebuggerConnectionStatus().equals(ClientData.DebuggerStatus.WAITING)) {
            reattachDebugger(launchInfo, client, launchStatus, printer);
          }
        }
      };

  AndroidDebugBridge.addClientChangeListener(reattachingListener);
  runContext.addLaunchTaskCompleteListener(
      () -> {
        AndroidDebugBridge.removeClientChangeListener(reattachingListener);
        launchStatus.terminateLaunch("Test run completed.\n");
      });
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:40,代码来源:ConnectBlazeTestDebuggerTask.java

示例7: 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

示例8: 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

示例9: postCreation

import com.android.ddmlib.AndroidDebugBridge; //导入方法依赖的package包/类
@Override
protected void postCreation() {
    AndroidDebugBridge.addClientChangeListener(this);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:5,代码来源:ClientDisplayPanel.java

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


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