summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/settings/DialerSettingsActivity.java
diff options
context:
space:
mode:
authoruabdullah <uabdullah@google.com>2018-03-01 18:10:50 -0800
committerCopybara-Service <copybara-piper@google.com>2018-03-02 10:14:04 -0800
commitc378fb17f0ae994b950273e0f91b5692ad7638cf (patch)
treebdd9ba6235354cfe21ad589afd728d8bbbda0209 /java/com/android/dialer/app/settings/DialerSettingsActivity.java
parent83f06749ec7d4c11003a055d35968a82562a2c55 (diff)
Remove dialer sounds and vibrations settings fragments and redirect to the system sound settings fragment instead.
There is no need for dialer to have it's own sounds and vibrations fragment. Instead of maintaining two separate fragments that do that same thing (and have to be kept in sync), we can just have one source of truth and have users modify those settings. Thus we have removed the dialer and vibrations settings fragment and have it instead re-direct to the system sound settings. The automatic advantage of this is also that for dual sim cases, dialer settings don't need to be updated. Bug: 73750524 Test: Manual. Navigated to the dialer sound and settings fragment, and it opened the system settings. Also pressing back took us back to Dialer as expected. PiperOrigin-RevId: 187564461 Change-Id: I7d620721237f1c932ed8cea949486ae7dbdefba1
Diffstat (limited to 'java/com/android/dialer/app/settings/DialerSettingsActivity.java')
-rw-r--r--java/com/android/dialer/app/settings/DialerSettingsActivity.java21
1 files changed, 15 insertions, 6 deletions
diff --git a/java/com/android/dialer/app/settings/DialerSettingsActivity.java b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
index cbd9e7950..24e5fe8aa 100644
--- a/java/com/android/dialer/app/settings/DialerSettingsActivity.java
+++ b/java/com/android/dialer/app/settings/DialerSettingsActivity.java
@@ -102,7 +102,6 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity {
Header soundSettingsHeader = new Header();
soundSettingsHeader.titleRes = R.string.sounds_and_vibration_title;
- soundSettingsHeader.fragment = SoundSettingsFragment.class.getName();
soundSettingsHeader.id = R.id.settings_header_sounds_and_vibration;
target.add(soundSettingsHeader);
@@ -271,22 +270,32 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity {
&& getResources().getBoolean(R.bool.config_sort_order_user_changeable);
}
+ /**
+ * For the "sounds and vibration" setting, we go directly to the system sound settings fragment.
+ * This helps since:
+ * <li>We don't need a separate Dialer sounds and vibrations fragment, as everything we need is
+ * present in the system sounds fragment.
+ * <li>OEM's e.g Moto that support dual sim ring-tones no longer need to update the dialer sound
+ * and settings fragment.
+ *
+ * <p>For all other settings, we launch our our preferences fragment.
+ */
@Override
public void onHeaderClick(Header header, int position) {
if (header.id == R.id.settings_header_sounds_and_vibration) {
- // If we don't have the permission to write to system settings, go to system sound
- // settings instead. Otherwise, perform the super implementation (which launches our
- // own preference fragment.
+
if (!Settings.System.canWrite(this)) {
Toast.makeText(
this,
getResources().getString(R.string.toast_cannot_write_system_settings),
Toast.LENGTH_SHORT)
.show();
- startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
- return;
}
+
+ startActivity(new Intent(Settings.ACTION_SOUND_SETTINGS));
+ return;
}
+
super.onHeaderClick(header, position);
}