Search in sources :

Example 26 with Client

use of com.android.ddmlib.Client in project android by JetBrains.

the class AndroidProcessChooserDialog method getSelectedClient.

@Nullable
private Client getSelectedClient() {
    final TreePath selectionPath = myProcessTree.getSelectionPath();
    if (selectionPath == null || selectionPath.getPathCount() < 3) {
        return null;
    }
    DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selectionPath.getPathComponent(2);
    final Object obj = selectedNode.getUserObject();
    return obj instanceof Client ? (Client) obj : null;
}
Also used : TreePath(javax.swing.tree.TreePath) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Client(com.android.ddmlib.Client) Nullable(org.jetbrains.annotations.Nullable)

Example 27 with Client

use of com.android.ddmlib.Client in project platform_frameworks_base by android.

the class ReloadListAction method run.

@Override
public void run() {
    Client[] clients = clientUtils.findAllClients(device);
    if (clients != null) {
        Arrays.sort(clients, new ClientComparator());
    }
    clientListModel.removeAllElements();
    for (Client c : clients) {
        clientListModel.addElement(c);
    }
}
Also used : Client(com.android.ddmlib.Client)

Example 28 with Client

use of com.android.ddmlib.Client in project platform_frameworks_base by android.

the class ScanPackageAction method run.

@Override
public void run() {
    Main.getUI().showWaitDialog();
    try {
        Client client = Main.getUI().getSelectedClient();
        if (client != null) {
            work(client);
        } else {
            Client[] clients = clientUtils.findAllClients(device);
            if (clients.length > 0) {
                ClientWrapper[] clientWrappers = new ClientWrapper[clients.length];
                for (int i = 0; i < clientWrappers.length; i++) {
                    clientWrappers[i] = new ClientWrapper(clients[i]);
                }
                Main.getUI().hideWaitDialog();
                ClientWrapper ret = Main.getUI().showChoiceDialog("Choose a package to scan", "Choose package", clientWrappers);
                if (ret != null) {
                    work(ret.client);
                }
            }
        }
    } finally {
        Main.getUI().hideWaitDialog();
    }
}
Also used : Client(com.android.ddmlib.Client)

Example 29 with Client

use of com.android.ddmlib.Client in project android by JetBrains.

the class GpuSampler method setGpuProfileSetting.

private void setGpuProfileSetting(boolean newSetting) {
    if (myGpuProfileSetting != newSetting) {
        myGpuProfileSetting = newSetting;
        Client client = getClient();
        if ((client != null) && (myProfileStateListener != null)) {
            myProfileStateListener.notifyGpuProfileStateChanged(client, myGpuProfileSetting);
        }
    }
}
Also used : Client(com.android.ddmlib.Client)

Example 30 with Client

use of com.android.ddmlib.Client in project android by JetBrains.

the class GpuSampler method prepareSampler.

@Override
protected synchronized void prepareSampler() {
    Client client = getClient();
    if (client != null) {
        int newApiLevel = decodeApiLevel(client);
        boolean createNewTimelineData = false;
        if (newApiLevel != myApiLevel) {
            myApiLevel = newApiLevel;
            for (GfxinfoHandler handler : myGfxinfoHandlers) {
                if (handler.accept(client)) {
                    createNewTimelineData = true;
                    break;
                }
            }
        }
        for (GfxinfoHandler handler : myGfxinfoHandlers) {
            if (handler.accept(client)) {
                myCurrentGfxinfoHandler = handler;
            // Do not break here, as we will rely on the ordering of samplers to find the preferred sampler.
            }
        }
        if (createNewTimelineData) {
            setTimelineData(myCurrentGfxinfoHandler.createTimelineData());
        }
    } else {
        myCurrentGfxinfoHandler = null;
    }
    setGpuProfileSetting(true);
    if (myCurrentGfxinfoHandler != null) {
        myCurrentGfxinfoHandler.setClient(client);
    }
    getTimelineData().clear();
}
Also used : GfxinfoHandler(com.android.tools.idea.monitor.gpu.gfxinfohandlers.GfxinfoHandler) Client(com.android.ddmlib.Client)

Aggregations

Client (com.android.ddmlib.Client)49 IDevice (com.android.ddmlib.IDevice)6 DumpData (com.android.preload.DumpData)5 Date (java.util.Date)5 AndroidDebugBridge (com.android.ddmlib.AndroidDebugBridge)3 ProcessHandler (com.intellij.execution.process.ProcessHandler)3 IOException (java.io.IOException)3 ClientData (com.android.ddmlib.ClientData)2 Project (com.intellij.openapi.project.Project)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 TreePath (javax.swing.tree.TreePath)2 Nullable (org.jetbrains.annotations.Nullable)2 IClientChangeListener (com.android.ddmlib.AndroidDebugBridge.IClientChangeListener)1 NullOutputReceiver (com.android.ddmlib.NullOutputReceiver)1 InstantRunClient (com.android.tools.fd.client.InstantRunClient)1 InstantRunPushFailedException (com.android.tools.fd.client.InstantRunPushFailedException)1 HierarchyViewAction (com.android.tools.idea.ddms.actions.HierarchyViewAction)1 GfxinfoHandler (com.android.tools.idea.monitor.gpu.gfxinfohandlers.GfxinfoHandler)1 AllocationTrackingSample (com.android.tools.idea.monitor.ui.memory.model.AllocationTrackingSample)1