diff --git a/README b/README index 9ac244430..5a133c2c7 100644 --- a/README +++ b/README @@ -20,6 +20,8 @@ BUILD_AMR 0 (don't build amr codec), light (try to use amr codec fro BUILD_GPLV3_ZRTP 0 (don't support ZRTP), 1 (support ZRTP and make the whole program GPLv3) BUILD_SILK 0 (don't build silk plugin), 1 (build silk) [silk is Skype nonfree patented audio codec] +In order to use ZRTP you also need to define the media_encryption property to +"zrtp" in the sip section of linphonerc file. diff --git a/res/drawable/conf_maybe_secured.png b/res/drawable/conf_maybe_secured.png new file mode 100644 index 000000000..106cf427d Binary files /dev/null and b/res/drawable/conf_maybe_secured.png differ diff --git a/res/layout/conf_callee.xml b/res/layout/conf_callee.xml index 0bd5317a1..a63fea3a4 100644 --- a/res/layout/conf_callee.xml +++ b/res/layout/conf_callee.xml @@ -34,6 +34,7 @@ + diff --git a/res/layout/conf_callee_older_devices.xml b/res/layout/conf_callee_older_devices.xml index 6b5461026..3b21cd493 100644 --- a/res/layout/conf_callee_older_devices.xml +++ b/res/layout/conf_callee_older_devices.xml @@ -41,7 +41,9 @@ android:src="@drawable/conf_status_inconf" /> + android:src="@drawable/conf_secured" android:visibility="gone"/> + diff --git a/res/layout/conf_choices_dialog.xml b/res/layout/conf_choices_dialog.xml index 64892c0b8..0fa51dc93 100644 --- a/res/layout/conf_choices_dialog.xml +++ b/res/layout/conf_choices_dialog.xml @@ -7,9 +7,27 @@ android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> + + + + + + + + + + + + - @@ -17,7 +35,7 @@ - @@ -25,7 +43,7 @@ - @@ -34,7 +52,7 @@ - @@ -42,7 +60,7 @@ - @@ -50,7 +68,7 @@ - @@ -58,22 +76,11 @@ - - - - - - - - - - \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 3d965d768..f8b12ca23 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3,8 +3,8 @@ Not ready for a new call Bad contact : %s - Authentication token is %s - Communication not encrypted + Encrypted %s + Not encrypted Starting up... An error occurred while accepting call diff --git a/src/org/linphone/IncallActivity.java b/src/org/linphone/IncallActivity.java index 5a573aa87..921a3469e 100644 --- a/src/org/linphone/IncallActivity.java +++ b/src/org/linphone/IncallActivity.java @@ -508,6 +508,15 @@ public class IncallActivity extends ListActivity implements LinphoneActivity.instance().startVideoActivity(call, 0); } break; + case R.id.set_auth_token_verified: + call.setAuthenticationTokenVerified(true); + break; + case R.id.set_auth_token_not_verified: + call.setAuthenticationTokenVerified(false); + break; + case R.id.encrypted: + call.setAuthenticationTokenVerified(!call.isAuthenticationTokenVerified()); + break; default: throw new RuntimeException("unknown id " + v.getId()); } @@ -673,9 +682,12 @@ public class IncallActivity extends ListActivity implements if ("none".equals(mediaEncryption)) { boolean showUnencrypted = Version.hasZrtp(); setVisibility(v, R.id.callee_status_secured, false); + setVisibility(v, R.id.callee_status_maybe_secured, false); setVisibility(v, R.id.callee_status_not_secured, showUnencrypted); } else { - setVisibility(v, R.id.callee_status_secured, true); + boolean reallySecured = !Version.hasZrtp() || call.isAuthenticationTokenVerified(); + setVisibility(v, R.id.callee_status_secured, reallySecured); + setVisibility(v, R.id.callee_status_maybe_secured, !reallySecured); setVisibility(v, R.id.callee_status_not_secured, false); } @@ -698,15 +710,19 @@ public class IncallActivity extends ListActivity implements String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption(); if ("none".equals(mediaEncryption)) { boolean showUnencrypted = Version.hasZrtp(); - setVisibility(content, R.id.encrypted, false); setVisibility(content, R.id.unencrypted, showUnencrypted); } else { - 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); if ("zrtp".equals(mediaEncryption)) { - TextView token = (TextView) content.findViewById(R.id.authentication_token); - String fmt = getString(R.string.authenticationTokenFormat); token.setText(String.format(fmt, call.getAuthenticationToken())); + boolean authVerified = call.isAuthenticationTokenVerified(); + enableView(content, R.id.set_auth_token_not_verified, l, authVerified); + enableView(content, R.id.set_auth_token_verified, l, !authVerified); + enableView(content, R.id.encrypted, l, true); + } else { + setVisibility(content, R.id.encrypted, true); + token.setText(String.format(fmt, "")); } } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 83a90aa1a..54495e3d8 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -36,6 +36,7 @@ import org.linphone.mediastream.Version; import org.linphone.mediastream.video.AndroidVideoWindowImpl; import android.app.AlertDialog; +import android.app.Dialog; import android.app.TabActivity; import android.content.Context; import android.content.DialogInterface; @@ -103,6 +104,14 @@ public class LinphoneActivity extends TabActivity implements throw new RuntimeException("LinphoneActivity not instantiated yet"); } + @Override + protected Dialog onCreateDialog(final int id) { + if (id == LinphoneManagerWaitHelper.DIALOG_ID) { + return waitHelper.createWaitDialog(); + } + return super.onCreateDialog(id); + } + public void onCreate(Bundle savedInstanceState) { instance = this; super.onCreate(savedInstanceState); diff --git a/src/org/linphone/core/LinphoneCallImpl.java b/src/org/linphone/core/LinphoneCallImpl.java index 2550367cb..802801155 100644 --- a/src/org/linphone/core/LinphoneCallImpl.java +++ b/src/org/linphone/core/LinphoneCallImpl.java @@ -39,9 +39,6 @@ class LinphoneCallImpl implements LinphoneCall { private native int getDuration(long nativePtr); private native float getCurrentQuality(long nativePtr); private native float getAverageQuality(long nativePtr); - private native String getAuthenticationToken(long nativePtr); - private native boolean isAuthenticationTokenVerified(long nativePtr); - private native boolean areStreamsEncrypted(long nativePtr); /* * This method must always be called from JNI, nothing else. @@ -126,13 +123,21 @@ class LinphoneCallImpl implements LinphoneCall { return getCurrentQuality(nativePtr); } + private native String getAuthenticationToken(long nativePtr); public String getAuthenticationToken(){ return getAuthenticationToken(nativePtr); } + + private native boolean isAuthenticationTokenVerified(long nativePtr); public boolean isAuthenticationTokenVerified(){ return isAuthenticationTokenVerified(nativePtr); } + private native boolean setAuthenticationTokenVerified(long nativePtr, boolean verified); + public void setAuthenticationTokenVerified(boolean verified){ + setAuthenticationTokenVerified(nativePtr, verified); + } + public boolean isInConference() { LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); return params.localConferenceMode(); diff --git a/submodules/linphone b/submodules/linphone index 91b606875..ce510f9d1 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 91b606875d8ccbbf80191e189e2714a4e11a4763 +Subproject commit ce510f9d1fa8d66aabcca308f0d2a9174f68acd4 diff --git a/test/org/linphone/TestConferenceActivity.java b/test/org/linphone/TestConferenceActivity.java index b308049df..a8bd25759 100644 --- a/test/org/linphone/TestConferenceActivity.java +++ b/test/org/linphone/TestConferenceActivity.java @@ -402,7 +402,6 @@ public class TestConferenceActivity extends IncallActivity { remoteAddress = new LinphoneAddressTest(name, number); } - public boolean areStreamsEncrypted() {return false;} public void enableCamera(boolean enabled) {} public void enableEchoCancellation(boolean enable) {} public void enableEchoLimiter(boolean enable) {} @@ -421,6 +420,12 @@ public class TestConferenceActivity extends IncallActivity { public boolean isEchoLimiterEnabled() {return false;} public boolean isInConference() { return inConf;} public boolean cameraEnabled() {return false;} + + @Override + public void setAuthenticationTokenVerified(boolean verified) { + // TODO Auto-generated method stub + + } }