• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ClientData类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.android.ddmlib.ClientData的典型用法代码示例。如果您正苦于以下问题:Java ClientData类的具体用法?Java ClientData怎么用?Java ClientData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClientData类属于com.android.ddmlib包,在下文中一共展示了ClientData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateAdb

import com.android.ddmlib.ClientData; //导入依赖的package包/类
protected void updateAdb() {
    AndroidSdk sdk = defaultSdk.get();
    if (sdk != null) {
        final FileObject path = sdk.findTool(ADB_TOOL);
        if (path != null) {
            ClientData.class.getClassLoader().clearAssertionStatus();      //qattern
            DebugPortManager.setProvider(DebugPortProvider.getDefault());
            AndroidDebugBridge.initIfNeeded(true);
            String adbLocation = FileUtil.toFile(path).getAbsolutePath();
            String lastLocation = adbPath.getAndSet(adbLocation);
            pcs.firePropertyChange(PROP_DEFAULT_ADB_PATH, lastLocation, adbLocation);
            AndroidDebugBridge bridge = AndroidDebugBridge.createBridge(adbLocation, false);
            AndroidDebugBridge lastAdb = adb.getAndSet(bridge);
            pcs.firePropertyChange(PROP_DEFAULT_ADB, lastAdb, bridge);
        }
    }
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:18,代码来源:AndroidSdkProvider.java


示例2: getProcessName

import com.android.ddmlib.ClientData; //导入依赖的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;
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:36,代码来源:LogReader.java


示例3: renderClient

import com.android.ddmlib.ClientData; //导入依赖的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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ClientCellRenderer.java


示例4: setSelected

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@Override
protected void setSelected(@NotNull Client c) {
  long now = System.currentTimeMillis();
  if (c.getClientData().getAllocationStatus() == ClientData.AllocationTrackingStatus.ON) {
    c.requestAllocationDetails();
    c.enableAllocationTracker(false);
    if (myEvent == null) {
      // Unexpected end of tracking, start now:
      myEvent = myEvents.start(now, MemoryMonitorView.EVENT_ALLOC);
    }
    myEvent.stop(now);
    myEvent = null;
  } else {
    c.enableAllocationTracker(true);
    if (myEvent != null) {
      // TODO add support for different end types (error, etc)
      myEvent.stop(now);
    }
    myEvent = myEvents.start(now, MemoryMonitorView.EVENT_ALLOC);
  }
  c.requestAllocationStatus();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ToggleAllocationTrackingAction.java


示例5: recordSample

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@SuppressWarnings("ConstantConditions")
protected void recordSample(int type) {
  float freeMb = 0.0f;
  float allocMb = 0.0f;
  if (myClient != null) {
    ClientData.HeapInfo m = myClient.getClientData().getVmHeapInfo(1);
    if (m != null) {
      allocMb = m.bytesAllocated / (1024.f * 1024.f);
      freeMb = m.sizeInBytes / (1024.f * 1024.f) - allocMb;
    }
  }
  else {
    type = TYPE_UNREACHABLE;
  }
  // We cannot use the timeStamp in HeapInfo because it's based on the current time of the attached device.
  myData.add(System.currentTimeMillis(), type, allocMb, freeMb);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:MemorySampler.java


示例6: updateClientList

import com.android.ddmlib.ClientData; //导入依赖的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);
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:27,代码来源:LogCatPidToNameMapper.java


示例7: renderBitmap

import com.android.ddmlib.ClientData; //导入依赖的package包/类
private void renderBitmap(ClientData cd) {
    byte[] pixData;

    // Atomically get and clear the heap data.
    synchronized (cd) {
        if (serializeHeapData(cd.getVmHeapData()) == false) {
            // no change, we return.
            return;
        }

        pixData = getSerializedData();

        ImageData id = createLinearHeapImage(pixData, 200, mMapPalette);
        Image image = new Image(mBase.getDisplay(), id);
        mImage.setImage(image);
        mImage.pack(true);
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:19,代码来源:NativeHeapPanel.java


示例8: updateInfo

import com.android.ddmlib.ClientData; //导入依赖的package包/类
private void updateInfo() {
    final ClientData cd = this.client.getClientData();
    final int pid = cd.getPid();
    String name = cd.getClientDescription();
    if (name == null) {
        //Unknown, show at least pid.
        name = NbBundle.getMessage(ClientNode.class, "TXT_PID", Integer.toString(pid));
    }
    this.setDisplayName(name);
    final String desc = cd.getClientDescription();
    final String description = NbBundle.getMessage(ClientNode.class, "TIP_Client", desc == null ? "" : desc, Integer.toString(pid));
    if (description != null) {
        this.setShortDescription(description);
    }
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:16,代码来源:ClientNode.java


示例9: compare

import com.android.ddmlib.ClientData; //导入依赖的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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ClientCellRenderer.java


示例10: getActiveText

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@Override
@NotNull
protected String getActiveText(@NotNull Client c) {
  return c.getClientData().getAllocationStatus() == ClientData.AllocationTrackingStatus.ON ?
                AndroidBundle.message("android.ddms.actions.allocationtracker.stop") :
                AndroidBundle.message("android.ddms.actions.allocationtracker.start");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ToggleAllocationTrackingAction.java


示例11: setSelected

import com.android.ddmlib.ClientData; //导入依赖的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");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ToggleMethodProfilingAction.java


示例12: getActiveText

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@NotNull
@Override
protected String getActiveText(@NotNull Client c) {
  return c.getClientData().getMethodProfilingStatus() == ClientData.MethodProfilingStatus.TRACER_ON ?
                AndroidBundle.message("android.ddms.actions.methodprofile.stop") :
                AndroidBundle.message("android.ddms.actions.methodprofile.start");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ToggleMethodProfilingAction.java


示例13: setUpForReattachingDebugger

import com.android.ddmlib.ClientData; //导入依赖的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


示例14: getColumnImage

import com.android.ddmlib.ClientData; //导入依赖的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;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:41,代码来源:DevicePanel.java


示例15: constructClientChangeListener

import com.android.ddmlib.ClientData; //导入依赖的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);
            }
        }
    };
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:12,代码来源:LogCatPidToNameMapper.java


示例16: updateClientName

import com.android.ddmlib.ClientData; //导入依赖的package包/类
private void updateClientName(ClientData cd) {
    String name = cd.getClientDescription();
    if (name != null) {
        int pid = cd.getPid();
        if (mPidToName != null) {
            mPidToName.put(Integer.toString(pid), name);
        }
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:10,代码来源:LogCatPidToNameMapper.java


示例17: updateNHAllocationStackCalls

import com.android.ddmlib.ClientData; //导入依赖的package包/类
/**
 * update the Native Heap panel with the amount of allocation for which the
 * stack call has been computed. This is called from a non UI thread, but
 * will be executed in the UI thread.
 *
 * @param count the amount of allocation
 * @return false if the display was disposed and the update couldn't happen
 */
private boolean updateNHAllocationStackCalls(final ClientData clientData, final int count) {
    if (mDisplay.isDisposed() == false) {
        mDisplay.asyncExec(new Runnable() {
            @Override
            public void run() {
                updateAllocationStackCalls(clientData, count);
            }
        });
        return true;
    }
    return false;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:21,代码来源:NativeHeapPanel.java


示例18: clientSelected

import com.android.ddmlib.ClientData; //导入依赖的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();
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:36,代码来源:NativeHeapPanel.java


示例19: testClients

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@Test
public void testClients() {
	Client[] clients = pollFirst().getDevice().getClients();
	for (int i = 0; i < clients.length; i++) {
		ClientData clientData = clients[i].getClientData();
		System.out.println(clientData.getClientDescription());
	}
}
 
开发者ID:cosysoft,项目名称:device,代码行数:9,代码来源:DeviceClientTest.java


示例20: testListClients

import com.android.ddmlib.ClientData; //导入依赖的package包/类
@Test
public void testListClients() {

  Client[] clients = device.getAllClient();
  for (Client client : clients) {
    ClientData clientData = client.getClientData();
    System.out.println(clientData.getClientDescription() + " " + clientData.getPid());
  }
}
 
开发者ID:cosysoft,项目名称:device,代码行数:10,代码来源:PerformanceTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CodePointCharStream类代码示例发布时间:2022-05-22
下一篇:
Java CharacterBuffer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap