media encryption mandatory

This commit is contained in:
Claire Rosset 2019-06-14 11:36:33 +02:00
parent 734b69c619
commit 42117c8a40
4 changed files with 28 additions and 0 deletions

View file

@ -47,6 +47,7 @@ public class CallSettingsFragment extends SettingsFragment {
private LinphonePreferences mPrefs; private LinphonePreferences mPrefs;
private SwitchSetting mDeviceRingtone, private SwitchSetting mDeviceRingtone,
mMediaEncryptionMandatory,
mVibrateIncomingCall, mVibrateIncomingCall,
mDtmfSipInfo, mDtmfSipInfo,
mDtmfRfc2833, mDtmfRfc2833,
@ -100,6 +101,8 @@ public class CallSettingsFragment extends SettingsFragment {
mDndPermissionSettings = mDndPermissionSettings =
mRootView.findViewById(R.id.pref_grant_read_dnd_settings_permission); mRootView.findViewById(R.id.pref_grant_read_dnd_settings_permission);
mMediaEncryptionMandatory = mRootView.findViewById(R.id.pref_media_encryption_mandatory);
} }
private void setListeners() { private void setListeners() {
@ -212,6 +215,14 @@ public class CallSettingsFragment extends SettingsFragment {
new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS")); new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"));
} }
}); });
mMediaEncryptionMandatory.setListener(
new SettingListenerBase() {
@Override
public void onBoolValueChanged(boolean newValue) {
mPrefs.setMediaEncryptionMandatory(newValue);
}
});
} }
private void updateValues() { private void updateValues() {
@ -237,6 +248,8 @@ public class CallSettingsFragment extends SettingsFragment {
mDndPermissionSettings.setVisibility( mDndPermissionSettings.setVisibility(
Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60) ? View.VISIBLE : View.GONE); Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60) ? View.VISIBLE : View.GONE);
mMediaEncryptionMandatory.setChecked(mPrefs.acceptMediaEncryptionMandatory());
setListeners(); setListeners();
} }

View file

@ -452,6 +452,14 @@ public class LinphonePreferences {
// End of contact settings // End of contact settings
// Call settings // Call settings
public boolean acceptMediaEncryptionMandatory() {
return getLc().isMediaEncryptionMandatory();
}
public void setMediaEncryptionMandatory(boolean accept) {
getLc().setMediaEncryptionMandatory(accept);
}
public boolean acceptIncomingEarlyMedia() { public boolean acceptIncomingEarlyMedia() {
return getConfig().getBool("sip", "incoming_calls_early_media", false); return getConfig().getBool("sip", "incoming_calls_early_media", false);
} }

View file

@ -36,6 +36,12 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
linphone:title="@string/pref_media_encryption" /> linphone:title="@string/pref_media_encryption" />
<org.linphone.settings.widget.SwitchSetting
android:id="@+id/pref_media_encryption_mandatory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
linphone:title="@string/pref_media_encryption_mandatory_title" />
<org.linphone.settings.widget.SwitchSetting <org.linphone.settings.widget.SwitchSetting
android:id="@+id/pref_sipinfo_dtmf" android:id="@+id/pref_sipinfo_dtmf"
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -450,6 +450,7 @@
<string name="pref_accept_early_media">Accept early-media</string> <string name="pref_accept_early_media">Accept early-media</string>
<string name="pref_grant_read_dnd_settings_permission_title">Do Not Disturb settings</string> <string name="pref_grant_read_dnd_settings_permission_title">Do Not Disturb settings</string>
<string name="pref_grant_read_dnd_settings_permission_desc">We need you to grant use the access to the Do Not Disturb settings to correctly ring or not depending on the current policy</string> <string name="pref_grant_read_dnd_settings_permission_desc">We need you to grant use the access to the Do Not Disturb settings to correctly ring or not depending on the current policy</string>
<string name="pref_media_encryption_mandatory_title">Media encryption mandatory</string>
<!-- Chat settings --> <!-- Chat settings -->
<string name="pref_chat_title">Chat</string> <string name="pref_chat_title">Chat</string>