Disable media encryption mandatory setting if media encryption set to None + display security icon on incoming call view if media encryption is mandatory
This commit is contained in:
parent
9cab87e847
commit
f96239bcda
3 changed files with 23 additions and 5 deletions
|
@ -288,9 +288,19 @@ public class CallStatusBarFragment extends Fragment {
|
||||||
|
|
||||||
public void refreshStatusItems(final Call call) {
|
public void refreshStatusItems(final Call call) {
|
||||||
if (call != null) {
|
if (call != null) {
|
||||||
MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption();
|
if (call.getDir() == Call.Dir.Incoming
|
||||||
|
&& call.getState() == Call.State.IncomingReceived
|
||||||
|
&& LinphonePreferences.instance().isMediaEncryptionMandatory()) {
|
||||||
|
// If the incoming call view is displayed while encryption is mandatory,
|
||||||
|
// we can safely show the security_ok icon
|
||||||
|
mEncryption.setImageResource(R.drawable.security_ok);
|
||||||
mEncryption.setVisibility(View.VISIBLE);
|
mEncryption.setVisibility(View.VISIBLE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MediaEncryption mediaEncryption = call.getCurrentParams().getMediaEncryption();
|
||||||
|
mEncryption.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
if (mediaEncryption == MediaEncryption.SRTP
|
if (mediaEncryption == MediaEncryption.SRTP
|
||||||
|| (mediaEncryption == MediaEncryption.ZRTP
|
|| (mediaEncryption == MediaEncryption.ZRTP
|
||||||
&& call.getAuthenticationTokenVerified())
|
&& call.getAuthenticationTokenVerified())
|
||||||
|
|
|
@ -167,8 +167,15 @@ public class CallSettingsFragment extends SettingsFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onListValueChanged(int position, String newLabel, String newValue) {
|
public void onListValueChanged(int position, String newLabel, String newValue) {
|
||||||
try {
|
try {
|
||||||
mPrefs.setMediaEncryption(
|
MediaEncryption encryption =
|
||||||
MediaEncryption.fromInt(Integer.parseInt(newValue)));
|
MediaEncryption.fromInt(Integer.parseInt(newValue));
|
||||||
|
mPrefs.setMediaEncryption(encryption);
|
||||||
|
|
||||||
|
if (encryption == MediaEncryption.None) {
|
||||||
|
mMediaEncryptionMandatory.setChecked(false);
|
||||||
|
}
|
||||||
|
mMediaEncryptionMandatory.setEnabled(
|
||||||
|
encryption != MediaEncryption.None);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) {
|
||||||
Log.e(nfe);
|
Log.e(nfe);
|
||||||
}
|
}
|
||||||
|
@ -248,7 +255,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());
|
mMediaEncryptionMandatory.setChecked(mPrefs.isMediaEncryptionMandatory());
|
||||||
|
mMediaEncryptionMandatory.setEnabled(mPrefs.getMediaEncryption() != MediaEncryption.None);
|
||||||
|
|
||||||
setListeners();
|
setListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -459,7 +459,7 @@ public class LinphonePreferences {
|
||||||
// End of contact settings
|
// End of contact settings
|
||||||
|
|
||||||
// Call settings
|
// Call settings
|
||||||
public boolean acceptMediaEncryptionMandatory() {
|
public boolean isMediaEncryptionMandatory() {
|
||||||
return getLc().isMediaEncryptionMandatory();
|
return getLc().isMediaEncryptionMandatory();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue