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

Java DeviceState类代码示例

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

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



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

示例1: compare

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
@NonNull
static DeviceListComparisonResult compare(@NonNull List<? extends IDevice> previous,
                                          @NonNull List<? extends IDevice> current) {
    current = Lists.newArrayList(current);

    final Map<IDevice, DeviceState> updated = Maps.newHashMapWithExpectedSize(current.size());
    final List<IDevice> added = Lists.newArrayListWithExpectedSize(1);
    final List<IDevice> removed = Lists.newArrayListWithExpectedSize(1);

    for (IDevice device : previous) {
        IDevice currentDevice = find(current, device);
        if (currentDevice != null) {
            if (currentDevice.getState() != device.getState()) {
                updated.put(device, currentDevice.getState());
            }
            current.remove(currentDevice);
        } else {
            removed.add(device);
        }
    }

    added.addAll(current);

    return new DeviceListComparisonResult(updated, added, removed);
}
 
开发者ID:rock3r,项目名称:framer,代码行数:26,代码来源:DeviceMonitor.java


示例2: processIncomingDeviceData

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
/** Processes an incoming device message from the socket */
private void processIncomingDeviceData(int length) throws IOException {
    ArrayList<Device> list = new ArrayList<Device>();

    if (length > 0) {
        byte[] buffer = new byte[length];
        String result = read(mMainAdbConnection, buffer);

        String[] devices = result.split("\n"); //$NON-NLS-1$

        for (String d : devices) {
            String[] param = d.split("\t"); //$NON-NLS-1$
            if (param.length == 2) {
                // new adb uses only serial numbers to identify devices
                Device device = new Device(this, param[0] /*serialnumber*/,
                        DeviceState.getState(param[1]));

                //add the device to the list
                list.add(device);
            }
        }
    }

    // now merge the new devices with the old ones.
    updateDevices(list);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DeviceMonitor.java


示例3: processIncomingDeviceData

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
/**
 * Processes an incoming device message from the socket
 * @param socket
 * @param length
 * @throws IOException
 */
private void processIncomingDeviceData(int length) throws IOException {
    ArrayList<Device> list = new ArrayList<Device>();

    if (length > 0) {
        byte[] buffer = new byte[length];
        String result = read(mMainAdbConnection, buffer);

        String[] devices = result.split("\n"); //$NON-NLS-1$

        for (String d : devices) {
            String[] param = d.split("\t"); //$NON-NLS-1$
            if (param.length == 2) {
                // new adb uses only serial numbers to identify devices
                Device device = new Device(this, param[0] /*serialnumber*/,
                        DeviceState.getState(param[1]));

                //add the device to the list
                list.add(device);
            }
        }
    }

    // now merge the new devices with the old ones.
    updateDevices(list);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:32,代码来源:DeviceMonitor.java


示例4: setupDevicesTable

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
private void setupDevicesTable() {
    DefaultTableModel tableModel = (DefaultTableModel) devicesTable.getModel();
    tableModel.setRowCount(0);
    for (IDevice device : devices) {
        String name;
        String target;
        if (device.isEmulator()) {
            name = device.getAvdName();
            AvdInfo info = avdManager.getAvd(device.getAvdName(), true /*validAvdOnly*/);
            target = info == null ? "?" : device.getAvdName();
        } else {
            name = "N/A";
            String deviceBuild = device.getProperty(IDevice.PROP_BUILD_VERSION);
            target = deviceBuild == null ? "unknown" : deviceBuild;
        }
        String state;
        if (DeviceState.BOOTLOADER.equals(device.getState())) {
            state = "bootloader";
        } else if (DeviceState.OFFLINE.equals(device.getState())) {
            state = "offline";
        } else if (DeviceState.ONLINE.equals(device.getState())) {
            state = "online";
        } else {
            state = "unknown";
        }

        tableModel.addRow(new Object[]{
            // TODO nulls?
            device.getSerialNumber(), name, target,
            Boolean.valueOf("1".equals(device.getProperty(IDevice.PROP_DEBUGGABLE))),
            state
        });
    }
    devicesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent e) {
            DeviceUiChooser.this.updateState();
        }
    });
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:41,代码来源:DeviceUiChooser.java


示例5: removeDevice

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
private void removeDevice(@NonNull Device device) {
    device.setState(DeviceState.DISCONNECTED);
    device.clearClientList();
    mDevices.remove(device);

    SocketChannel channel = device.getClientMonitoringSocket();
    if (channel != null) {
        try {
            channel.close();
        } catch (IOException e) {
            // doesn't really matter if the close fails.
        }
    }
}
 
开发者ID:rock3r,项目名称:framer,代码行数:15,代码来源:DeviceMonitor.java


示例6: deviceListUpdate

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
@Override
public void deviceListUpdate(@NonNull Map<String, DeviceState> devices) {
    List<Device> l = Lists.newArrayListWithExpectedSize(devices.size());
    for (Map.Entry<String, DeviceState> entry : devices.entrySet()) {
        l.add(new Device(DeviceMonitor.this, entry.getKey(), entry.getValue()));
    }
    // now merge the new devices with the old ones.
    updateDevices(l);
}
 
开发者ID:rock3r,项目名称:framer,代码行数:10,代码来源:DeviceMonitor.java


示例7: DeviceListComparisonResult

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
private DeviceListComparisonResult(@NonNull Map<IDevice, DeviceState> updated,
                                   @NonNull List<IDevice> added,
                                   @NonNull List<IDevice> removed) {
    this.updated = updated;
    this.added = added;
    this.removed = removed;
}
 
开发者ID:rock3r,项目名称:framer,代码行数:8,代码来源:DeviceMonitor.java


示例8: processIncomingDeviceData

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
/**
 * Processes an incoming device message from the socket
 */
private void processIncomingDeviceData(int length) throws IOException {
    Map<String, DeviceState> result;
    if (length <= 0) {
        result = Collections.emptyMap();
    } else {
        String response = read(mAdbConnection, new byte[length]);
        result = parseDeviceListResponse(response);
    }

    mListener.deviceListUpdate(result);
}
 
开发者ID:rock3r,项目名称:framer,代码行数:15,代码来源:DeviceMonitor.java


示例9: parseDeviceListResponse

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
@VisibleForTesting
static Map<String, DeviceState> parseDeviceListResponse(@Nullable String result) {
    Map<String, DeviceState> deviceStateMap = Maps.newHashMap();
    String[] devices = result == null ? new String[0] : result.split("\n"); //$NON-NLS-1$

    for (String d : devices) {
        String[] param = d.split("\t"); //$NON-NLS-1$
        if (param.length == 2) {
            // new adb uses only serial numbers to identify devices
            deviceStateMap.put(param[0], DeviceState.getState(param[1]));
        }
    }
    return deviceStateMap;
}
 
开发者ID:rock3r,项目名称:framer,代码行数:15,代码来源:DeviceMonitor.java


示例10: getStateString

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
/**
 * Returns a display string representing the state of the device.
 * @param d the device
 */
private static String getStateString(IDevice d) {
    DeviceState deviceState = d.getState();
    if (deviceState == DeviceState.ONLINE) {
        return "Online";
    } else if (deviceState == DeviceState.OFFLINE) {
        return "Offline";
    } else if (deviceState == DeviceState.BOOTLOADER) {
        return "Bootloader";
    }

    return "??";
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:17,代码来源:DevicePanel.java


示例11: getConnecedDevice

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
public IDevice getConnecedDevice(final String serialNumber) {
    for (IDevice device : AndroidDebugBridge.getBridge().getDevices()) {
        if (serialNumber.equals(device.getSerialNumber())
                && device.getState() == DeviceState.ONLINE) {
            return device;
        }
    }
    return null;
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:10,代码来源:DeviceConnectHelper.java


示例12: connect

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
public boolean connect() {
    boolean result = false;
    for (IDevice device : AndroidDebugBridge.getBridge().getDevices()) {
        if (mDevice.getSerialNumber().equals(device.getSerialNumber())
                && mDevice.getState() == DeviceState.ONLINE) {
            mDevice = device;
            result = true;
            break;
        }
    }
    return result;
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:13,代码来源:MonkeyTestDevice.java


示例13: isOnline

import com.android.ddmlib.IDevice.DeviceState; //导入依赖的package包/类
/**
 * Returns if the device is on line.
 * 
 * @return <code>true</code> if {@link IDevice#getState()} returns
 *         {@link DeviceState#ONLINE}.
 */
public boolean isOnline() {
    if (mDevice == null) {
        return false;
    }
    if (mDevice.getState() == DeviceState.ONLINE) {
        return true;
    } else {
        return false;
    }
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:17,代码来源:MonkeyTestDevice.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IntegerNameProvider类代码示例发布时间:2022-05-22
下一篇:
Java Constants类代码示例发布时间: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