Commit 2d8c15dc authored by Francisco Cunha's avatar Francisco Cunha

P4A-875 - Fix default notification sound crashing android Q

removed content://settings/system/notification_sound from settings
parent 5b377423
......@@ -360,7 +360,7 @@ public class Account implements BaseAccount, StoreConfig {
notificationSetting.setVibratePattern(0);
notificationSetting.setVibrateTimes(5);
notificationSetting.setRingEnabled(true);
notificationSetting.setRingtone("content://settings/system/notification_sound");
notificationSetting.setRingtone("");
notificationSetting.setLedColor(chipColor);
pEpUntrustedServer = DEFAULT_PEP_ENC_ON_SERVER;
......@@ -470,8 +470,7 @@ public class Account implements BaseAccount, StoreConfig {
notificationSetting.setVibratePattern(storage.getInt(accountUuid + ".vibratePattern", 0));
notificationSetting.setVibrateTimes(storage.getInt(accountUuid + ".vibrateTimes", 5));
notificationSetting.setRingEnabled(storage.getBoolean(accountUuid + ".ring", true));
notificationSetting.setRingtone(storage.getString(accountUuid + ".ringtone",
"content://settings/system/notification_sound"));
notificationSetting.setRingtone(storage.getString(accountUuid + ".ringtone", ""));
notificationSetting.setLed(storage.getBoolean(accountUuid + ".led", true));
notificationSetting.setLedColor(storage.getInt(accountUuid + ".ledColor", chipColor));
......@@ -1683,6 +1682,13 @@ public class Account implements BaseAccount, StoreConfig {
return notificationSetting;
}
public synchronized String getAccountRingtone() {
String ringtone = getNotificationSetting().getRingtone();
if (ringtone != null && ringtone.contains("notification_sound"))
return "";
else
return ringtone;
}
// TODO: pEp: do we really *need* synchronized here?!
public synchronized boolean isUntrustedSever() {
......
......@@ -161,7 +161,7 @@ public class AccountSettings {
new V(1, new BooleanSetting(true))
));
s.put("ringtone", Settings.versions(
new V(1, new RingtoneSetting("content://settings/system/notification_sound"))
new V(1, new RingtoneSetting(""))
));
s.put("searchableFolders", Settings.versions(
new V(1, new EnumSetting<>(Searchable.class, Searchable.ALL))
......
......@@ -138,7 +138,7 @@ class AccountSettingsDataStore(
"account_vibrate_times" -> account.notificationSetting.vibrateTimes.toString()
"account_remote_search_num_results" -> account.remoteSearchNumResults.toString()
"local_storage_provider" -> account.localStorageProviderId
"account_ringtone" -> account.notificationSetting.ringtone
"account_ringtone" -> account.accountRingtone
else -> defValue
}
}
......
......@@ -64,8 +64,6 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
initializeCryptoSettings(account)
initializeFolderSettings(account)
initializeAccountpEpKeyReset(account)
initializeNewRingtoneOptions()
if (!BuildConfig.WITH_KEY_SYNC) {
hideKeySyncOptions()
}
......@@ -176,12 +174,6 @@ class AccountSettingsFragment : PreferenceFragmentCompat() {
findPreference(PREFERENCE_PEP_ENABLE_SYNC_ACCOUNT)?.remove()
}
private fun initializeNewRingtoneOptions() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
findPreference(PREFERENCE_RINGTONE)?.remove()
}
}
private fun dopEpKeyReset(account: Account) {
disableKeyResetClickListener()
loading?.visibility = View.VISIBLE
......
......@@ -313,11 +313,11 @@
android:title="@string/account_notify_contacts_mail_only_label" />
<com.takisoft.preferencex.RingtonePreference
android:defaultValue="content://settings/system/notification_sound"
android:dependency="account_notify"
android:key="account_ringtone"
android:ringtoneType="notification"
android:showSilent="true"
android:showDefault="false"
android:title="@string/account_settings_ringtone"
app:pref_summaryHasRingtone="%s" />
......
......@@ -16,5 +16,6 @@ android {
dependencies {
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation "com.jakewharton.timber:timber:${versions.timber}"
implementation "com.takisoft.fix:preference-v7:${versions.preferencesFix}"
implementation "androidx.preference:preference:${versions.androidX}"
implementation "com.takisoft.preferencex:preferencex:${versions.preferencesFix}"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment