Checks if the device has an USB accessory.
@param manager the package manager.
@return {@code true} if the device has an USB accessory.
351867
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
    public static boolean hasUsbAccessoryFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_USB_ACCESSORY);
    }
115728
def usb(
        ctx, enable, disable, list, enable_all, touch_eject, no_touch_eject,
        autoeject_timeout, chalresp_timeout, lock_code, force):
    

    def ensure_not_all_disabled(ctx, usb_enabled):
        for app in APPLICATION:
            if app & usb_enabled:
                return
        ctx.fail('Can not disable all applications over USB.')

    if not (list or
            enable_all or
            enable or
            disable or
            touch_eject or
            no_touch_eject or
            autoeject_timeout or
            chalresp_timeout):
        ctx.fail('No configuration options chosen.')

    enable = APPLICATION.__members__.keys() if enable_all else enable

    _ensure_not_invalid_options(ctx, enable, disable)

    if touch_eject and no_touch_eject:
        ctx.fail('Invalid options.')

    dev = ctx.obj['dev']

    usb_supported = dev.config.usb_supported
    usb_enabled = dev.config.usb_enabled
    flags = dev.config.device_flags

    if not usb_supported:
        ctx.fail('USB interface not supported.')

    if list:
        _list_apps(ctx, usb_enabled)

    if touch_eject:
        flags |= FLAGS.MODE_FLAG_EJECT
    if no_touch_eject:
        flags &= ~FLAGS.MODE_FLAG_EJECT

    for app in enable:
        if APPLICATION[app] & usb_supported:
            usb_enabled |= APPLICATION[app]
        else:
            ctx.fail('{} not supported over USB.'.format(app))
    for app in disable:
        if APPLICATION[app] & usb_supported:
            usb_enabled &= ~APPLICATION[app]
        else:
            ctx.fail('{} not supported over USB.'.format(app))

    ensure_not_all_disabled(ctx, usb_enabled)

    f_confirm = '{}{}{}{}{}{}Configure USB interface?'.format(
        'Enable {}.\n'.format(
            ', '.join(
                [str(APPLICATION[app]) for app in enable])) if enable else '',
        'Disable {}.\n'.format(
            ', '.join(
                [str(APPLICATION[app]) for app in disable])) if disable else '',
        'Set touch eject.\n' if touch_eject else '',
        'Disable touch eject.\n' if no_touch_eject else '',
        'Set autoeject timeout to {}.\n'.format(
            autoeject_timeout) if autoeject_timeout else '',
        'Set challenge-response timeout to {}.\n'.format(
            chalresp_timeout) if chalresp_timeout else '')

    is_locked = dev.config.configuration_locked

    if force and is_locked and not lock_code:
        ctx.fail('Configuration is locked - please supply the --lock-code '
                 'option.')
    if lock_code and not is_locked:
        ctx.fail('Configuration is not locked - please remove the '
                 '--lock-code option.')

    force or click.confirm(f_confirm, abort=True, err=True)

    if is_locked and not lock_code:
        lock_code = prompt_lock_code()

    if lock_code:
        lock_code = _parse_lock_code(ctx, lock_code)

    try:
        dev.write_config(
            device_config(
                usb_enabled=usb_enabled,
                flags=flags,
                auto_eject_timeout=autoeject_timeout,
                chalresp_timeout=chalresp_timeout),
            reboot=True,
            lock_key=lock_code)
    except Exception as e:
        logger.error('Failed to write config', exc_info=e)
        ctx.fail('Failed to configure USB applications.')
220424
@Override
	public boolean hasField(String fldName) {
		return ss1.hasField(fldName) || ss2.hasField(fldName);
	}
1001050
def _is_device_active(device):
        
        cmd = ['dmsetup', 'info', device]
        dmsetup_info = util.subp(cmd)
        for dm_line in dmsetup_info.stdout.split("\n"):
            line = dm_line.split(':')
            if ('State' in line[0].strip()) and ('ACTIVE' in line[1].strip()):
                return True
        return False
701353
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
    public static boolean hasBluetoothLEFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
    }
198894
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR1)
    public static boolean hasUsbHostFeature(Context context) {
        return hasUsbHostFeature(context.getPackageManager());
    }
1314651
boolean isAvailableDeviceId(OmemoDevice userDevice, int id) {
        LOGGER.log(Level.INFO, "Check if id " + id + " is available...");

        // Lookup local cached device list
        BareJid ownJid = userDevice.getJid();
        OmemoCachedDeviceList cachedDeviceList;

        cachedDeviceList = loadCachedDeviceList(userDevice, ownJid);

        if (cachedDeviceList == null) {
            cachedDeviceList = new OmemoCachedDeviceList();
        }
        // Does the list already contain that id?
        return !cachedDeviceList.contains(id);
    }
903320
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
    public static boolean hasSipFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SIP);
    }
514026
private boolean isPermissionGranted(String permission) {
        if (permission == null) {
            throw new IllegalArgumentException("permission is null");
        }

        return context.checkPermission(permission, android.os.Process.myPid(), Process.myUid()) == PackageManager.PERMISSION_GRANTED;
    }
545957
@TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean hasAccelerometerSensorFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
    }
296875
def is_external(self):
        """"""
        # NOTE: Checking for equality HintSystem==False returns False if the
        # property is resolved to a None value (interface not available).
        if self._P.Block.HintSystem == False:       # noqa: E712
            return True
        # NOTE: udisks2 seems to guess incorrectly in some cases. This
        # leads to HintSystem=True for unlocked devices. In order to show
        # the device anyway, it needs to be recursively checked if any
        # parent device is recognized as external.
        if self.is_luks_cleartext and self.luks_cleartext_slave.is_external:
            return True
        if self.is_partition and self.partition_slave.is_external:
            return True
        return False
976961
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
    public static boolean hasLandscapeScreenFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
    }
227512
@TargetApi(Build.VERSION_CODES.KITKAT)
    public static boolean hasDeviceAdminFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_DEVICE_ADMIN);
    }
446777
public static boolean isSupportVIVOPush(Context context) {
    com.vivo.push.PushClient client = com.vivo.push.PushClient.getInstance(context);
    if (null == client) {
      return false;
    }
    return client.isSupport();
  }
1099953
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
    public static boolean hasSipVoipFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SIP_VOIP);
    }
191690
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
    public static boolean hasJazzhandMultiFakeTouchFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND);
    }
368686
def find_raw_devices(vendor=None, product=None, serial_number=None,
                     custom_match=None, **kwargs):
    
    def is_usbraw(dev):
        if custom_match and not custom_match(dev):
            return False
        return bool(find_interfaces(dev, bInterfaceClass=0xFF,
                                    bInterfaceSubClass=0xFF))

    return find_devices(vendor, product, serial_number, is_usbraw, **kwargs)