本文整理汇总了Java中com.android.ddmlib.Client.getClientData方法的典型用法代码示例。如果您正苦于以下问题:Java Client.getClientData方法的具体用法?Java Client.getClientData怎么用?Java Client.getClientData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.ddmlib.Client
的用法示例。
在下文中一共展示了Client.getClientData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProcessName
import com.android.ddmlib.Client; //导入方法依赖的package包/类
/**
* Get a reference to the name of the process with the given ID. The
* reference may contain a null-object, couldn't be retrieved, but may be
* available later.
*
* @param device Device, where the process runs.
* @param pid ID of the process.
* @return A reference to a string containing the process name or
* {@code null}, if the process couldn't be retrieved yet.
*/
private String[] getProcessName(IDevice device, int pid) {
Map<Integer, String[]> cache = processNameCache.get(device.getSerialNumber());
if (cache == null) {
cache = new HashMap<>();
processNameCache.put(device.getSerialNumber(), cache);
}
String[] nameref = cache.get(pid);
if (nameref == null) {
nameref = new String[1];
cache.put(pid, nameref);
}
if (nameref[0] == null) {
for (Client client : device.getClients()) {
ClientData data = client.getClientData();
if (data.getPid() == pid) {
nameref[0] = data.getClientDescription();
}
}
}
return nameref;
}
示例2: renderClient
import com.android.ddmlib.Client; //导入方法依赖的package包/类
private static void renderClient(@NotNull Client c, ColoredTextContainer container) {
ClientData cd = c.getClientData();
String name = cd.getClientDescription();
if (name == null) {
return;
}
Pair<String, String> app = splitApplicationName(name);
container.append(app.getFirst(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
container.append(app.getSecond(), SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES);
if (cd.isValidUserId() && cd.getUserId() != 0) {
container.append(String.format(" (user %1$d)", cd.getUserId()), SimpleTextAttributes.GRAY_ATTRIBUTES);
}
container.append(String.format(" (%1$d)", cd.getPid()), SimpleTextAttributes.GRAY_ATTRIBUTES);
if (!c.isValid()) {
container.append(" [DEAD]", SimpleTextAttributes.GRAYED_BOLD_ATTRIBUTES);
}
}
示例3: updateClientList
import com.android.ddmlib.Client; //导入方法依赖的package包/类
private void updateClientList(IDevice device) {
if (mDevice == null) {
return;
}
if (!mDevice.equals(device)) {
return;
}
mPidToName = new HashMap<String, String>();
for (Client c : device.getClients()) {
ClientData cd = c.getClientData();
String name = cd.getClientDescription();
int pid = cd.getPid();
/* The name will be null for apps that have just been created.
* In such a case, we fill in the default name, and wait for the
* clientChangeListener to do the update with the correct name.
*/
if (name == null) {
name = UNKNOWN_APP;
}
mPidToName.put(Integer.toString(pid), name);
}
}
示例4: compare
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Override
public int compare(Client a, Client b) {
ClientData ad = a.getClientData();
ClientData bd = b.getClientData();
String as = ad.getClientDescription() != null ? ad.getClientDescription() : String.valueOf(ad.getPid());
String bs = bd.getClientDescription() != null ? bd.getClientDescription() : String.valueOf(bd.getPid());
return as.compareTo(bs);
}
示例5: setSelected
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Override
protected void setSelected(@NotNull Client c) {
ClientData cd = c.getClientData();
try {
if (cd.getMethodProfilingStatus() == ClientData.MethodProfilingStatus.TRACER_ON) {
c.stopMethodTracer();
}
else {
c.startMethodTracer();
}
}
catch (IOException e1) {
Messages.showErrorDialog(myProject, "Unexpected error while toggling method profiling: " + e1, "Method Profiling");
}
}
示例6: setUpForReattachingDebugger
import com.android.ddmlib.Client; //导入方法依赖的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");
});
}
示例7: getColumnImage
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Override
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == DEVICE_COL_SERIAL && element instanceof IDevice) {
IDevice device = (IDevice)element;
if (device.isEmulator()) {
return mEmulatorImage;
}
return mDeviceImage;
} else if (element instanceof Client) {
Client client = (Client)element;
ClientData cd = client.getClientData();
switch (columnIndex) {
case CLIENT_COL_NAME:
switch (cd.getDebuggerConnectionStatus()) {
case DEFAULT:
return null;
case WAITING:
return mWaitingImage;
case ATTACHED:
return mDebuggerImage;
case ERROR:
return mDebugErrorImage;
}
return null;
case CLIENT_COL_THREAD:
if (client.isThreadUpdateEnabled()) {
return mThreadImage;
}
return null;
case CLIENT_COL_HEAP:
if (client.isHeapUpdateEnabled()) {
return mHeapImage;
}
return null;
}
}
return null;
}
示例8: constructClientChangeListener
import com.android.ddmlib.Client; //导入方法依赖的package包/类
private IClientChangeListener constructClientChangeListener() {
return new IClientChangeListener() {
@Override
public void clientChanged(Client client, int changeMask) {
if ((changeMask & Client.CHANGE_NAME) == Client.CHANGE_NAME) {
ClientData cd = client.getClientData();
updateClientName(cd);
}
}
};
}
示例9: clientSelected
import com.android.ddmlib.Client; //导入方法依赖的package包/类
/**
* Sent when a new client is selected. The new client can be accessed
* with {@link #getCurrentClient()}.
*/
@Override
public void clientSelected() {
if (mBase.isDisposed())
return;
Client client = getCurrentClient();
mDisplayModeCombo.setEnabled(false);
emptyTables();
Log.d("ddms", "NativeHeapPanel: changed " + client);
if (client != null) {
ClientData cd = client.getClientData();
mClientData = cd;
// if (cd.getShowHeapUpdates())
setUpdateStatus(ENABLED);
// else
// setUpdateStatus(NOT_ENABLED);
initAllocationDisplay();
//renderBitmap(cd);
} else {
mClientData = null;
setUpdateStatus(NOT_SELECTED);
}
mBase.pack();
}
示例10: ClientDataInfo
import com.android.ddmlib.Client; //导入方法依赖的package包/类
public ClientDataInfo(Client client) {
this.clientData = client.getClientData();
this.client = client;
this.name = name();
this.pid = clientData.getPid();
this.port = port();
}
示例11: testListClients
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Test
public void testListClients() {
Client[] clients = device.getAllClient();
for (Client client : clients) {
ClientData clientData = client.getClientData();
System.out.println(clientData.getClientDescription() + " " + clientData.getPid());
}
}
示例12: LogProcess
import com.android.ddmlib.Client; //导入方法依赖的package包/类
public LogProcess(Client client) {
ClientData cd = client.getClientData();
setProcessName(cd.getClientDescription());
setProcessID(cd.getPid());
}
示例13: isSelected
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Override
protected boolean isSelected(@NotNull Client c) {
ClientData cd = c.getClientData();
return cd.getMethodProfilingStatus() == ClientData.MethodProfilingStatus.TRACER_ON ||
cd.getMethodProfilingStatus() == ClientData.MethodProfilingStatus.SAMPLER_ON;
}
示例14: clientSelected
import com.android.ddmlib.Client; //导入方法依赖的package包/类
/**
* Sent when a new client is selected. The new client can be accessed
* with {@link #getCurrentClient()}.
*/
@Override
public void clientSelected() {
if (mTop.isDisposed())
return;
Client client = getCurrentClient();
Log.d("ddms", "HeapPanel: changed " + client);
if (client != null) {
ClientData cd = client.getClientData();
if (client.isHeapUpdateEnabled()) {
mGcButton.setEnabled(true);
mDisplayMode.setEnabled(true);
setUpdateStatus(ENABLED);
} else {
setUpdateStatus(NOT_ENABLED);
mGcButton.setEnabled(false);
mDisplayMode.setEnabled(false);
}
fillSummaryTable(cd);
int mode = mDisplayMode.getSelectionIndex();
if (mode == 0) {
fillDetailedTable(client, false /* forceRedraw */);
} else {
if (DISPLAY_HEAP_BITMAP) {
renderHeapData(cd, mode - 1, false /* forceRedraw */);
}
}
} else {
mGcButton.setEnabled(false);
mDisplayMode.setEnabled(false);
fillSummaryTable(null);
fillDetailedTable(null, true);
setUpdateStatus(NOT_SELECTED);
}
// sizes of things change frequently, so redo layout
//mScrolledComposite.setMinSize(mDisplayStack.topControl.computeSize(SWT.DEFAULT,
// SWT.DEFAULT));
mDisplayBase.layout();
//mScrolledComposite.redraw();
}
示例15: getColumnText
import com.android.ddmlib.Client; //导入方法依赖的package包/类
@Override
public String getColumnText(Object element, int columnIndex) {
if (element instanceof IDevice) {
IDevice device = (IDevice)element;
switch (columnIndex) {
case DEVICE_COL_SERIAL:
return device.getName();
case DEVICE_COL_STATE:
return getStateString(device);
case DEVICE_COL_BUILD: {
String version = device.getProperty(IDevice.PROP_BUILD_VERSION);
if (version != null) {
String debuggable = device.getProperty(IDevice.PROP_DEBUGGABLE);
if (device.isEmulator()) {
String avdName = device.getAvdName();
if (avdName == null) {
avdName = "?"; // the device is probably not online yet, so
// we don't know its AVD name just yet.
}
if (debuggable != null && debuggable.equals("1")) { //$NON-NLS-1$
return String.format("%1$s [%2$s, debug]", avdName,
version);
} else {
return String.format("%1$s [%2$s]", avdName, version); //$NON-NLS-1$
}
} else {
if (debuggable != null && debuggable.equals("1")) { //$NON-NLS-1$
return String.format("%1$s, debug", version);
} else {
return String.format("%1$s", version); //$NON-NLS-1$
}
}
} else {
return "unknown";
}
}
}
} else if (element instanceof Client) {
Client client = (Client)element;
ClientData cd = client.getClientData();
switch (columnIndex) {
case CLIENT_COL_NAME:
String name = cd.getClientDescription();
if (name != null) {
return name;
}
return "?";
case CLIENT_COL_PID:
return Integer.toString(cd.getPid());
case CLIENT_COL_PORT:
if (mAdvancedPortSupport) {
int port = client.getDebuggerListenPort();
String portString = "?";
if (port != 0) {
portString = Integer.toString(port);
}
if (client.isSelectedClient()) {
return String.format("%1$s / %2$d", portString, //$NON-NLS-1$
DdmPreferences.getSelectedDebugPort());
}
return portString;
}
}
}
return null;
}