Improve ZRTP GUI + setAuthenticationVerified

This commit is contained in:
Guillaume Beraudo 2011-11-14 15:37:03 +01:00
parent 87453ad7f1
commit 982b383ffd
11 changed files with 79 additions and 32 deletions

2
README
View file

@ -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_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] 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

View file

@ -34,6 +34,7 @@
<ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" /> <ImageView android:id="@+id/callee_status_paused" style="@style/callee_status" android:src="@drawable/conf_status_paused" />
<ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status" android:src="@drawable/conf_status_inconf"/> <ImageView android:id="@+id/callee_status_inconf" style="@style/callee_status" android:src="@drawable/conf_status_inconf"/>
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" android:src="@drawable/conf_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status" android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/> <ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" android:src="@drawable/conf_not_secured" android:visibility="gone"/>
</LinearLayout> </LinearLayout>

View file

@ -41,7 +41,9 @@
android:src="@drawable/conf_status_inconf" /> android:src="@drawable/conf_status_inconf" />
<ImageView android:id="@+id/callee_status_secured" style="@style/callee_status" <ImageView android:id="@+id/callee_status_secured" style="@style/callee_status"
android:src="@drawable/conf_secured" android:visibility="gone"/> android:src="@drawable/conf_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_maybe_secured" style="@style/callee_status"
android:src="@drawable/conf_maybe_secured" android:visibility="gone"/>
<ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status" <ImageView android:id="@+id/callee_status_not_secured" style="@style/callee_status"
android:src="@drawable/conf_not_secured" android:visibility="gone"/> android:src="@drawable/conf_not_secured" android:visibility="gone"/>
</LinearLayout> </LinearLayout>

View file

@ -7,9 +7,27 @@
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout android:id="@+id/encrypted" android:visibility="gone"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:id="@+id/set_auth_token_verified" android:src="@drawable/conf_maybe_secured" android:visibility="gone"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageButton android:id="@+id/set_auth_token_not_verified" android:src="@drawable/conf_secured" android:visibility="gone"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:id="@+id/authentication_token" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:id="@+id/unencrypted" android:visibility="gone"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:src="@drawable/conf_not_secured" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/not_encrypted" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:id="@+id/transfer_new" <LinearLayout android:id="@+id/transfer_new"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_transfer" <ImageButton android:src="@drawable/conf_transfer" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_transfer_new" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_transfer_new" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -17,7 +35,7 @@
<LinearLayout android:id="@+id/transfer_existing" <LinearLayout android:id="@+id/transfer_existing"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_transfer" <ImageButton android:src="@drawable/conf_transfer" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_transfer_existing" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_transfer_existing" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -25,7 +43,7 @@
<LinearLayout android:id="@+id/remove_from_conference" <LinearLayout android:id="@+id/remove_from_conference"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_remove" <ImageButton android:src="@drawable/conf_remove" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_remove_from_conference" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_remove_from_conference" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -34,7 +52,7 @@
<LinearLayout android:id="@+id/merge_to_conference" <LinearLayout android:id="@+id/merge_to_conference"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_merge" <ImageButton android:src="@drawable/conf_merge" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_merge_to_conference" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_merge_to_conference" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -42,7 +60,7 @@
<LinearLayout android:id="@+id/pause" <LinearLayout android:id="@+id/pause"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_pause" <ImageButton android:src="@drawable/conf_pause" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_pause" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_pause" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -50,7 +68,7 @@
<LinearLayout android:id="@+id/resume" <LinearLayout android:id="@+id/resume"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_resume" <ImageButton android:src="@drawable/conf_resume" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_resume" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_resume" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
@ -58,22 +76,11 @@
<LinearLayout android:id="@+id/terminate_call" <LinearLayout android:id="@+id/terminate_call"
android:layout_width="fill_parent" android:layout_height="wrap_content"> android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:src="@drawable/conf_terminate" <ImageButton android:src="@drawable/conf_terminate" android:clickable="false"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/conf_choice_terminate" android:layout_gravity="center_vertical" <TextView android:text="@string/conf_choice_terminate" android:layout_gravity="center_vertical"
android:layout_width="wrap_content" android:layout_height="wrap_content" /> android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/encrypted" android:visibility="gone"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:src="@drawable/conf_secured" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:id="@+id/authentication_token" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout android:id="@+id/unencrypted" android:visibility="gone"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageView android:src="@drawable/conf_not_secured" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<TextView android:text="@string/not_encrypted" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View file

@ -3,8 +3,8 @@
<string name="not_ready_to_make_new_call">Not ready for a new call</string> <string name="not_ready_to_make_new_call">Not ready for a new call</string>
<string name="bad_target_uri">Bad contact : %s</string> <string name="bad_target_uri">Bad contact : %s</string>
<string name="authenticationTokenFormat">Authentication token is %s</string> <string name="authenticationTokenFormat">Encrypted %s</string>
<string name="not_encrypted">Communication not encrypted</string> <string name="not_encrypted">Not encrypted</string>
<string name="waiting_for_startup">Starting up...</string> <string name="waiting_for_startup">Starting up...</string>
<string name="couldnt_accept_call">An error occurred while accepting call</string> <string name="couldnt_accept_call">An error occurred while accepting call</string>

View file

@ -508,6 +508,15 @@ public class IncallActivity extends ListActivity implements
LinphoneActivity.instance().startVideoActivity(call, 0); LinphoneActivity.instance().startVideoActivity(call, 0);
} }
break; 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: default:
throw new RuntimeException("unknown id " + v.getId()); throw new RuntimeException("unknown id " + v.getId());
} }
@ -673,9 +682,12 @@ public class IncallActivity extends ListActivity implements
if ("none".equals(mediaEncryption)) { if ("none".equals(mediaEncryption)) {
boolean showUnencrypted = Version.hasZrtp(); boolean showUnencrypted = Version.hasZrtp();
setVisibility(v, R.id.callee_status_secured, false); 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); setVisibility(v, R.id.callee_status_not_secured, showUnencrypted);
} else { } 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); setVisibility(v, R.id.callee_status_not_secured, false);
} }
@ -698,15 +710,19 @@ public class IncallActivity extends ListActivity implements
String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption(); String mediaEncryption = call.getCurrentParamsCopy().getMediaEncryption();
if ("none".equals(mediaEncryption)) { if ("none".equals(mediaEncryption)) {
boolean showUnencrypted = Version.hasZrtp(); boolean showUnencrypted = Version.hasZrtp();
setVisibility(content, R.id.encrypted, false);
setVisibility(content, R.id.unencrypted, showUnencrypted); setVisibility(content, R.id.unencrypted, showUnencrypted);
} else { } else {
setVisibility(content, R.id.encrypted, true); TextView token = (TextView) content.findViewById(R.id.authentication_token);
setVisibility(content, R.id.unencrypted, false); String fmt = getString(R.string.authenticationTokenFormat);
if ("zrtp".equals(mediaEncryption)) { 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())); 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, ""));
} }
} }

View file

@ -36,6 +36,7 @@ import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.AndroidVideoWindowImpl; import org.linphone.mediastream.video.AndroidVideoWindowImpl;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog;
import android.app.TabActivity; import android.app.TabActivity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -103,6 +104,14 @@ public class LinphoneActivity extends TabActivity implements
throw new RuntimeException("LinphoneActivity not instantiated yet"); 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) { public void onCreate(Bundle savedInstanceState) {
instance = this; instance = this;
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);

View file

@ -39,9 +39,6 @@ class LinphoneCallImpl implements LinphoneCall {
private native int getDuration(long nativePtr); private native int getDuration(long nativePtr);
private native float getCurrentQuality(long nativePtr); private native float getCurrentQuality(long nativePtr);
private native float getAverageQuality(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. * This method must always be called from JNI, nothing else.
@ -126,13 +123,21 @@ class LinphoneCallImpl implements LinphoneCall {
return getCurrentQuality(nativePtr); return getCurrentQuality(nativePtr);
} }
private native String getAuthenticationToken(long nativePtr);
public String getAuthenticationToken(){ public String getAuthenticationToken(){
return getAuthenticationToken(nativePtr); return getAuthenticationToken(nativePtr);
} }
private native boolean isAuthenticationTokenVerified(long nativePtr);
public boolean isAuthenticationTokenVerified(){ public boolean isAuthenticationTokenVerified(){
return isAuthenticationTokenVerified(nativePtr); return isAuthenticationTokenVerified(nativePtr);
} }
private native boolean setAuthenticationTokenVerified(long nativePtr, boolean verified);
public void setAuthenticationTokenVerified(boolean verified){
setAuthenticationTokenVerified(nativePtr, verified);
}
public boolean isInConference() { public boolean isInConference() {
LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr)); LinphoneCallParamsImpl params = new LinphoneCallParamsImpl(getCurrentParamsCopy(nativePtr));
return params.localConferenceMode(); return params.localConferenceMode();

@ -1 +1 @@
Subproject commit 91b606875d8ccbbf80191e189e2714a4e11a4763 Subproject commit ce510f9d1fa8d66aabcca308f0d2a9174f68acd4

View file

@ -402,7 +402,6 @@ public class TestConferenceActivity extends IncallActivity {
remoteAddress = new LinphoneAddressTest(name, number); remoteAddress = new LinphoneAddressTest(name, number);
} }
public boolean areStreamsEncrypted() {return false;}
public void enableCamera(boolean enabled) {} public void enableCamera(boolean enabled) {}
public void enableEchoCancellation(boolean enable) {} public void enableEchoCancellation(boolean enable) {}
public void enableEchoLimiter(boolean enable) {} public void enableEchoLimiter(boolean enable) {}
@ -421,6 +420,12 @@ public class TestConferenceActivity extends IncallActivity {
public boolean isEchoLimiterEnabled() {return false;} public boolean isEchoLimiterEnabled() {return false;}
public boolean isInConference() { return inConf;} public boolean isInConference() { return inConf;}
public boolean cameraEnabled() {return false;} public boolean cameraEnabled() {return false;}
@Override
public void setAuthenticationTokenVerified(boolean verified) {
// TODO Auto-generated method stub
}
} }