diff options
author | Marvin Paul <marvinpaul@google.com> | 2014-12-30 00:53:52 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2014-12-30 00:53:52 +0000 |
commit | 8298afbc78f2b2c609f2e52ca3fc7c6a2cd9797e (patch) | |
tree | fcb8306d804045c96be39c3e14b6d74d8672ee79 /packages/SettingsProvider | |
parent | 1d23da911a698ee1cc0503118f661ef0609ea8e9 (diff) | |
parent | a30fdf790d66e241252c51d7dbdc401e021e51ad (diff) | |
download | frameworks_base-8298afbc78f2b2c609f2e52ca3fc7c6a2cd9797e.zip frameworks_base-8298afbc78f2b2c609f2e52ca3fc7c6a2cd9797e.tar.gz frameworks_base-8298afbc78f2b2c609f2e52ca3fc7c6a2cd9797e.tar.bz2 |
Merge "Don\'t backup ringtone on non-telephony devices." into lmp-mr1-dev
automerge: a30fdf7
* commit 'a30fdf790d66e241252c51d7dbdc401e021e51ad':
Don't backup ringtone on non-telephony devices.
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java index 91199c1..4144c80 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java @@ -30,6 +30,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserManager; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.text.TextUtils; import java.util.Locale; @@ -38,11 +39,14 @@ public class SettingsHelper { private static final String SILENT_RINGTONE = "_silent"; private Context mContext; private AudioManager mAudioManager; + private TelephonyManager mTelephonyManager; public SettingsHelper(Context context) { mContext = context; mAudioManager = (AudioManager) context .getSystemService(Context.AUDIO_SERVICE); + mTelephonyManager = (TelephonyManager) context + .getSystemService(Context.TELEPHONY_SERVICE); } /** @@ -75,12 +79,23 @@ public class SettingsHelper { } public String onBackupValue(String name, String value) { - // Special processing for backing up ringtones + // Special processing for backing up ringtones & notification sounds if (Settings.System.RINGTONE.equals(name) || Settings.System.NOTIFICATION_SOUND.equals(name)) { if (value == null) { - // Silent ringtone - return SILENT_RINGTONE; + if (Settings.System.RINGTONE.equals(name)) { + // For ringtones, we need to distinguish between non-telephony vs telephony + if (mTelephonyManager != null && mTelephonyManager.isVoiceCapable()) { + // Backup a null ringtone as silent on voice-capable devices + return SILENT_RINGTONE; + } else { + // Skip backup of ringtone on non-telephony devices. + return null; + } + } else { + // Backup a null notification sound as silent + return SILENT_RINGTONE; + } } else { return getCanonicalRingtoneValue(value); } |