New ZRTP dialog + ZRTP compiled by default
This commit is contained in:
parent
1f7110f561
commit
edfc1e004f
5 changed files with 64 additions and 108 deletions
2
Makefile
2
Makefile
|
@ -17,7 +17,7 @@ BUILD_REMOTE_PROVISIONING=1
|
|||
BUILD_X264=0
|
||||
BUILD_AMRNB=full # 0, light or full
|
||||
BUILD_AMRWB=0
|
||||
BUILD_GPLV3_ZRTP=0
|
||||
BUILD_GPLV3_ZRTP=1
|
||||
BUILD_SILK=1
|
||||
BUILD_G729=0
|
||||
BUILD_TUNNEL=0
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
android:id="@+id/call_stats_title"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/text_default"
|
||||
android:textSize="18dp"/>
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -55,7 +55,7 @@
|
|||
android:text="@string/call_stats_codec"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/codec"
|
||||
|
@ -64,7 +64,7 @@
|
|||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
|||
android:text="@string/call_stats_upload"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploadBandwith"
|
||||
|
@ -88,7 +88,7 @@
|
|||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
android:text="@string/call_stats_download"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloadBandwith"
|
||||
|
@ -112,7 +112,7 @@
|
|||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -127,7 +127,7 @@
|
|||
android:text="@string/call_stats_ice"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ice"
|
||||
|
@ -136,7 +136,7 @@
|
|||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="12dp"/>
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
|
@ -179,7 +179,7 @@
|
|||
android:id="@+id/statusText"
|
||||
android:text="@string/status_not_connected"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="18dp"
|
||||
android:textSize="18sp"
|
||||
android:paddingLeft="5dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -205,18 +205,6 @@
|
|||
android:layout_centerHorizontal="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_encryption"
|
||||
android:id="@+id/encryption"
|
||||
android:paddingRight="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/security_pending"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -229,10 +217,25 @@
|
|||
android:text="@string/menu_exit"
|
||||
android:textColor="@android:color/white"
|
||||
android:visibility="gone"
|
||||
android:textSize="18dp" />
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</org.linphone.ui.SlidingDrawer>
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/content_description_encryption"
|
||||
android:id="@+id/encryption"
|
||||
android:paddingRight="5dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingTop="5dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:src="@drawable/security_pending"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -379,4 +379,8 @@
|
|||
|
||||
<string name="wait">Merci de patienter...</string>
|
||||
<string name="importing_messages">Mise à jour de la base des messages</string>
|
||||
|
||||
<string name="zrtp_accept">Accepter</string>
|
||||
<string name="zrtp_deny">Refuser</string>
|
||||
<string name="zrtp_help">Vous ne devriez accepter que si vous avez le même code (ci-dessus) que votre contact</string>
|
||||
</resources>
|
||||
|
|
|
@ -433,4 +433,8 @@
|
|||
|
||||
<string name="wait">Please wait...</string>
|
||||
<string name="importing_messages">Updating messages database</string>
|
||||
|
||||
<string name="zrtp_accept">Accept</string>
|
||||
<string name="zrtp_deny">Deny</string>
|
||||
<string name="zrtp_help">You should only accept if you have the same code (see above) as your correspondent</string>
|
||||
</resources>
|
||||
|
|
|
@ -30,18 +30,19 @@ import org.linphone.core.LinphoneCore.MediaEncryption;
|
|||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.SlidingDrawer;
|
||||
import org.linphone.ui.SlidingDrawer.OnDrawerOpenListener;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
@ -53,7 +54,6 @@ import android.widget.ImageView;
|
|||
import android.widget.ListView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
|
@ -69,10 +69,6 @@ public class StatusFragment extends Fragment {
|
|||
// private LinearLayout allAccountsLed;
|
||||
private Runnable mCallQualityUpdater;
|
||||
private boolean isInCall, isAttached = false;
|
||||
|
||||
private Toast zrtpToast;
|
||||
private CountDownTimer zrtpHack;
|
||||
private boolean hideZrtpToast = false;
|
||||
private Timer mTimer;
|
||||
private TimerTask mTask;
|
||||
|
||||
|
@ -358,10 +354,6 @@ public class StatusFragment extends Fragment {
|
|||
public void onPause() {
|
||||
super.onPause();
|
||||
|
||||
if (zrtpToast != null) {
|
||||
hideZRTPDialog();
|
||||
}
|
||||
|
||||
if (mCallQualityUpdater != null) {
|
||||
refreshHandler.removeCallbacks(mCallQualityUpdater);
|
||||
mCallQualityUpdater = null;
|
||||
|
@ -399,80 +391,33 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void hideZRTPDialog() {
|
||||
hideZrtpToast = true;
|
||||
|
||||
if (zrtpToast != null) {
|
||||
zrtpToast.cancel();
|
||||
}
|
||||
if (zrtpHack != null) {
|
||||
zrtpHack.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void showZRTPDialog(final LinphoneCall call) {
|
||||
boolean authVerified = call.isAuthenticationTokenVerified();
|
||||
String format = getString(authVerified ? R.string.reset_sas_fmt : R.string.verify_sas_fmt);
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||
View layout = inflater.inflate(R.layout.zrtp_dialog, (ViewGroup) getActivity().findViewById(R.id.toastRoot));
|
||||
|
||||
TextView toastText = (TextView) layout.findViewById(R.id.toastMessage);
|
||||
toastText.setText(String.format(format, call.getAuthenticationToken()));
|
||||
|
||||
zrtpToast = new Toast(getActivity());
|
||||
zrtpToast.setGravity(Gravity.TOP | Gravity.RIGHT, 0, LinphoneUtils.pixelsToDpi(getResources(), 40));
|
||||
zrtpToast.setDuration(Toast.LENGTH_LONG);
|
||||
|
||||
ImageView ok = (ImageView) layout.findViewById(R.id.toastOK);
|
||||
ok.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (call != null) {
|
||||
call.setAuthenticationTokenVerified(true);
|
||||
}
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
}
|
||||
hideZRTPDialog();
|
||||
}
|
||||
});
|
||||
|
||||
ImageView notOk = (ImageView) layout.findViewById(R.id.toastNotOK);
|
||||
notOk.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (call != null) {
|
||||
call.setAuthenticationTokenVerified(false);
|
||||
}
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_pending);
|
||||
}
|
||||
hideZRTPDialog();
|
||||
}
|
||||
});
|
||||
|
||||
zrtpHack = new CountDownTimer(3000, 1000)
|
||||
{
|
||||
public void onTick(long millisUntilFinished)
|
||||
{
|
||||
if (!hideZrtpToast) {
|
||||
zrtpToast.show();
|
||||
}
|
||||
}
|
||||
public void onFinish() {
|
||||
if (!hideZrtpToast) {
|
||||
zrtpToast.show();
|
||||
zrtpHack.start();
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
zrtpToast.setView(layout);
|
||||
hideZrtpToast = false;
|
||||
zrtpToast.show();
|
||||
zrtpHack.start();
|
||||
if (getActivity() == null) {
|
||||
Log.w("Can't display ZRTP popup, no Activity");
|
||||
return;
|
||||
}
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle(call.getAuthenticationToken())
|
||||
.setMessage(getString(R.string.zrtp_help))
|
||||
.setPositiveButton(R.string.zrtp_accept, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
call.setAuthenticationTokenVerified(true);
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.zrtp_deny, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (call != null) {
|
||||
call.setAuthenticationTokenVerified(false);
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_pending);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private void initCallStatsRefresher(final LinphoneCall call, final View view) {
|
||||
|
|
Loading…
Reference in a new issue