Java Code Examples for android.provider.Settings.Global#getInt()

The following examples show how to use android.provider.Settings.Global#getInt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioCapabilities.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(Context context, @Nullable Intent intent) {
  if (deviceMaySetExternalSurroundSoundGlobalSetting()
      && Global.getInt(context.getContentResolver(), EXTERNAL_SURROUND_SOUND_KEY, 0) == 1) {
    return EXTERNAL_SURROUND_SOUND_CAPABILITIES;
  }
  if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
    return DEFAULT_AUDIO_CAPABILITIES;
  }
  return new AudioCapabilities(
      intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
      intent.getIntExtra(
          AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT));
}
 
Example 2
Source File: AudioCapabilities.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(Context context, @Nullable Intent intent) {
  if (deviceMaySetExternalSurroundSoundGlobalSetting()
      && Global.getInt(context.getContentResolver(), EXTERNAL_SURROUND_SOUND_KEY, 0) == 1) {
    return EXTERNAL_SURROUND_SOUND_CAPABILITIES;
  }
  if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
    return DEFAULT_AUDIO_CAPABILITIES;
  }
  return new AudioCapabilities(
      intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
      intent.getIntExtra(
          AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT));
}
 
Example 3
Source File: AudioCapabilities.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(Context context, @Nullable Intent intent) {
  if (deviceMaySetExternalSurroundSoundGlobalSetting()
      && Global.getInt(context.getContentResolver(), EXTERNAL_SURROUND_SOUND_KEY, 0) == 1) {
    return EXTERNAL_SURROUND_SOUND_CAPABILITIES;
  }
  if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
    return DEFAULT_AUDIO_CAPABILITIES;
  }
  return new AudioCapabilities(
      intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
      intent.getIntExtra(
          AudioManager.EXTRA_MAX_CHANNEL_COUNT, /* defaultValue= */ DEFAULT_MAX_CHANNEL_COUNT));
}
 
Example 4
Source File: BatterySaverStateMachine.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
@VisibleForTesting
protected int getGlobalSetting(String key, int defValue) {
    return Global.getInt(mContext.getContentResolver(), key, defValue);
}
 
Example 5
Source File: HdmiControlService.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
boolean readBooleanSetting(String key, boolean defVal) {
    ContentResolver cr = getContext().getContentResolver();
    return Global.getInt(cr, key, toInt(defVal)) == ENABLED;
}
 
Example 6
Source File: ZenModeHelper.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private int getZenModeSetting() {
    return Global.getInt(mContext.getContentResolver(), Global.ZEN_MODE, Global.ZEN_MODE_OFF);
}
 
Example 7
Source File: ZenModeHelper.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
private int getPreviousRingerModeSetting() {
    return Global.getInt(mContext.getContentResolver(),
            Global.ZEN_MODE_RINGER_LEVEL, AudioManager.RINGER_MODE_NORMAL);
}
 
Example 8
Source File: GlobalSetting.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public int getValue() {
    return Global.getInt(mContext.getContentResolver(), mSettingName, 0);
}
 
Example 9
Source File: GlobalSetting.java    From Noyze with Apache License 2.0 4 votes vote down vote up
public int getValue() {
    return Global.getInt(mContext.getContentResolver(), mSettingName, 0);
}