preferences: add SRTP options

Change-Id: Ia2b9dd7dc1ade56745046e2965190d1b442def98
diff --git a/ring-android/app/src/main/java/cx/ring/fragments/SecurityAccountFragment.java b/ring-android/app/src/main/java/cx/ring/fragments/SecurityAccountFragment.java
index 0118106..f435c3f 100644
--- a/ring-android/app/src/main/java/cx/ring/fragments/SecurityAccountFragment.java
+++ b/ring-android/app/src/main/java/cx/ring/fragments/SecurityAccountFragment.java
@@ -88,6 +88,10 @@
             }
         }
 
+        if (preference.getKey().contentEquals(ConfigKey.SRTP_KEY_EXCHANGE.key())) {
+            newValue = ((Boolean) newValue) ? "sdes" : "";
+        }
+
         if (!(preference instanceof TwoStatePreference)) {
             preference.setSummary((String) newValue);
         }
@@ -160,7 +164,11 @@
             final ConfigKey key = ConfigKey.fromString(current.getKey());
 
             if (current instanceof TwoStatePreference) {
-                ((TwoStatePreference) current).setChecked(config.getBool(key));
+                if (key == ConfigKey.SRTP_KEY_EXCHANGE) {
+                    ((TwoStatePreference) current).setChecked(config.get(key).equals("sdes"));
+                } else {
+                    ((TwoStatePreference) current).setChecked(config.getBool(key));
+                }
             } else {
                 if (key == ConfigKey.TLS_CA_LIST_FILE) {
                     File crt = new File(config.get(ConfigKey.TLS_CA_LIST_FILE));
diff --git a/ring-android/app/src/main/res/values/strings_account.xml b/ring-android/app/src/main/res/values/strings_account.xml
index d6afd7f..0f0ca6f 100644
--- a/ring-android/app/src/main/res/values/strings_account.xml
+++ b/ring-android/app/src/main/res/values/strings_account.xml
@@ -143,6 +143,9 @@
 
     <!-- SRTP Details -->
     <string name="account_preferences_security_tab">Security</string>
+    <string name="account_srtp_switch_label">Encrypt media streams (SRTP)</string>
+    <string name="account_srtp_enable_sdes">Enable SDES as key exchange protocol</string>
+    <string name="account_srtp_rtp_fallback">Fallback to RTP if SRTP fails</string>
 
     <!-- SIP -->
     <string name="account_sip_dtmf_type_sipinfo" translatable="false">sipinfo</string>
diff --git a/ring-android/app/src/main/res/xml/account_security_prefs.xml b/ring-android/app/src/main/res/xml/account_security_prefs.xml
index 01d82dc..4a8b836 100644
--- a/ring-android/app/src/main/res/xml/account_security_prefs.xml
+++ b/ring-android/app/src/main/res/xml/account_security_prefs.xml
@@ -33,6 +33,23 @@
         android:title="@string/account_preferences_security_tab">
 
         <SwitchPreference
+            android:key="SRTP.enable"
+            android:persistent="false"
+            android:title="@string/account_srtp_switch_label" />
+
+        <SwitchPreference
+            android:key="SRTP.keyExchange"
+            android:dependency="SRTP.enable"
+            android:persistent="false"
+            android:title="@string/account_srtp_enable_sdes" />
+
+        <SwitchPreference
+            android:key="SRTP.rtpFallback"
+            android:dependency="SRTP.enable"
+            android:persistent="false"
+            android:title="@string/account_srtp_rtp_fallback" />
+
+        <SwitchPreference
             android:key="TLS.enable"
             android:persistent="false"
             android:title="@string/account_tls_transport_switch_label" />