diff options
author | Brandon Maxwell <maxwelb@google.com> | 2015-11-25 17:20:05 -0800 |
---|---|---|
committer | Brandon Maxwell <maxwelb@google.com> | 2015-11-30 12:02:39 -0800 |
commit | dc1806ee3b840a16ec28fb9c4bea1ae848bd1939 (patch) | |
tree | 1a413cddcd9317de179ad73eac02f80a24e11ad3 | |
parent | 2dd62788bbc6aa486899b18869a7fdfaec056314 (diff) |
Compat changes for Dialer Settings
These settings were removed from the Settings screens
since TelecomManager won't respond to the corresponding intents that
would be fired off.
Bug: 25776171
Change-Id: I425832245744239d636f227178479fbb5aa49092
-rw-r--r-- | src/com/android/dialer/settings/DialerSettingsActivity.java | 24 | ||||
-rw-r--r-- | src/com/android/dialer/settings/SoundSettingsFragment.java | 5 |
2 files changed, 20 insertions, 9 deletions
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index a6e8944d4..cc84486de 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -18,6 +18,7 @@ package com.android.dialer.settings; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.os.Build; import android.os.Bundle; import android.os.UserManager; import android.preference.PreferenceManager; @@ -27,6 +28,7 @@ import android.telephony.TelephonyManager; import android.view.MenuItem; import android.widget.Toast; +import com.android.contacts.common.compat.SdkVersionOverride; import com.android.dialer.R; import com.android.dialer.compat.SettingsCompat; import com.android.dialer.filterednumber.BlockedNumbersSettingsActivity; @@ -55,12 +57,16 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { soundSettingsHeader.id = R.id.settings_header_sounds_and_vibration; target.add(soundSettingsHeader); - Header quickResponseSettingsHeader = new Header(); - Intent quickResponseSettingsIntent = - new Intent(TelecomManager.ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS); - quickResponseSettingsHeader.titleRes = R.string.respond_via_sms_setting_title; - quickResponseSettingsHeader.intent = quickResponseSettingsIntent; - target.add(quickResponseSettingsHeader); + if (SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) + >= Build.VERSION_CODES.M) { + Header quickResponseSettingsHeader = new Header(); + Intent quickResponseSettingsIntent = + new Intent(TelecomManager.ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS); + quickResponseSettingsHeader.titleRes = R.string.respond_via_sms_setting_title; + quickResponseSettingsHeader.intent = quickResponseSettingsIntent; + target.add(quickResponseSettingsHeader); + } + TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); @@ -92,8 +98,10 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { blockedCallsHeader.intent = new Intent(this, BlockedNumbersSettingsActivity.class); target.add(blockedCallsHeader); - if (telephonyManager.isTtyModeSupported() - || telephonyManager.isHearingAidCompatibilitySupported()) { + if (SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) + >= Build.VERSION_CODES.M + && (telephonyManager.isTtyModeSupported() + || telephonyManager.isHearingAidCompatibilitySupported())) { Header accessibilitySettingsHeader = new Header(); Intent accessibilitySettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS); diff --git a/src/com/android/dialer/settings/SoundSettingsFragment.java b/src/com/android/dialer/settings/SoundSettingsFragment.java index 30a25a384..59f8798c3 100644 --- a/src/com/android/dialer/settings/SoundSettingsFragment.java +++ b/src/com/android/dialer/settings/SoundSettingsFragment.java @@ -18,6 +18,7 @@ package com.android.dialer.settings; import android.content.Context; import android.media.RingtoneManager; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Message; @@ -32,6 +33,7 @@ import android.telephony.CarrierConfigManager; import android.telephony.TelephonyManager; import android.widget.Toast; +import com.android.contacts.common.compat.SdkVersionOverride; import com.android.dialer.R; import com.android.dialer.compat.SettingsCompat; import com.android.phone.common.util.SettingsUtil; @@ -109,7 +111,8 @@ public class SoundSettingsFragment extends PreferenceFragment TelephonyManager telephonyManager = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); - if (telephonyManager.canChangeDtmfToneLength() + if (SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.M) >= Build.VERSION_CODES.M + && telephonyManager.canChangeDtmfToneLength() && (telephonyManager.isWorldPhone() || !shouldHideCarrierSettings())) { mDtmfToneLength.setOnPreferenceChangeListener(this); mDtmfToneLength.setValueIndex( |