Checks if the device has a microphone.
@param manager the package manager.
@return {@code true} if the device has a microphone.
18043
@TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean hasMicrophoneFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE);
    }
705733
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
    public static boolean hasFrontCameraFeature(Context context) {
        return hasFrontCameraFeature(context.getPackageManager());
    }
130453
private boolean mute() {
    isMuted = true;
    setSoundChipText(getContext().getString(R.string.muted));
    showSoundChip();
    soundFabOff();
    return isMuted;
  }
645793
static boolean getSilent(String message) {
    if (!StringUtil.isEmpty(message)) {
      try {
        JSONObject object = JSON.parseObject(message);
        return object.containsKey("silent")? object.getBooleanValue("silent"): false;
      } catch (JSONException e) {
        LOGGER.e("failed to parse JSON.", e);
      }
    }
    return false;
  }
368419
private boolean hasVibratePermission(Context context) {
        PackageManager pm = context.getPackageManager();
        int hasPerm = pm.checkPermission(android.Manifest.permission.VIBRATE, context.getPackageName());
        return hasPerm == PackageManager.PERMISSION_GRANTED;
    }
935932
@TargetApi(Build.VERSION_CODES.KITKAT)
    public static boolean hasStepDetectorSensorFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_STEP_DETECTOR);
    }
892291
public boolean isIBMSessionListenerImplemented(ArrayList listeners) {
        for (int i = 0; i < listeners.size(); i++) {
            HttpSessionListener listener = (HttpSessionListener) listeners.get(i);
            if ((listener != null) && (listener instanceof IBMSessionListener)) {
                return true;
            }
        }
        return false;
    }
1060502
private boolean checkPermission(String permission) {
        int res = ctx.checkCallingOrSelfPermission(permission);
        return (res == PackageManager.PERMISSION_GRANTED);
    }
1272980
public static boolean hasPermission(final String permission) {
        final SecurityContext context = SecurityContextHolder.getContext();
        if (context != null) {
            final Authentication authentication = context.getAuthentication();
            if (authentication != null) {
                for (final GrantedAuthority authority : authentication.getAuthorities()) {
                    if (authority.getAuthority().equals(permission)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
1020307
@TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean hasCompassSensorFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_COMPASS);
    }
1367666
public boolean has() {
        return attributeHolder.getAttribute(getMessagesKey(), UserMessages.class).filter(messages -> {
            return !messages.isEmpty();
        }).isPresent();
    }
65373
public boolean isEnabledSaslMechanism(String saslMechanism) {
        // If enabledSaslMechanisms is not set, then all mechanisms which are not blacklisted are enabled per default.
        if (enabledSaslMechanisms == null) {
            return !SASLAuthentication.getBlacklistedSASLMechanisms().contains(saslMechanism);
        }
        return enabledSaslMechanisms.contains(saslMechanism);
    }
545957
@TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean hasAccelerometerSensorFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER);
    }
93545
private static boolean validDeviceMode(String deviceMode) {
        Map<String, Boolean> validModes = new HashMap<>(3);
        validModes.put("r", true);
        validModes.put("w", true);
        validModes.put("m", true);

        if (isEmpty(deviceMode)) {
            return false;
        }

        for (char ch : deviceMode.toCharArray()) {
            final String mode = String.valueOf(ch);
            if (isNotTrue(validModes.get(mode))) {
                return false; // wrong mode
            }
            validModes.put(mode, false);
        }

        return true;
    }
1242577
@TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean hasNetworkLocationFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_LOCATION_NETWORK);
    }
693206
public static boolean hasPermission(String permission) {
        return getSubject() != null && permission != null
                && permission.length() > 0
                && getSubject().isPermitted(permission);
    }
191690
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
    public static boolean hasJazzhandMultiFakeTouchFeature(PackageManager manager) {
        return manager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND);
    }