diff --git a/res/drawable/conf_not_secured.png b/res/drawable/conf_not_secured.png new file mode 100644 index 000000000..1381f4d17 Binary files /dev/null and b/res/drawable/conf_not_secured.png differ diff --git a/res/drawable/conf_secured.png b/res/drawable/conf_secured.png new file mode 100644 index 000000000..61042339f Binary files /dev/null and b/res/drawable/conf_secured.png differ diff --git a/res/layout/conf_callee.xml b/res/layout/conf_callee.xml index aaa3e1285..0bd5317a1 100644 --- a/res/layout/conf_callee.xml +++ b/res/layout/conf_callee.xml @@ -33,6 +33,8 @@ + + diff --git a/res/layout/conf_callee_older_devices.xml b/res/layout/conf_callee_older_devices.xml index 5e2493081..6b5461026 100644 --- a/res/layout/conf_callee_older_devices.xml +++ b/res/layout/conf_callee_older_devices.xml @@ -39,4 +39,9 @@ android:src="@drawable/conf_status_paused" /> + + + diff --git a/res/layout/conf_choices_dialog.xml b/res/layout/conf_choices_dialog.xml index b79550925..64892c0b8 100644 --- a/res/layout/conf_choices_dialog.xml +++ b/res/layout/conf_choices_dialog.xml @@ -63,5 +63,17 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 41fad6fc3..3cf5e0c86 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1,6 +1,9 @@ + Authentication token is %s + Communication not encrypted + Starting up... An error occurred while accepting call diff --git a/src/org/linphone/ConferenceActivity.java b/src/org/linphone/ConferenceActivity.java index 8b39420ae..7d8150251 100644 --- a/src/org/linphone/ConferenceActivity.java +++ b/src/org/linphone/ConferenceActivity.java @@ -28,6 +28,7 @@ import java.util.List; import org.linphone.LinphoneManagerWaitHelper.LinphoneManagerReadyListener; import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener; +import org.linphone.LinphoneSimpleListener.LinphoneOnCallEncryptionChangedListener; import org.linphone.LinphoneSimpleListener.LinphoneOnCallStateChangedListener; import org.linphone.LinphoneSimpleListener.LinphoneOnVideoCallReadyListener; import org.linphone.core.LinphoneAddress; @@ -69,6 +70,7 @@ public class ConferenceActivity extends ListActivity implements LinphoneOnAudioChangedListener, LinphoneOnVideoCallReadyListener, LinphoneOnCallStateChangedListener, + LinphoneOnCallEncryptionChangedListener, Comparator, OnClickListener { @@ -572,7 +574,8 @@ public class ConferenceActivity extends ListActivity implements LinphoneAddress address = call.getRemoteAddress(); String mainText = address.getDisplayName(); String complText = address.getUserName(); - if ((getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call))) { + if (Version.sdkAboveOrEqual(Version.API05_ECLAIR_20) + && getResources().getBoolean(R.bool.show_full_remote_address_on_incoming_call)) { complText += "@" + address.getDomain(); } TextView mainTextView = (TextView) v.findViewById(R.id.name); @@ -653,6 +656,16 @@ public class ConferenceActivity extends ListActivity implements unhookCallButton.setOnClickListener(l); removeFromConfButton.setOnClickListener(l); addVideoButton.setOnClickListener(l); + + if (Version.hasZrtp()) { + if (call.areStreamsEncrypted()) { + setVisibility(v, R.id.callee_status_secured, true); + setVisibility(v, R.id.callee_status_not_secured, false); + } else { + setVisibility(v, R.id.callee_status_secured, false); + setVisibility(v, R.id.callee_status_not_secured, true); + } + } v.setOnClickListener(new OnClickListener() { public void onClick(View v) { @@ -666,6 +679,20 @@ public class ConferenceActivity extends ListActivity implements enableView(content, R.id.pause, l,!isInConference && showPause); enableView(content, R.id.resume, l, !isInConference && showResume); enableView(content, R.id.terminate_call, l, true); + + if (Version.hasZrtp()) { + if (call.areStreamsEncrypted()) { + setVisibility(content, R.id.encrypted, true); + setVisibility(content, R.id.unencrypted, false); + TextView token = (TextView) content.findViewById(R.id.authentication_token); + String fmt = getString(R.string.authenticationTokenFormat); + token.setText(String.format(fmt, call.getAuthenticationToken())); + } else { + setVisibility(content, R.id.encrypted, false); + setVisibility(content, R.id.unencrypted, true); + } + } + dialog.show(); } }); @@ -680,6 +707,7 @@ public class ConferenceActivity extends ListActivity implements pictureView.setVisibility(GONE); } + return v; } } @@ -882,6 +910,17 @@ public class ConferenceActivity extends ListActivity implements LinphoneActivity.instance().startVideoActivity(); } + @Override + public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, + String authenticationToken) { + mHandler.post(new Runnable() { + public void run() { + CalleeListAdapter adapter = (CalleeListAdapter) getListAdapter(); + recreateActivity(adapter); + } + }); + } + /* * public int compare(LinphoneCall c1, LinphoneCall c2) { if (c1 == c2) * return 0; diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 53c64e4ea..528f4fa85 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -1135,7 +1135,12 @@ public final class LinphoneManager implements LinphoneCoreListener { public void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String authenticationToken) { - if (serviceListener != null) serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken); + if (serviceListener != null) { + serviceListener.onCallEncryptionChanged(call, encrypted, authenticationToken); + } + for (LinphoneOnCallEncryptionChangedListener l : getSimpleListeners(LinphoneOnCallEncryptionChangedListener.class)) { + l.onCallEncryptionChanged(call, encrypted, authenticationToken); + } } public void onCallStateChanged(LinphoneCall call, State state, diff --git a/src/org/linphone/LinphoneSimpleListener.java b/src/org/linphone/LinphoneSimpleListener.java index 20439db92..66d5bf5bc 100644 --- a/src/org/linphone/LinphoneSimpleListener.java +++ b/src/org/linphone/LinphoneSimpleListener.java @@ -27,19 +27,26 @@ import android.media.MediaPlayer; public interface LinphoneSimpleListener { - public static interface LinphoneServiceListener - extends LinphoneOnGlobalStateChangedListener, LinphoneOnCallStateChangedListener { + public static interface LinphoneServiceListener extends + LinphoneOnGlobalStateChangedListener, + LinphoneOnCallStateChangedListener, + LinphoneOnCallEncryptionChangedListener + { void tryingNewOutgoingCallButCannotGetCallParameters(); void tryingNewOutgoingCallButWrongDestinationAddress(); void tryingNewOutgoingCallButAlreadyInCall(); void onRegistrationStateChanged(RegistrationState state, String message); void onRingerPlayerCreated(MediaPlayer mRingerPlayer); void onDisplayStatus(String message); - void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String authenticationToken); void onAlreadyInVideoCall(); } - + + + public static interface LinphoneOnCallEncryptionChangedListener extends LinphoneSimpleListener { + void onCallEncryptionChanged(LinphoneCall call, boolean encrypted, String authenticationToken); + } + public static interface LinphoneOnGlobalStateChangedListener extends LinphoneSimpleListener { void onGlobalStateChanged(GlobalState state, String message); }