@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.settings);

    int activePhoneType = TelephonyManager.getDefault().getPhoneType();

    PreferenceGroup parent = (PreferenceGroup) findPreference(KEY_PARENT);
    Utils.updatePreferenceToSpecificActivityOrRemove(this, parent, KEY_SYNC_SETTINGS, 0);

    Preference dockSettings = parent.findPreference(KEY_DOCK_SETTINGS);
    if (getResources().getBoolean(R.bool.has_dock_settings) == false && dockSettings != null) {
      parent.removePreference(dockSettings);
    }

    Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(
        this, parent, KEY_OPERATOR_SETTINGS);
    Utils.updatePreferenceToSpecificActivityFromMetaDataOrRemove(
        this, parent, KEY_MANUFACTURER_SETTINGS);
  }
Example #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ContentResolver resolver = getContentResolver();
    int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();

    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    addPreferencesFromResource(R.xml.sound_settings);

    if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
      // device is not CDMA, do not display CDMA emergency_tone
      getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
    }

    if (!getResources().getBoolean(R.bool.has_silent_mode)) {
      findPreference(KEY_RING_VOLUME).setDependency(null);
    }

    if (getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume)) {
      // device with fixed volume policy, do not display volumes submenu
      getPreferenceScreen().removePreference(findPreference(KEY_RING_VOLUME));
    }

    mVibrateWhenRinging = (CheckBoxPreference) findPreference(KEY_VIBRATE);
    mVibrateWhenRinging.setPersistent(false);
    mVibrateWhenRinging.setChecked(
        Settings.System.getInt(resolver, Settings.System.VIBRATE_WHEN_RINGING, 0) != 0);

    mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
    mDtmfTone.setPersistent(false);
    mDtmfTone.setChecked(
        Settings.System.getInt(resolver, Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0);
    mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);
    mSoundEffects.setPersistent(false);
    mSoundEffects.setChecked(
        Settings.System.getInt(resolver, Settings.System.SOUND_EFFECTS_ENABLED, 1) != 0);
    mHapticFeedback = (CheckBoxPreference) findPreference(KEY_HAPTIC_FEEDBACK);
    mHapticFeedback.setPersistent(false);
    mHapticFeedback.setChecked(
        Settings.System.getInt(resolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
    mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
    mLockSounds.setPersistent(false);
    mLockSounds.setChecked(
        Settings.System.getInt(resolver, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);

    mRingtonePreference = findPreference(KEY_RINGTONE);
    mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);

    Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    if (vibrator == null || !vibrator.hasVibrator()) {
      removePreference(KEY_VIBRATE);
      removePreference(KEY_HAPTIC_FEEDBACK);
    }

    if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
      ListPreference emergencyTonePreference = (ListPreference) findPreference(KEY_EMERGENCY_TONE);
      emergencyTonePreference.setValue(
          String.valueOf(
              Settings.Global.getInt(
                  resolver, Settings.Global.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
      emergencyTonePreference.setOnPreferenceChangeListener(this);
    }

    mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);

    mMusicFx = mSoundSettings.findPreference(KEY_MUSICFX);
    Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
    PackageManager p = getPackageManager();
    List<ResolveInfo> ris = p.queryIntentActivities(i, PackageManager.GET_DISABLED_COMPONENTS);
    if (ris.size() <= 2) {
      // no need to show the item if there is no choice for the user to make
      // note: the built in musicfx panel has two activities (one being a
      // compatibility shim that launches either the other activity, or a
      // third party one), hence the check for <=2. If the implementation
      // of the compatbility layer changes, this check may need to be updated.
      mSoundSettings.removePreference(mMusicFx);
    }

    if (!Utils.isVoiceCapable(getActivity())) {
      for (String prefKey : NEED_VOICE_CAPABILITY) {
        Preference pref = findPreference(prefKey);
        if (pref != null) {
          getPreferenceScreen().removePreference(pref);
        }
      }
    }

    mRingtoneLookupRunnable =
        new Runnable() {
          public void run() {
            if (mRingtonePreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_RINGTONE, mRingtonePreference, MSG_UPDATE_RINGTONE_SUMMARY);
            }
            if (mNotificationPreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_NOTIFICATION,
                  mNotificationPreference,
                  MSG_UPDATE_NOTIFICATION_SUMMARY);
            }
          }
        };

    initDockSettings();

    // add by lixd   start----------------------------
    getPreferenceScreen().removePreference(findPreference(KEY_VIBRATE));
    getPreferenceScreen().removePreference(findPreference(KEY_RINGTONE));

    getPreferenceScreen().removePreference(findPreference(KEY_DTMF_TONE));

    getPreferenceScreen().removePreference(findPreference(KEY_SOUND_EFFECTS));
    getPreferenceScreen().removePreference(findPreference(KEY_HAPTIC_FEEDBACK));
    getPreferenceScreen().removePreference(findPreference(KEY_CATEGORY_CALLS));
    // getPreferenceScreen().removePreference(findPreference(KEY_SOUND_SETTINGS));
    getPreferenceScreen().removePreference(findPreference(KEY_LOCK_SOUNDS));
    getPreferenceScreen().removePreference(findPreference(KEY_NOTIFICATION_SOUND));
    // getPreferenceScreen().removePreference(findPreference(KEY_CATEGORY_CALLS));
    // getPreferenceScreen().removePreference(findPreference(KEY_DOCK_CATEGORY));
    // getPreferenceScreen().removePreference(findPreference(KEY_DOCK_AUDIO_SETTINGS));
    // getPreferenceScreen().removePreference(findPreference(KEY_DOCK_SOUNDS));
    // getPreferenceScreen().removePreference(findPreference(KEY_DOCK_AUDIO_MEDIA_ENABLED));
    // --------------end--------------------
  }
 @SuppressWarnings("deprecation")
 public Preference findPreference(CharSequence key) {
   return preferenceGroup == null
       ? preferenceActivity.findPreference(key)
       : preferenceGroup.findPreference(key);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ContentResolver resolver = getContentResolver();
    int activePhoneType = TelephonyManager.getDefault().getPhoneType();

    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    addPreferencesFromResource(R.xml.sound_settings);

    if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
      // device is not CDMA, do not display CDMA emergency_tone
      getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
    }

    mSilent = (CheckBoxPreference) findPreference(KEY_SILENT);

    mVibrate = (ListPreference) findPreference(KEY_VIBRATE);
    mVibrate.setOnPreferenceChangeListener(this);

    mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
    mDtmfTone.setPersistent(false);
    mDtmfTone.setChecked(
        Settings.System.getInt(resolver, Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0);
    mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);
    mSoundEffects.setPersistent(false);
    mSoundEffects.setChecked(
        Settings.System.getInt(resolver, Settings.System.SOUND_EFFECTS_ENABLED, 0) != 0);
    mHapticFeedback = (CheckBoxPreference) findPreference(KEY_HAPTIC_FEEDBACK);
    mHapticFeedback.setPersistent(false);
    mHapticFeedback.setChecked(
        Settings.System.getInt(resolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0);
    mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
    mLockSounds.setPersistent(false);
    mLockSounds.setChecked(
        Settings.System.getInt(resolver, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);
    mPowerSounds = (CheckBoxPreference) findPreference(KEY_POWER_SOUNDS);
    mPowerSounds.setPersistent(false);
    mPowerSounds.setChecked(
        Settings.System.getInt(resolver, Settings.System.POWER_SOUNDS_ENABLED, 1) != 0);

    if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
      ListPreference emergencyTonePreference = (ListPreference) findPreference(KEY_EMERGENCY_TONE);
      emergencyTonePreference.setValue(
          String.valueOf(
              Settings.System.getInt(
                  resolver, Settings.System.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
      emergencyTonePreference.setOnPreferenceChangeListener(this);
    }

    mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);
    mNotificationPulse = (CheckBoxPreference) mSoundSettings.findPreference(KEY_NOTIFICATION_PULSE);
    mNotificationBlink = (CheckBoxPreference) mSoundSettings.findPreference(KEY_NOTIFICATION_BLINK);
    mNotificationAlwaysOn =
        (CheckBoxPreference) mSoundSettings.findPreference(KEY_NOTIFICATION_ALWAYS_ON);
    mNotificationCharging =
        (CheckBoxPreference) mSoundSettings.findPreference(KEY_NOTIFICATION_CHARGING);

    boolean amberGreenLight =
        getResources().getBoolean(com.android.internal.R.bool.config_amber_green_light);

    if (amberGreenLight) {
      mSoundSettings.removePreference(mNotificationPulse);

      mNotificationBlink.setChecked(
          Settings.System.getInt(resolver, Settings.System.NOTIFICATION_LIGHT_BLINK, 1) == 1);
      mNotificationBlink.setOnPreferenceChangeListener(this);

      mNotificationAlwaysOn.setChecked(
          Settings.System.getInt(resolver, Settings.System.NOTIFICATION_LIGHT_ALWAYS_ON, 1) == 1);
      mNotificationAlwaysOn.setOnPreferenceChangeListener(this);

      mNotificationCharging.setChecked(
          Settings.System.getInt(resolver, Settings.System.NOTIFICATION_LIGHT_CHARGING, 1) == 1);
      mNotificationCharging.setOnPreferenceChangeListener(this);

    } else {
      mSoundSettings.removePreference(mNotificationBlink);
      mSoundSettings.removePreference(mNotificationAlwaysOn);
      mSoundSettings.removePreference(mNotificationCharging);

      if (mNotificationPulse != null
          && getResources().getBoolean(R.bool.has_intrusive_led) == false) {
        mSoundSettings.removePreference(mNotificationPulse);
      } else {
        try {
          mNotificationPulse.setChecked(
              Settings.System.getInt(resolver, Settings.System.NOTIFICATION_LIGHT_PULSE) == 1);
          mNotificationPulse.setOnPreferenceChangeListener(this);
        } catch (SettingNotFoundException snfe) {
          Log.e(TAG, Settings.System.NOTIFICATION_LIGHT_PULSE + " not found");
        }
      }
    }
  }
Example #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ContentResolver resolver = getContentResolver();
    int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();

    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    addPreferencesFromResource(R.xml.sound_settings);

    if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
      // device is not CDMA, do not display CDMA emergency_tone
      getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
    }

    // mzikun add for settings menu
    // mPhone = PhoneApp.getInstance().getPhone();

    mSilentMode = (ListPreference) findPreference(KEY_SILENT_MODE);
    if (!getResources().getBoolean(R.bool.has_silent_mode)) {
      getPreferenceScreen().removePreference(mSilentMode);
      findPreference(KEY_RING_VOLUME).setDependency(null);
    } else {
      mSilentMode.setOnPreferenceChangeListener(this);
    }

    mVibrateOnRing = (CheckBoxPreference) findPreference(KEY_VIBRATE);
    mVibrateOnRing.setOnPreferenceChangeListener(this);

    mDtmfTone = (CheckBoxPreference) findPreference(KEY_DTMF_TONE);
    mDtmfTone.setPersistent(false);
    mDtmfTone.setChecked(
        Settings.System.getInt(resolver, Settings.System.DTMF_TONE_WHEN_DIALING, 1) != 0);
    mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);
    mSoundEffects.setPersistent(false);
    mSoundEffects.setChecked(
        Settings.System.getInt(resolver, Settings.System.SOUND_EFFECTS_ENABLED, 1) != 0);
    mHapticFeedback = (CheckBoxPreference) findPreference(KEY_HAPTIC_FEEDBACK);
    mHapticFeedback.setPersistent(false);
    mHapticFeedback.setChecked(
        Settings.System.getInt(resolver, Settings.System.HAPTIC_FEEDBACK_ENABLED, 1) != 0);
    mLockSounds = (CheckBoxPreference) findPreference(KEY_LOCK_SOUNDS);
    mLockSounds.setPersistent(false);
    mLockSounds.setChecked(
        Settings.System.getInt(resolver, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) != 0);

    mRingtonePreference = findPreference(KEY_RINGTONE);
    mMultiSimRingtonePreference = findPreference(KEY_MULTISIM_RINGTONE);
    if (TelephonyManager.getDefault().isMultiSimEnabled()) {
      // if it support multi sim, remove ringtone setting, show multi sim ringtone setting
      getPreferenceScreen().removePreference(mRingtonePreference);
      mRingtonePreference = null;
    } else {
      // if it is not multi sim, remove multi sim ringtone setting, and show ringtone setting
      getPreferenceScreen().removePreference(mMultiSimRingtonePreference);
      mMultiSimRingtonePreference = null;
    }
    mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);

    if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) {
      getPreferenceScreen().removePreference(mVibrateOnRing);
      getPreferenceScreen().removePreference(mHapticFeedback);
    }

    if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
      ListPreference emergencyTonePreference = (ListPreference) findPreference(KEY_EMERGENCY_TONE);
      emergencyTonePreference.setValue(
          String.valueOf(
              Settings.System.getInt(
                  resolver, Settings.System.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
      emergencyTonePreference.setOnPreferenceChangeListener(this);
    }

    mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);

    mMusicFx = mSoundSettings.findPreference(KEY_MUSICFX);
    Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
    PackageManager p = getPackageManager();
    List<ResolveInfo> ris = p.queryIntentActivities(i, PackageManager.GET_DISABLED_COMPONENTS);
    if (ris.size() <= 2) {
      // no need to show the item if there is no choice for the user to make
      // note: the built in musicfx panel has two activities (one being a
      // compatibility shim that launches either the other activity, or a
      // third party one), hence the check for <=2. If the implementation
      // of the compatbility layer changes, this check may need to be updated.
      mSoundSettings.removePreference(mMusicFx);
    }

    if (!Utils.isVoiceCapable(getActivity())) {
      for (String prefKey : NEED_VOICE_CAPABILITY) {
        Preference pref = findPreference(prefKey);
        if (pref != null) {
          getPreferenceScreen().removePreference(pref);
        }
      }
    }

    /*Begin: mzikun add for settings menu*/
    mReverseCallMute = (CheckBoxPreference) findPreference(KEY_REVERSE_CALL_MUTE);
    if (mReverseCallMute != null) {
      mReverseCallMute.setPersistent(false);
      mReverseCallMute.setOnPreferenceChangeListener(this);
    } else {
      getPreferenceScreen().removePreference(mReverseCallMute);
      mReverseCallMute = null;
    }

    mReverseMP3Mute = (CheckBoxPreference) findPreference(KEY_REVERSE_MP3_MUTE);
    if (mReverseMP3Mute != null) {
      mReverseMP3Mute.setPersistent(false);
      mReverseMP3Mute.setOnPreferenceChangeListener(this);
    } else {
      getPreferenceScreen().removePreference(mReverseMP3Mute);
      mReverseMP3Mute = null;
    }

    mReverseMP4Mute = (CheckBoxPreference) findPreference(KEY_REVERSE_MP4_MUTE);
    if (mReverseMP4Mute != null) {
      mReverseMP4Mute.setPersistent(false);
      mReverseMP4Mute.setOnPreferenceChangeListener(this);
    } else {
      getPreferenceScreen().removePreference(mReverseMP4Mute);
      mReverseMP4Mute = null;
    }
    /*End: mzikun add for settings menu*/

    mRingtoneLookupRunnable =
        new Runnable() {
          public void run() {
            if (mRingtonePreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_RINGTONE, mRingtonePreference, MSG_UPDATE_RINGTONE_SUMMARY);
            }
            if (mNotificationPreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_NOTIFICATION,
                  mNotificationPreference,
                  MSG_UPDATE_NOTIFICATION_SUMMARY);
            }
          }
        };
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ContentResolver resolver = getContentResolver();
    int activePhoneType = TelephonyManager.getDefault().getCurrentPhoneType();

    mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

    addPreferencesFromResource(R.xml.sound_settings);

    if (TelephonyManager.PHONE_TYPE_CDMA != activePhoneType) {
      // device is not CDMA, do not display CDMA emergency_tone
      getPreferenceScreen().removePreference(findPreference(KEY_EMERGENCY_TONE));
    }

    mVolumeOverlay = (ListPreference) findPreference(KEY_VOLUME_OVERLAY);
    mVolumeOverlay.setOnPreferenceChangeListener(this);
    int volumeOverlay =
        Settings.System.getInt(
            getContentResolver(),
            Settings.System.MODE_VOLUME_OVERLAY,
            VolumePanel.VOLUME_OVERLAY_EXPANDABLE);
    mVolumeOverlay.setValue(Integer.toString(volumeOverlay));
    mVolumeOverlay.setSummary(mVolumeOverlay.getEntry());

    mRingMode = (ListPreference) findPreference(KEY_RING_MODE);
    if (!getResources().getBoolean(R.bool.has_silent_mode)) {
      getPreferenceScreen().removePreference(mRingMode);
      findPreference(KEY_RING_VOLUME).setDependency(null);
    } else {
      mRingMode.setOnPreferenceChangeListener(this);
    }

    if (getResources().getBoolean(com.android.internal.R.bool.config_useFixedVolume)) {
      // device with fixed volume policy, do not display volumes submenu
      getPreferenceScreen().removePreference(findPreference(KEY_RING_VOLUME));
    }

    mQuietHours = (PreferenceScreen) findPreference(KEY_QUIET_HOURS);
    updateQuietHoursSummary();

    mSoundEffects = (CheckBoxPreference) findPreference(KEY_SOUND_EFFECTS);

    if (!Utils.hasVolumeRocker(getActivity())) {
      getPreferenceScreen().removePreference(findPreference(KEY_VOLUME_ADJUST_SOUNDS));
    }

    mRingtonePreference = findPreference(KEY_RINGTONE);
    mNotificationPreference = findPreference(KEY_NOTIFICATION_SOUND);

    Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
    if (vibrator == null || !vibrator.hasVibrator()) {
      removePreference(KEY_VIBRATE);
      removePreference(KEY_HAPTIC_FEEDBACK);
      removePreference(KEY_VIBRATION_INTENSITY);
      removePreference(KEY_CONVERT_SOUND_TO_VIBRATE);
      removePreference(KEY_VIBRATE_DURING_CALLS);
    } else if (!VibratorIntensity.isSupported()) {
      removePreference(KEY_VIBRATION_INTENSITY);
    }

    if (TelephonyManager.PHONE_TYPE_CDMA == activePhoneType) {
      ListPreference emergencyTonePreference = (ListPreference) findPreference(KEY_EMERGENCY_TONE);
      emergencyTonePreference.setValue(
          String.valueOf(
              Settings.Global.getInt(
                  resolver, Settings.Global.EMERGENCY_TONE, FALLBACK_EMERGENCY_TONE_VALUE)));
      emergencyTonePreference.setOnPreferenceChangeListener(this);
    }

    mSoundSettings = (PreferenceGroup) findPreference(KEY_SOUND_SETTINGS);

    mMusicFx = mSoundSettings.findPreference(KEY_MUSICFX);
    Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL);
    mMusicFx.setIntent(i);
    PackageManager p = getPackageManager();
    List<ResolveInfo> ris = p.queryIntentActivities(i, 0);
    if (ris.size() == 0) {
      mSoundSettings.removePreference(mMusicFx);
    } else if (ris.size() == 1) {
      mMusicFx.setSummary(ris.get(0).loadLabel(p));
    }

    if (!Utils.isVoiceCapable(getActivity())) {
      for (String prefKey : NEED_VOICE_CAPABILITY) {
        Preference pref = findPreference(prefKey);
        if (pref != null) {
          getPreferenceScreen().removePreference(pref);
        }
      }
      mRingtonePreference = null;
    }

    mRingtoneLookupRunnable =
        new Runnable() {
          public void run() {
            if (mRingtonePreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_RINGTONE, mRingtonePreference, MSG_UPDATE_RINGTONE_SUMMARY);
            }
            if (mNotificationPreference != null) {
              updateRingtoneName(
                  RingtoneManager.TYPE_NOTIFICATION,
                  mNotificationPreference,
                  MSG_UPDATE_NOTIFICATION_SUMMARY);
            }
          }
        };

    // power state change notification sounds
    mPowerSounds = (CheckBoxPreference) findPreference(KEY_POWER_NOTIFICATIONS);
    mPowerSounds.setChecked(
        Settings.Global.getInt(resolver, Settings.Global.POWER_NOTIFICATIONS_ENABLED, 0) != 0);
    mPowerSoundsVibrate = (CheckBoxPreference) findPreference(KEY_POWER_NOTIFICATIONS_VIBRATE);
    mPowerSoundsVibrate.setChecked(
        Settings.Global.getInt(resolver, Settings.Global.POWER_NOTIFICATIONS_VIBRATE, 0) != 0);
    if (vibrator == null || !vibrator.hasVibrator()) {
      removePreference(KEY_POWER_NOTIFICATIONS_VIBRATE);
    }

    mPowerSoundsRingtone = findPreference(KEY_POWER_NOTIFICATIONS_RINGTONE);
    String currentPowerRingtonePath =
        Settings.Global.getString(resolver, Settings.Global.POWER_NOTIFICATIONS_RINGTONE);

    // set to default notification if we don't yet have one
    if (currentPowerRingtonePath == null) {
      currentPowerRingtonePath = Settings.System.DEFAULT_NOTIFICATION_URI.toString();
      Settings.Global.putString(
          getContentResolver(),
          Settings.Global.POWER_NOTIFICATIONS_RINGTONE,
          currentPowerRingtonePath);
    }
    // is it silent ?
    if (currentPowerRingtonePath.equals(POWER_NOTIFICATIONS_SILENT_URI)) {
      mPowerSoundsRingtone.setSummary(getString(R.string.power_notifications_ringtone_silent));
    } else {
      final Ringtone ringtone =
          RingtoneManager.getRingtone(getActivity(), Uri.parse(currentPowerRingtonePath));
      if (ringtone != null) {
        mPowerSoundsRingtone.setSummary(ringtone.getTitle(getActivity()));
      }
    }

    initDockSettings();
  }