mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-28 09:09:20 +00:00
Merge remote-tracking branch 'private/3.0.X' into obiane
This commit is contained in:
commit
d2a6a87eff
39 changed files with 1792 additions and 532 deletions
|
|
@ -36,6 +36,7 @@
|
|||
<class name="org.linphone.core.PresencePersonImpl" />
|
||||
<class name="org.linphone.core.PresenceServiceImpl" />
|
||||
<class name="org.linphone.core.ErrorInfoImpl" />
|
||||
<class name="org.linphone.core.TunnelConfigImpl" />
|
||||
</javah>
|
||||
<javah outputfile="gen/xml2lpc_jni.h">
|
||||
<classpath>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/assistant_apply"
|
||||
android:text="@string/assistant_apply"
|
||||
android:text="@string/assistant_login"
|
||||
android:background="@drawable/assistant_button"
|
||||
style="@style/font8"
|
||||
android:contentDescription="@string/content_description_validate"
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
|
||||
<Button
|
||||
android:id="@+id/assistant_apply"
|
||||
android:text="@string/assistant_apply"
|
||||
android:text="@string/assistant_login"
|
||||
android:background="@drawable/assistant_button"
|
||||
style="@style/font8"
|
||||
android:contentDescription="@string/content_description_validate"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="10dp"
|
||||
|
|
@ -57,5 +57,5 @@
|
|||
android:layout_centerInParent="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,91 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/colorH"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
|
||||
|
||||
<TextView
|
||||
android:text="@string/assistant_remote_provisioning_title"
|
||||
android:contentDescription="@string/content_description_welcome"
|
||||
style="@style/font6"
|
||||
android:textAllCaps="true"
|
||||
android:paddingTop="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/assistant_remote_provisioning_login"
|
||||
style="@style/font11"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="20dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:contentDescription="@string/content_description_welcome"
|
||||
android:paddingTop="40dp"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/black"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/assistant_title"/>
|
||||
|
||||
<TextView
|
||||
android:paddingTop="10dp"
|
||||
android:gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/setup_remote_provisioning_login_hint"
|
||||
android:textColor="@android:color/black"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="40dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<EditText
|
||||
android:textCursorDrawable="@null"
|
||||
android:id="@+id/setup_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setup_username_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
android:background="@drawable/resizable_textfield" />
|
||||
|
||||
<EditText
|
||||
android:textCursorDrawable="@null"
|
||||
android:id="@+id/setup_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setup_password_hint"
|
||||
android:inputType="textPassword"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
android:background="@drawable/resizable_textfield" />
|
||||
|
||||
<EditText
|
||||
android:textCursorDrawable="@null"
|
||||
android:id="@+id/setup_domain"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/setup_domain_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
android:background="@drawable/resizable_textfield" />
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:text="@string/username"
|
||||
style="@style/font13"
|
||||
android:textAllCaps="true"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/assistant_username"
|
||||
android:background="@drawable/resizable_textfield"
|
||||
android:textColor="@color/colorB"
|
||||
android:textCursorDrawable="@null"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<TextView
|
||||
android:text="@string/password"
|
||||
style="@style/font13"
|
||||
android:textAllCaps="true"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/assistant_password"
|
||||
android:background="@drawable/resizable_textfield"
|
||||
android:textColor="@color/colorB"
|
||||
android:textCursorDrawable="@null"
|
||||
android:inputType="textPassword"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:text="@string/domain"
|
||||
style="@style/font13"
|
||||
android:textAllCaps="true"
|
||||
android:paddingTop="10dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/assistant_domain"
|
||||
android:background="@drawable/resizable_textfield"
|
||||
android:textColor="@color/colorB"
|
||||
android:textCursorDrawable="@null"
|
||||
android:inputType="textEmailAddress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/assistant_connect"
|
||||
android:text="@string/assistant_connect"
|
||||
android:background="@drawable/assistant_button"
|
||||
style="@style/font8"
|
||||
android:contentDescription="@string/content_description_validate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="horizontal">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -25,7 +25,6 @@
|
|||
style="@style/font1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="10dp"
|
||||
android:gravity="center"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
<color name="colorJ">#ffa645</color>
|
||||
<color name="colorK">#3eb5c0</color>
|
||||
<color name="colorL">#96c11f</color>
|
||||
<color name="colorAB">#ffeee5</color>
|
||||
|
||||
<color name="transparent">#00000000</color>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@
|
|||
<!-- New settings -->
|
||||
<!-- TODO Migrate it in linphonerc -->
|
||||
<bool name="assistant_use_linphone_login_as_first_fragment">false</bool>
|
||||
<bool name="hide_in_call_stats">false</bool>
|
||||
<string name="default_domain">sip.linphone.org</string>
|
||||
<string name="default_stun">stun.linphone.org</string>
|
||||
<bool name="use_linphone_friend">false</bool>
|
||||
|
||||
<string name="wizard_url">https://www.linphone.org/wizard.php</string>
|
||||
|
||||
|
|
|
|||
|
|
@ -26,20 +26,23 @@
|
|||
<!-- 0. Assistant -->
|
||||
<string name="assistant_welcome">Welcome</string>
|
||||
<string name="assistant_title">Assistant</string>
|
||||
<string name="assistant_create_account">Create a linphone account</string>
|
||||
<string name="assistant_login_linphone">I have a linphone account</string>
|
||||
<string name="assistant_login_generic">I have a sip account</string>
|
||||
<string name="assistant_remote_provisioning">Remote provisioning</string>
|
||||
<string name="assistant_create_account_title">Create an account</string>
|
||||
<string name="assistant_create_account">Create account</string>
|
||||
<string name="assistant_login_linphone">Use Linphone account</string>
|
||||
<string name="assistant_login_generic">Use SIP account</string>
|
||||
<string name="assistant_remote_provisioning">Fetch remote configuration</string>
|
||||
<string name="assistant_create_account_title">Create account</string>
|
||||
<string name="assistant_create_account_part_1">1/2</string>
|
||||
<string name="assistant_create_account_part_2">2/2</string>
|
||||
<string name="assistant_display_name">Display name (optional)</string>
|
||||
<string name="assistant_linphone_account_title">Configure linphohe account</string>
|
||||
<string name="assistant_general_account_title">Configure Sip account</string>
|
||||
<string name="assistant_remote_provisioning_title">Remote provisioning</string>
|
||||
<string name="assistant_linphone_account_title">Configure Linphone account</string>
|
||||
<string name="assistant_general_account_title">Configure SIP account</string>
|
||||
<string name="assistant_remote_provisioning_title">Fetch remote configuration</string>
|
||||
<string name="assistant_create">Create account</string>
|
||||
<string name="assistant_apply">Apply</string>
|
||||
<string name="assistant_apply">Fetch and apply</string>
|
||||
<string name="assistant_login">Login</string>
|
||||
<string name="assistant_ec_calibration">Echo canceller calibration in progress</string>
|
||||
<string name="assistant_remote_provisioning_login">Enter your login</string>
|
||||
<string name="assistant_connect">Connection</string>
|
||||
|
||||
|
||||
<!-- 1. Dailer -->
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import org.linphone.core.LinphonePlayer;
|
|||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.ui.Numpad;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
|
@ -130,6 +131,7 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
cameraNumber = AndroidCameraConfiguration.retrieveCameras().length;
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, final LinphoneCall call, LinphoneCall.State state, String message) {
|
||||
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
|
|
@ -163,13 +165,6 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
}
|
||||
}
|
||||
|
||||
if (state == State.Connected) {
|
||||
if(call.getCurrentParamsCopy().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){
|
||||
//TODO AFFICHER DIALOG ZRTP
|
||||
status.showZRTPDialog(call);
|
||||
}
|
||||
}
|
||||
|
||||
if (state == State.StreamsRunning) {
|
||||
switchVideo(isVideoEnabled(call));
|
||||
//Check media in progress
|
||||
|
|
@ -228,6 +223,9 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, final LinphoneCall call, boolean encrypted, String authenticationToken) {
|
||||
if (status != null) {
|
||||
if(call.getCurrentParamsCopy().getMediaEncryption().equals(LinphoneCore.MediaEncryption.ZRTP) && !call.isAuthenticationTokenVerified()){
|
||||
status.showZRTPDialog(call);
|
||||
}
|
||||
status.refreshStatusItems(call, call.getCurrentParamsCopy().getVideoEnabled());
|
||||
}
|
||||
}
|
||||
|
|
@ -1450,109 +1448,54 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
videoCallFragment = fragment;
|
||||
}
|
||||
|
||||
private void displayActiveCall(LinphoneCall call){
|
||||
if(!isVideoEnabled(call)){
|
||||
mActiveCallHeader.setVisibility(View.VISIBLE);
|
||||
mNoCurrentCall.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if(call == null) return;
|
||||
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
||||
LinphoneAddress lAddress;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e("Incall activity cannot parse remote address",e);
|
||||
lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("unknown","unknown","unknown");
|
||||
}
|
||||
//CALL INFORMATION
|
||||
|
||||
TextView contact = (TextView) findViewById(R.id.contact_name);
|
||||
private void displayCurrentCall(LinphoneCall call){
|
||||
//if(!isVideoEnabled(call)){
|
||||
// mActiveCallHeader.setVisibility(View.VISIBLE);
|
||||
// mNoCurrentCall.setVisibility(View.GONE);
|
||||
//}
|
||||
|
||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress);
|
||||
if (lContact == null) {
|
||||
contact.setText(lAddress.getUserName());
|
||||
} else {
|
||||
contact.setText(lContact.getName());
|
||||
LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
|
||||
}
|
||||
LinphoneAddress lAddress = call.getRemoteAddress();
|
||||
TextView contactName = (TextView) findViewById(R.id.contact_name);
|
||||
|
||||
|
||||
/*if(contact != null) {
|
||||
|
||||
} else {
|
||||
displayOrHideContactPicture(imageView, null, null, false);
|
||||
}
|
||||
callsList.addView(imageView);*/
|
||||
|
||||
int callDuration = call.getDuration();
|
||||
if (callDuration == 0 && call.getState() != State.StreamsRunning) {
|
||||
return;
|
||||
}
|
||||
|
||||
Chronometer timer = (Chronometer) findViewById(R.id.call_timer);
|
||||
if (timer == null) {
|
||||
throw new IllegalArgumentException("no callee_duration view found");
|
||||
}
|
||||
|
||||
timer.setBase(SystemClock.elapsedRealtime() - 1000 * callDuration);
|
||||
timer.start();
|
||||
setContactInformation(contactName, contactPicture, lAddress);
|
||||
registerCallDurationTimer(null, call);
|
||||
}
|
||||
|
||||
private void displayOtherCalls(Resources resources, final LinphoneCall call, int index) {
|
||||
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
||||
LinphoneAddress lAddress;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e("Incall activity cannot parse remote address",e);
|
||||
lAddress= LinphoneCoreFactory.instance().createLinphoneAddress("uknown","unknown","unkonown");
|
||||
}
|
||||
private void displayPausedCalls(Resources resources, final LinphoneCall call, int index) {
|
||||
LinphoneAddress lAddress = call.getRemoteAddress();
|
||||
|
||||
// Control Row
|
||||
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.call_inactive_row, container, false);
|
||||
callView.setId(index+1);
|
||||
|
||||
TextView contact = (TextView) callView.findViewById(R.id.contact_name);
|
||||
TextView contactName = (TextView) callView.findViewById(R.id.contact_name);
|
||||
ImageView contactImage = (ImageView) callView.findViewById(R.id.contact_picture);
|
||||
|
||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), lAddress);
|
||||
if (lContact == null) {
|
||||
contact.setText(lAddress.getUserName());
|
||||
} else {
|
||||
contact.setText(lContact.getName());
|
||||
}
|
||||
|
||||
displayCallStatusIconAndReturnCallPaused(callView, call);
|
||||
registerCallDurationTimer(callView, call);
|
||||
callsList.addView(callView);
|
||||
|
||||
// Image Row
|
||||
|
||||
|
||||
|
||||
// callView.setTag(imageView);
|
||||
/* callView.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() != null) {
|
||||
View imageView = (View) v.getTag();
|
||||
if (imageView.getVisibility() == View.VISIBLE)
|
||||
imageView.setVisibility(View.GONE);
|
||||
else
|
||||
imageView.setVisibility(View.VISIBLE);
|
||||
callsList.invalidate();
|
||||
}
|
||||
if(call == null) {
|
||||
if(isConferenceRunning){
|
||||
Log.w("conf running");
|
||||
}
|
||||
});*/
|
||||
contactName.setText(resources.getString(R.string.conference));
|
||||
contactImage.setImageResource(R.drawable.conference_start);
|
||||
} else {
|
||||
setContactInformation(contactName, contactImage, lAddress);
|
||||
displayCallStatusIconAndReturnCallPaused(callView, call);
|
||||
registerCallDurationTimer(callView, call);
|
||||
callsList.addView(callView);
|
||||
}
|
||||
}
|
||||
|
||||
private void setContactName(LinearLayout callView, LinphoneAddress lAddress, String sipUri, Resources resources) {
|
||||
TextView contact = (TextView) callView.findViewById(R.id.contactNameOrNumber);
|
||||
|
||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(callView.getContext().getContentResolver(), lAddress);
|
||||
private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) {
|
||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(contactName.getContext().getContentResolver(), lAddress);
|
||||
if (lContact == null) {
|
||||
contact.setText(lAddress.getUserName());
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
} else {
|
||||
contact.setText(lContact.getName());
|
||||
contactName.setText(lContact.getName());
|
||||
LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1598,7 +1541,13 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
return;
|
||||
}
|
||||
|
||||
Chronometer timer = (Chronometer) v.findViewById(R.id.call_timer);
|
||||
Chronometer timer;
|
||||
if(v == null){
|
||||
timer = (Chronometer) findViewById(R.id.call_timer);
|
||||
} else {
|
||||
timer = (Chronometer) v.findViewById(R.id.call_timer);
|
||||
}
|
||||
|
||||
if (timer == null) {
|
||||
throw new IllegalArgumentException("no callee_duration view found");
|
||||
}
|
||||
|
|
@ -1630,10 +1579,10 @@ public class CallActivity extends Activity implements OnClickListener {
|
|||
for (LinphoneCall call : LinphoneManager.getLc().getCalls()) {
|
||||
if(call.isInConference()) break;
|
||||
if (call != LinphoneManager.getLc().getCurrentCall()) {
|
||||
displayOtherCalls(resources, call, index);
|
||||
displayPausedCalls(resources, call, index);
|
||||
index++;
|
||||
} else {
|
||||
displayActiveCall(call);
|
||||
displayCurrentCall(call);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,20 +27,13 @@ import org.linphone.core.LinphoneCallParams;
|
|||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.ui.LinphoneSliders;
|
||||
import org.linphone.ui.LinphoneSliders.LinphoneSliderTriggered;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipDescription;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Point;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.view.DragEvent;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
|
@ -278,7 +271,7 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
|
|||
}
|
||||
|
||||
private void answer() {
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createDefaultCallParameters();
|
||||
LinphoneCallParams params = LinphoneManager.getLc().createCallParams(mCall);
|
||||
|
||||
if (!LinphoneManager.getInstance().acceptCallWithParams(mCall, params)) {
|
||||
// the above method takes care of Samsung Galaxy S
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class CallManager {
|
|||
public void inviteAddress(LinphoneAddress lAddress, boolean videoEnabled, boolean lowBandwidth) throws LinphoneCoreException {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
|
||||
LinphoneCallParams params = lc.createDefaultCallParameters();
|
||||
LinphoneCallParams params = lc.createCallParams(null);
|
||||
bm().updateWithProfileSettings(lc, params);
|
||||
|
||||
if (videoEnabled && params.getVideoEnabled()) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ public class Contact implements Serializable {
|
|||
private transient Bitmap photo;
|
||||
private List<String> numbersOrAddresses;
|
||||
private boolean hasFriends;
|
||||
private LinphoneAddress address;
|
||||
|
||||
public Contact(String id, String name) {
|
||||
super();
|
||||
|
|
@ -50,8 +52,19 @@ public class Contact implements Serializable {
|
|||
this.photoUri = null;
|
||||
this.thumbnailUri = null;
|
||||
this.hasFriends = false;
|
||||
this.address = null;
|
||||
}
|
||||
|
||||
|
||||
public Contact(String id, LinphoneAddress address) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.name = LinphoneUtils.getAddressDisplayName(address);
|
||||
this.photoUri = null;
|
||||
this.thumbnailUri = null;
|
||||
this.address = address;
|
||||
|
||||
}
|
||||
|
||||
public Contact(String id, String name, Uri photo, Uri thumbnail) {
|
||||
super();
|
||||
this.id = id;
|
||||
|
|
@ -60,6 +73,7 @@ public class Contact implements Serializable {
|
|||
this.thumbnailUri = thumbnail;
|
||||
this.photo = null;
|
||||
this.hasFriends = false;
|
||||
this.address = null;
|
||||
}
|
||||
|
||||
public Contact(String id, String name, Uri photo, Uri thumbnail, Bitmap picture) {
|
||||
|
|
@ -70,6 +84,7 @@ public class Contact implements Serializable {
|
|||
this.thumbnailUri = thumbnail;
|
||||
this.photo = picture;
|
||||
this.hasFriends = false;
|
||||
this.address = null;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -85,6 +100,10 @@ public class Contact implements Serializable {
|
|||
return name;
|
||||
}
|
||||
|
||||
public LinphoneAddress getLinphoneAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public Uri getPhotoUri() {
|
||||
return photoUri;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,20 +18,32 @@ package org.linphone;
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.SyncFailedException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.ContentProviderOperation;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Shader;
|
||||
import android.media.ExifInterface;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
|
|
@ -58,7 +70,6 @@ public class ContactEditorFragment extends Fragment {
|
|||
private ImageView addNumber, addSipAddress, contactPicture;
|
||||
private EditText firstName, lastName;
|
||||
private LayoutInflater inflater;
|
||||
private Uri imageToUploadUri;
|
||||
private static final int ADD_PHOTO = 1337;
|
||||
|
||||
private boolean isNewContact = true;
|
||||
|
|
@ -70,6 +81,11 @@ public class ContactEditorFragment extends Fragment {
|
|||
private LinearLayout sipAddresses, numbers;
|
||||
private String newSipOrNumberToAdd;
|
||||
private ContactsManager contactsManager;
|
||||
private Uri imageToUploadUri;
|
||||
private String fileToUploadPath;
|
||||
private Bitmap imageToUpload;
|
||||
private Bitmap bitmapUnknown;
|
||||
byte[] photoToAdd;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
this.inflater = inflater;
|
||||
|
|
@ -120,8 +136,10 @@ public class ContactEditorFragment extends Fragment {
|
|||
return;
|
||||
}
|
||||
contactsManager.createNewContact(ops, firstName.getText().toString(), lastName.getText().toString());
|
||||
setContactPhoto();
|
||||
} else {
|
||||
contactsManager.updateExistingContact(ops, contact, firstName.getText().toString(), lastName.getText().toString());
|
||||
setContactPhoto();
|
||||
}
|
||||
|
||||
for (NewOrUpdatedNumberOrAddress numberOrAddress : numbersAndAddresses) {
|
||||
|
|
@ -257,18 +275,26 @@ public class ContactEditorFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void pickImage() {
|
||||
List<Intent> cameraIntents = new ArrayList<Intent>();
|
||||
Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File file = new File(Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name_with_date).replace("%s", String.valueOf(System.currentTimeMillis())));
|
||||
imageToUploadUri = null;
|
||||
final List<Intent> cameraIntents = new ArrayList<Intent>();
|
||||
final Intent captureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
File file = new File(Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name));
|
||||
imageToUploadUri = Uri.fromFile(file);
|
||||
captureIntent.putExtra("crop", "true");
|
||||
captureIntent.putExtra("outputX",256);
|
||||
captureIntent.putExtra("outputY", 256);
|
||||
captureIntent.putExtra("aspectX", 0);
|
||||
captureIntent.putExtra("aspectY", 0);
|
||||
captureIntent.putExtra("scale", true);
|
||||
captureIntent.putExtra("return-data", false);
|
||||
captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageToUploadUri);
|
||||
cameraIntents.add(captureIntent);
|
||||
|
||||
Intent galleryIntent = new Intent();
|
||||
final Intent galleryIntent = new Intent();
|
||||
galleryIntent.setType("image/*");
|
||||
galleryIntent.setAction(Intent.ACTION_PICK);
|
||||
galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
|
||||
Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.image_picker_title));
|
||||
final Intent chooserIntent = Intent.createChooser(galleryIntent, getString(R.string.image_picker_title));
|
||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, cameraIntents.toArray(new Parcelable[]{}));
|
||||
|
||||
startActivityForResult(chooserIntent, ADD_PHOTO);
|
||||
|
|
@ -290,41 +316,151 @@ public class ContactEditorFragment extends Fragment {
|
|||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
if (requestCode == ADD_PHOTO && resultCode == Activity.RESULT_OK) {
|
||||
String filePicturePath = null;
|
||||
|
||||
if (data != null && data.getData() != null) {
|
||||
filePicturePath = getRealPathFromURI(data.getData());
|
||||
} else if (imageToUploadUri != null) {
|
||||
filePicturePath = imageToUploadUri.getPath();
|
||||
if (data != null && data.getExtras() != null && data.getExtras().get("data") != null) {
|
||||
Bitmap bm = (Bitmap) data.getExtras().get("data");
|
||||
showPopupMenuAskingImageSize(null, bm);
|
||||
}
|
||||
|
||||
if (filePicturePath != null) {
|
||||
int SIZE_SMALL = 256;
|
||||
int COMPRESSOR_QUALITY = 100;
|
||||
|
||||
/*Bitmap bm = null;
|
||||
|
||||
int pixelsMax = SIZE_SMALL;
|
||||
//Resize image
|
||||
BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inSampleSize = 1;
|
||||
bm = BitmapFactory.decodeFile(filePicturePath,options);
|
||||
if (bm != null) {
|
||||
if (bm.getWidth() > bm.getHeight() && bm.getWidth() > pixelsMax) {
|
||||
bm = Bitmap.createScaledBitmap(bm, 256, 256, false);
|
||||
}
|
||||
}
|
||||
|
||||
ByteArrayOutputStream bstream = new ByteArrayOutputStream();
|
||||
bm.compress(Bitmap.CompressFormat.PNG , 100, bstream);
|
||||
byte[] bArray = bstream.toByteArray();
|
||||
contactPicture.setImageBitmap(bm);*/
|
||||
contactsManager.updateExistingContactPicture(ops, contact, filePicturePath);
|
||||
else if (data != null && data.getData() != null) {
|
||||
Uri selectedImageUri = data.getData();
|
||||
try {
|
||||
Bitmap selectedImage = MediaStore.Images.Media.getBitmap(LinphoneManager.getInstance().getContext().getContentResolver(), selectedImageUri);
|
||||
selectedImage = Bitmap.createScaledBitmap(selectedImage, 256, 256, false);
|
||||
showPopupMenuAskingImageSize(null, selectedImage);
|
||||
} catch (IOException e) { e.printStackTrace(); }
|
||||
}
|
||||
else if (imageToUploadUri != null) {
|
||||
String filePath = imageToUploadUri.getPath();
|
||||
showPopupMenuAskingImageSize(filePath, null);
|
||||
}
|
||||
else {
|
||||
File file = new File(Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name));
|
||||
if (file.exists()) {
|
||||
imageToUploadUri = Uri.fromFile(file);
|
||||
String filePath = imageToUploadUri.getPath();
|
||||
showPopupMenuAskingImageSize(filePath, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
|
||||
private void showPopupMenuAskingImageSize(final String filePath, final Bitmap image) {
|
||||
fileToUploadPath = filePath;
|
||||
imageToUpload = image;
|
||||
editContactPicture(fileToUploadPath,imageToUpload);
|
||||
}
|
||||
|
||||
private void editContactPicture(final String filePath, final Bitmap image) {
|
||||
int SIZE_SMALL = 256;
|
||||
int COMPRESSOR_QUALITY = 100;
|
||||
Bitmap bitmapUnknown = BitmapFactory.decodeResource(getResources(), R.drawable.avatar);
|
||||
Bitmap bm = null;
|
||||
|
||||
if(filePath != null){
|
||||
int pixelsMax = SIZE_SMALL;
|
||||
//Resize image
|
||||
bm = BitmapFactory.decodeFile(filePath);
|
||||
if (bm != null) {
|
||||
if (bm.getWidth() > bm.getHeight() && bm.getWidth() > pixelsMax) {
|
||||
bm = Bitmap.createScaledBitmap(bm, 256, 256, false);
|
||||
}
|
||||
}
|
||||
} else if (image != null) {
|
||||
bm = image;
|
||||
}
|
||||
|
||||
// Rotate the bitmap if possible/needed, using EXIF data
|
||||
try {
|
||||
if (imageToUploadUri != null && filePath != null) {
|
||||
ExifInterface exif = new ExifInterface(filePath);
|
||||
int pictureOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, 0);
|
||||
Matrix matrix = new Matrix();
|
||||
if (pictureOrientation == 6) {
|
||||
matrix.postRotate(90);
|
||||
} else if (pictureOrientation == 3) {
|
||||
matrix.postRotate(180);
|
||||
} else if (pictureOrientation == 8) {
|
||||
matrix.postRotate(270);
|
||||
}
|
||||
bm = Bitmap.createBitmap(bm, 0, 0, bm.getWidth(), bm.getHeight(), matrix, true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Bitmap bitmapRounded;
|
||||
if(bm != null)
|
||||
{
|
||||
bitmapRounded = Bitmap.createScaledBitmap(bm,bitmapUnknown.getWidth(), bitmapUnknown.getWidth(), false);
|
||||
|
||||
Canvas canvas = new Canvas(bitmapRounded);
|
||||
Paint paint = new Paint();
|
||||
paint.setAntiAlias(true);
|
||||
paint.setShader(new BitmapShader(bitmapRounded, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP));
|
||||
canvas.drawCircle(bitmapRounded.getWidth() / 2+0.7f, bitmapRounded.getHeight() / 2+0.7f,bitmapRounded.getWidth() / 2+0.1f, paint);
|
||||
contactPicture.setImageBitmap(bitmapRounded);
|
||||
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
bm.compress(Bitmap.CompressFormat.PNG,COMPRESSOR_QUALITY, outStream);
|
||||
photoToAdd = outStream.toByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setContactPhoto(){
|
||||
ContentResolver cr = getActivity().getContentResolver();
|
||||
Uri updateUri = ContactsContract.Data.CONTENT_URI;
|
||||
|
||||
if(photoToAdd != null){
|
||||
//New contact
|
||||
if(isNewContact){
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
|
||||
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, contactID)
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, photoToAdd)
|
||||
.build()
|
||||
);
|
||||
} else { //update contact picture
|
||||
String w = ContactsContract.Data.CONTACT_ID + "='"
|
||||
+ contact.getID() + "' AND "
|
||||
+ ContactsContract.Data.MIMETYPE + " = '"
|
||||
+ ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE + "'";
|
||||
|
||||
Cursor queryCursor = cr.query(updateUri,new String[] { ContactsContract.Data._ID}, w, null, null);
|
||||
if (queryCursor == null) {
|
||||
try {
|
||||
throw new SyncFailedException("EE");
|
||||
} catch (SyncFailedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
if(contact.getPhoto() == null) {
|
||||
String rawContactId = ContactsManager.getInstance().findRawContactID(cr,String.valueOf(contactID));
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
|
||||
.withValue(ContactsContract.Data.RAW_CONTACT_ID, rawContactId)
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, photoToAdd)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
if (queryCursor.moveToFirst()) { // otherwise no photo
|
||||
int colIdx = queryCursor.getColumnIndex(ContactsContract.Data._ID);
|
||||
long id = queryCursor.getLong(colIdx);
|
||||
|
||||
|
||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
||||
.withSelection(ContactsContract.Data._ID + "= ?",new String[] { String.valueOf(id) })
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO, photoToAdd)
|
||||
.build());
|
||||
}
|
||||
queryCursor.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LinearLayout initNumbersFields(final Contact contact) {
|
||||
LinearLayout controls = (LinearLayout) view.findViewById(R.id.controls_numbers);
|
||||
|
|
|
|||
|
|
@ -338,15 +338,24 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
if (searchCursor != null) {
|
||||
searchCursor.close();
|
||||
}
|
||||
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
searchCursor = Compatibility.getSIPContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
} else {
|
||||
searchCursor = Compatibility.getContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
//searchCursor = Compatibility.getSIPContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
//indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
//contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
//contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
} else{
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
searchCursor = Compatibility.getSIPContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
} else {
|
||||
searchCursor = Compatibility.getContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -363,24 +372,30 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
noSipContact.setVisibility(View.GONE);
|
||||
noContact.setVisibility(View.GONE);
|
||||
contactsList.setVisibility(View.VISIBLE);
|
||||
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
if (sipContactsCursor != null && sipContactsCursor.getCount() == 0) {
|
||||
noSipContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
} else {
|
||||
indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts(), sipContactsCursor));
|
||||
}
|
||||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getAllContacts(), allContactsCursor));
|
||||
} else {
|
||||
if (allContactsCursor != null && allContactsCursor.getCount() == 0) {
|
||||
noContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
if (sipContactsCursor != null && sipContactsCursor.getCount() == 0) {
|
||||
noSipContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
} else {
|
||||
indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts(), sipContactsCursor));
|
||||
}
|
||||
} else {
|
||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getAllContacts(), allContactsCursor));
|
||||
if (allContactsCursor != null && allContactsCursor.getCount() == 0) {
|
||||
noContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
} else {
|
||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getAllContacts(), allContactsCursor));
|
||||
}
|
||||
}
|
||||
}
|
||||
ContactsManager.getInstance().setLinphoneContactsPrefered(onlyDisplayLinphoneContacts);
|
||||
|
|
@ -460,7 +475,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
}
|
||||
|
||||
public int getCount() {
|
||||
return cursor.getCount();
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
return LinphoneManager.getLc().getFriendList().length;
|
||||
} else {
|
||||
return cursor.getCount();
|
||||
}
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import android.content.ContentProviderOperation;
|
|||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract;
|
||||
|
||||
|
|
@ -37,7 +38,9 @@ import org.linphone.core.LinphoneProxyConfig;
|
|||
import org.linphone.mediastream.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ContactsManager {
|
||||
private static ContactsManager instance;
|
||||
|
|
@ -103,7 +106,6 @@ public class ContactsManager {
|
|||
mAccount = null;
|
||||
}
|
||||
} else {
|
||||
Log.w("Get Account");
|
||||
mAccount = accounts[0];
|
||||
}
|
||||
initializeContactManager(context,contentResolver);
|
||||
|
|
@ -374,8 +376,6 @@ public class ContactsManager {
|
|||
|
||||
for(Contact c: getAllContacts()){
|
||||
for(String a: c.getNumbersOrAddresses()){
|
||||
Log.w(a);
|
||||
Log.w(address.asStringUriOnly());
|
||||
if(a.equals(sipUri))
|
||||
return c;
|
||||
}
|
||||
|
|
@ -563,6 +563,18 @@ public class ContactsManager {
|
|||
sipContactCursor.close();
|
||||
}
|
||||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)){
|
||||
contactList = new ArrayList<Contact>();
|
||||
for(LinphoneFriend friend : LinphoneManager.getLc().getFriendList()){
|
||||
Contact contact = new Contact(friend.getRefKey(),friend.getAddress());
|
||||
contactList.add(contact);
|
||||
}
|
||||
|
||||
contactCursor = getFriendListCursor(contactList,true);
|
||||
Log.w(contactCursor.getCount());
|
||||
return;
|
||||
}
|
||||
|
||||
if(mAccount == null) return;
|
||||
|
||||
contactCursor = Compatibility.getContactsCursor(contentResolver, getContactsId());
|
||||
|
|
@ -667,4 +679,29 @@ public class ContactsManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
public Cursor getFriendListCursor(List<Contact> contacts, boolean shouldGroupBy){
|
||||
String[] columns = new String[] { ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME };
|
||||
|
||||
|
||||
if (!shouldGroupBy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MatrixCursor result = new MatrixCursor(columns);
|
||||
Set<String> groupBy = new HashSet<String>();
|
||||
for (Contact contact: contacts) {
|
||||
String name = contact.getName();
|
||||
if (!groupBy.contains(name)) {
|
||||
groupBy.add(name);
|
||||
Object[] newRow = new Object[2];
|
||||
|
||||
newRow[0] = contact.getID();
|
||||
newRow[1] = contact.getName();
|
||||
|
||||
result.addRow(newRow);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,21 +225,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
routeAudioToSpeakerHelper(false);
|
||||
}
|
||||
|
||||
public synchronized final void destroyLinphoneCore(Context c) {
|
||||
BluetoothManager.getInstance().destroy();
|
||||
try {
|
||||
mTimer.cancel();
|
||||
mLc.destroy();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
||||
mLc = null;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static final LinphoneManager createAndStart(Context c) {
|
||||
if (instance != null)
|
||||
throw new RuntimeException("Linphone Manager is already initialized");
|
||||
|
|
@ -566,9 +551,26 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
}
|
||||
|
||||
public void resetLinphoneCore(Context c){
|
||||
destroyLinphoneCore(c);
|
||||
startLibLinphone(c);
|
||||
public synchronized final void destroyLinphoneCore() {
|
||||
sExited = true;
|
||||
BluetoothManager.getInstance().destroy();
|
||||
try {
|
||||
mTimer.cancel();
|
||||
mLc.destroy();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
mServiceContext.unregisterReceiver(instance.mKeepAliveReceiver);
|
||||
mLc = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void restartLinphoneCore(){
|
||||
destroyLinphoneCore();
|
||||
startLibLinphone(mServiceContext);
|
||||
sExited = false;
|
||||
}
|
||||
|
||||
private synchronized void startLibLinphone(Context c) {
|
||||
|
|
@ -581,12 +583,6 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, mLinphoneConfigFile, mLinphoneFactoryConfigFile, null, c);
|
||||
|
||||
try {
|
||||
initLiblinphone();
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
@ -610,7 +606,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
}
|
||||
|
||||
private synchronized void initLiblinphone() throws LinphoneCoreException {
|
||||
private synchronized void initLiblinphone(LinphoneCore lc) throws LinphoneCoreException {
|
||||
mLc = lc;
|
||||
boolean isDebugLogEnabled = !(mR.getBoolean(R.bool.disable_every_log)) && mPrefs.isDebugEnabled();
|
||||
LinphoneCoreFactory.instance().setDebugMode(isDebugLogEnabled, getString(R.string.app_name));
|
||||
LinphoneCoreFactory.instance().enableLogCollection(isDebugLogEnabled);
|
||||
|
|
@ -882,6 +879,13 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
public void globalState(final LinphoneCore lc, final GlobalState state, final String message) {
|
||||
Log.i("New global state [",state,"]");
|
||||
if (state == GlobalState.GlobalOn){
|
||||
try {
|
||||
initLiblinphone(lc);
|
||||
} catch (LinphoneCoreException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registrationState(final LinphoneCore lc, final LinphoneProxyConfig proxy,final RegistrationState state,final String message) {
|
||||
|
|
|
|||
|
|
@ -1050,14 +1050,11 @@ public class LinphonePreferences {
|
|||
if (url != null && url.length() == 0) {
|
||||
url = null;
|
||||
}
|
||||
|
||||
LpConfig config = getConfig();
|
||||
config.setString("misc", "config-uri", url);
|
||||
config.sync();
|
||||
getLc().setProvisioningUri(url);
|
||||
}
|
||||
|
||||
public String getRemoteProvisioningUrl() {
|
||||
return getConfig().getString("misc", "config-uri", null);
|
||||
return getLc().getProvisioningUri();
|
||||
}
|
||||
|
||||
public void setDefaultDisplayName(String displayName) {
|
||||
|
|
@ -1087,8 +1084,7 @@ public class LinphonePreferences {
|
|||
if(servers.length > 0) {
|
||||
tunnelConfig = servers[0];
|
||||
} else {
|
||||
tunnelConfig = new TunnelConfig();
|
||||
tunnelConfig.setDelay(500);
|
||||
tunnelConfig = LinphoneCoreFactory.instance().createTunnelConfig();
|
||||
}
|
||||
}
|
||||
return tunnelConfig;
|
||||
|
|
@ -1186,13 +1182,17 @@ public class LinphonePreferences {
|
|||
}
|
||||
|
||||
public void contactsMigrationDone(){
|
||||
getConfig().setBool("app", "contacts_migration_done",true);
|
||||
getConfig().setBool("app", "contacts_migration_done", true);
|
||||
}
|
||||
|
||||
public boolean isContactsMigrationDone(){
|
||||
return getConfig().getBool("app", "contacts_migration_done",false);
|
||||
}
|
||||
|
||||
public String getXmlRpcServerUrl() {
|
||||
return getConfig().getString("app", "server_url", null);
|
||||
}
|
||||
|
||||
public String getDebugPopupAddress(){
|
||||
return getConfig().getString("app", "debug_popup_magic", null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public class StatusFragment extends Fragment {
|
|||
private Timer mTimer;
|
||||
private TimerTask mTask;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private Dialog ZRTPdialog = null;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
|
@ -384,46 +385,48 @@ public class StatusFragment extends Fragment {
|
|||
return;
|
||||
}
|
||||
|
||||
final Dialog dialog = new Dialog(getActivity());
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
|
||||
d.setAlpha(200);
|
||||
dialog.setContentView(R.layout.dialog);
|
||||
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
dialog.getWindow().setBackgroundDrawable(d);
|
||||
if(ZRTPdialog == null || !ZRTPdialog.isShowing()) {
|
||||
ZRTPdialog = new Dialog(getActivity());
|
||||
ZRTPdialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
Drawable d = new ColorDrawable(getResources().getColor(R.color.colorC));
|
||||
d.setAlpha(200);
|
||||
ZRTPdialog.setContentView(R.layout.dialog);
|
||||
ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
ZRTPdialog.getWindow().setBackgroundDrawable(d);
|
||||
|
||||
TextView customText = (TextView) dialog.findViewById(R.id.customText);
|
||||
String newText = getString(R.string.zrtp_dialog).replace("%s",call.getAuthenticationToken());
|
||||
customText.setText(newText);
|
||||
Button delete = (Button) dialog.findViewById(R.id.delete);
|
||||
delete.setText(R.string.accept);
|
||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||
cancel.setText(R.string.deny);
|
||||
TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText);
|
||||
String newText = getString(R.string.zrtp_dialog).replace("%s", call.getAuthenticationToken());
|
||||
customText.setText(newText);
|
||||
Button delete = (Button) ZRTPdialog.findViewById(R.id.delete);
|
||||
delete.setText(R.string.accept);
|
||||
Button cancel = (Button) ZRTPdialog.findViewById(R.id.cancel);
|
||||
cancel.setText(R.string.deny);
|
||||
|
||||
delete.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
call.setAuthenticationTokenVerified(true);
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
cancel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (call != null) {
|
||||
call.setAuthenticationTokenVerified(false);
|
||||
delete.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
call.setAuthenticationTokenVerified(true);
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_pending);
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
}
|
||||
ZRTPdialog.dismiss();
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
});
|
||||
|
||||
cancel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (call != null) {
|
||||
call.setAuthenticationTokenVerified(false);
|
||||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_ko);
|
||||
}
|
||||
}
|
||||
ZRTPdialog.dismiss();
|
||||
}
|
||||
});
|
||||
ZRTPdialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public void initCallStatsRefresher(final LinphoneCall call, final View view) {
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public class AssistantActivity extends Activity implements OnClickListener {
|
|||
if(address != null && address.asString().equals(cfg.getIdentity()) ) {
|
||||
if (state == RegistrationState.RegistrationOk) {
|
||||
if (LinphoneManager.getLc().getDefaultProxyConfig() != null) {
|
||||
//launchEchoCancellerCalibration(true);
|
||||
launchEchoCancellerCalibration(true);
|
||||
success();
|
||||
}
|
||||
} else if (state == RegistrationState.RegistrationFailed) {
|
||||
|
|
@ -403,7 +403,7 @@ public class AssistantActivity extends Activity implements OnClickListener {
|
|||
public void isAccountVerified(String username) {
|
||||
Toast.makeText(this, getString(R.string.setup_account_validated), Toast.LENGTH_LONG).show();
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().refreshRegisters();
|
||||
//launchEchoCancellerCalibration(true);
|
||||
launchEchoCancellerCalibration(true);
|
||||
}
|
||||
|
||||
public void isEchoCalibrationFinished() {
|
||||
|
|
|
|||
|
|
@ -18,12 +18,10 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import static android.content.Intent.ACTION_MAIN;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
|
|
@ -72,7 +70,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
|
@ -81,10 +79,10 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
lc.addListener(mListener);
|
||||
}
|
||||
LinphonePreferences.instance().setContext(this);
|
||||
|
||||
|
||||
checkIntentForConfigUri(getIntent());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
|
@ -93,16 +91,21 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
checkIntentForConfigUri(intent);
|
||||
}
|
||||
|
||||
|
||||
private void checkIntentForConfigUri(final Intent intent) {
|
||||
new Thread(new Runnable() {
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Uri openUri = intent.getData();
|
||||
|
|
@ -116,7 +119,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
}
|
||||
Log.d("Using config uri: " + configUriParam);
|
||||
}
|
||||
|
||||
|
||||
if (configUriParam == null) {
|
||||
if (!LinphonePreferences.instance().isFirstRemoteProvisioning()) {
|
||||
mHandler.post(new Runnable() {
|
||||
|
|
@ -135,7 +138,7 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
}, 1500);
|
||||
} // else we do nothing if there is no config uri parameter and if user not allowed to leave this screen
|
||||
} else {
|
||||
if (getResources().getBoolean(R.bool.display_confirmation_popup_after_first_configuration)
|
||||
if (getResources().getBoolean(R.bool.display_confirmation_popup_after_first_configuration)
|
||||
&& !LinphonePreferences.instance().isFirstRemoteProvisioning()) {
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
|
@ -155,50 +158,46 @@ public class RemoteProvisioningActivity extends Activity {
|
|||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
||||
private void displayDialogConfirmation() {
|
||||
new AlertDialog.Builder(RemoteProvisioningActivity.this)
|
||||
.setTitle(getString(R.string.remote_provisioning_again_title))
|
||||
.setMessage(getString(R.string.remote_provisioning_again_message))
|
||||
.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setRemoteProvisioningAddressAndRestart(configUriParam);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
goToLinphoneActivity();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
.setTitle(getString(R.string.remote_provisioning_again_title))
|
||||
.setMessage(getString(R.string.remote_provisioning_again_message))
|
||||
.setPositiveButton(R.string.button_ok, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
setRemoteProvisioningAddressAndRestart(configUriParam);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.button_cancel, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
goToLinphoneActivity();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
private void setRemoteProvisioningAddressAndRestart(String configUri) {
|
||||
|
||||
private void setRemoteProvisioningAddressAndRestart(final String configUri) {
|
||||
if (spinner != null) spinner.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
LinphonePreferences.instance().setContext(this); // Needed, else the next call will crash
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(configUri);
|
||||
LinphonePreferences.instance().firstRemoteProvisioningSuccessful();
|
||||
|
||||
|
||||
mHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LinphoneManager.destroy();
|
||||
stopService(new Intent(ACTION_MAIN).setClass(RemoteProvisioningActivity.this, LinphoneService.class));
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(RemoteProvisioningActivity.this, LinphoneLauncherActivity.class);
|
||||
startActivity(intent);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
private void goToLinphoneActivity() {
|
||||
if (LinphoneService.isReady()) {
|
||||
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneActivity.class);
|
||||
LinphoneService.instance().setActivityToLaunchOnIncomingReceived(LinphoneLauncherActivity.class);
|
||||
//finish(); // To prevent the user to come back to this page using back button
|
||||
startActivity(new Intent().setClass(this, LinphoneActivity.class));
|
||||
startActivity(new Intent().setClass(this, LinphoneLauncherActivity.class));
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
*/
|
||||
|
||||
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.R;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -57,13 +55,7 @@ public class RemoteProvisioningFragment extends Fragment implements OnClickListe
|
|||
if (id == R.id.assistant_apply) {
|
||||
String url = remoteProvisioningUrl.getText().toString();
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(url);
|
||||
|
||||
// Restart Linphone
|
||||
Intent intent = new Intent();
|
||||
intent.setClass(getActivity(), LinphoneLauncherActivity.class);
|
||||
getActivity().finish();
|
||||
LinphoneActivity.instance().quit();
|
||||
startActivity(intent);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,21 +18,31 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.xmlrpc.XmlRpcHelper;
|
||||
import org.linphone.xmlrpc.XmlRpcListenerBase;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
|
|
@ -40,24 +50,40 @@ import android.widget.ImageView;
|
|||
public class RemoteProvisioningLoginActivity extends Activity implements OnClickListener {
|
||||
private EditText login, password, domain;
|
||||
private ImageView cancel;
|
||||
|
||||
private Button connect;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.assistant_remote_provisioning_login);
|
||||
|
||||
login = (EditText) findViewById(R.id.setup_username);
|
||||
password = (EditText) findViewById(R.id.setup_password);
|
||||
domain = (EditText) findViewById(R.id.setup_domain);
|
||||
login = (EditText) findViewById(R.id.assistant_username);
|
||||
password = (EditText) findViewById(R.id.assistant_password);
|
||||
domain = (EditText) findViewById(R.id.assistant_domain);
|
||||
|
||||
//cancel = (ImageView) findViewById(R.id.cancel);
|
||||
//cancel.setOnClickListener(this);
|
||||
|
||||
connect = (Button) findViewById(R.id.assistant_connect);
|
||||
connect.setOnClickListener(this);
|
||||
|
||||
cancel = (ImageView) findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
|
||||
String defaultDomain = getIntent().getStringExtra("Domain");
|
||||
if (defaultDomain != null) {
|
||||
domain.setText(defaultDomain);
|
||||
domain.setEnabled(false);
|
||||
}
|
||||
|
||||
mListener = new LinphoneCoreListenerBase(){
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc, final LinphoneCore.RemoteProvisioningState state, String message) {
|
||||
if (state == LinphoneCore.RemoteProvisioningState.ConfiguringSuccessful) {
|
||||
//TODO
|
||||
} else if (state == LinphoneCore.RemoteProvisioningState.ConfiguringFailed) {
|
||||
Toast.makeText(RemoteProvisioningLoginActivity.this, R.string.remote_provisioning_failure, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void cancelWizard(boolean bypassCheck) {
|
||||
|
|
@ -70,8 +96,20 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
|
||||
private boolean storeAccount(String username, String password, String domain) {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
|
||||
String identity = "sip:" + username + "@" + domain;
|
||||
|
||||
XmlRpcHelper xmlRpcHelper = new XmlRpcHelper(null);
|
||||
xmlRpcHelper.getRemoteProvisioningFilenameAsync(new XmlRpcListenerBase() {
|
||||
@Override
|
||||
public void onRemoteProvisioningFilenameSent(String result) {
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(result);
|
||||
LinphoneManager.getInstance().restartLinphoneCore();
|
||||
}
|
||||
}, username.toString(), password.toString(), domain.toString());
|
||||
|
||||
LinphonePreferences.instance().firstLaunchSuccessful();
|
||||
setResult(Activity.RESULT_OK);
|
||||
finish();
|
||||
/*String identity = "sip:" + username + "@" + domain;
|
||||
LinphoneProxyConfig prxCfg = lc.createProxyConfig();
|
||||
try {
|
||||
prxCfg.setIdentity(identity);
|
||||
|
|
@ -86,10 +124,28 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
|
||||
if (LinphonePreferences.instance().getAccountCount() == 1)
|
||||
lc.setDefaultProxyConfig(prxCfg);
|
||||
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.addListener(mListener);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if (lc != null) {
|
||||
lc.removeListener(mListener);
|
||||
}
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
|
@ -97,6 +153,9 @@ public class RemoteProvisioningLoginActivity extends Activity implements OnClick
|
|||
if (id == R.id.cancel) {
|
||||
cancelWizard(false);
|
||||
}
|
||||
if (id == R.id.assistant_connect){
|
||||
storeAccount(login.getText().toString(), password.getText().toString(), domain.getText().toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
884
src/org/linphone/xmlrpc/XmlRpcHelper.java
Normal file
884
src/org/linphone/xmlrpc/XmlRpcHelper.java
Normal file
|
|
@ -0,0 +1,884 @@
|
|||
package org.linphone.xmlrpc;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.linphone.LinphonePreferences;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import de.timroes.axmlrpc.XMLRPCCallback;
|
||||
import de.timroes.axmlrpc.XMLRPCClient;
|
||||
import de.timroes.axmlrpc.XMLRPCException;
|
||||
import de.timroes.axmlrpc.XMLRPCServerException;
|
||||
|
||||
public class XmlRpcHelper {
|
||||
public static final String SERVER_ERROR_INVALID_ACCOUNT = "ERROR_INVALID_ACCOUNT";
|
||||
public static final String SERVER_ERROR_PURCHASE_CANCELLED = "ERROR_PURCHASE_CANCELLED";
|
||||
public static final String SERVER_ERROR_RECEIPT_PARSING_FAILED = "ERROR_RECEIPT_PARSING_FAILED";
|
||||
public static final String SERVER_ERROR_UID_ALREADY_IN_USE = "ERROR_UID_ALREADY_IN_USE";
|
||||
public static final String SERVER_ERROR_SIGNATURE_VERIFICATION_FAILED = "ERROR_SIGNATURE_VERIFICATION_FAILED";
|
||||
public static final String SERVER_ERROR_ACCOUNT_ALREADY_EXISTS = "ERROR_ACCOUNT_ALREADY_EXISTS";
|
||||
public static final String SERVER_ERROR_UNKNOWN_ERROR = "ERROR_UNKNOWN_ERROR";
|
||||
|
||||
public static final String CLIENT_ERROR_INVALID_SERVER_URL = "INVALID_SERVER_URL";
|
||||
public static final String CLIENT_ERROR_SERVER_NOT_REACHABLE = "SERVER_NOT_REACHABLE";
|
||||
|
||||
private XMLRPCClient mXmlRpcClient;
|
||||
|
||||
public XmlRpcHelper(String serverUrl) {
|
||||
try {
|
||||
if(serverUrl != null) {
|
||||
mXmlRpcClient = new XMLRPCClient(new URL(serverUrl));
|
||||
} else {
|
||||
mXmlRpcClient = new XMLRPCClient(new URL(LinphonePreferences.instance().getXmlRpcServerUrl()));
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void createAccountAsync(final XmlRpcListener listener, String username, String email, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("createAccountAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountCreated(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "create_account", username, email, password == null ? "" : password);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String createAccount(String username, String email, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("create_account", username, email, password == null ? "" : password);
|
||||
String result = (String)object;
|
||||
Log.d("createAccount: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void getAccountExpireAsync(final XmlRpcListener listener, String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("getAccountExpireAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountExpireFetched(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "get_expiration_for_account", username, password);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String getAccountExpire(String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("get_expiration_for_account", username, password);
|
||||
String result = (String)object;
|
||||
Log.d("getAccountExpire: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updateAccountExpireAsync(final XmlRpcListener listener, String username, String password, String payload, String signature) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("updateAccountExpireAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountExpireUpdated(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "update_expiration_date", username, password, payload, signature);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String updateAccountExpire(String username, String password, String payload, String signature) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("update_expiration_date", username, password, payload, signature);
|
||||
String result = (String)object;
|
||||
Log.d("updateAccountExpire: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void activateAccountAsync(final XmlRpcListener listener, String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("activateAccountAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountActivated(result);
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "activate_account", username, password);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String activateAccount(String gmailAccount, String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("activate_account", username, password);
|
||||
String result = (String)object;
|
||||
Log.d("activateAccount: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void isAccountActivatedAsync(final XmlRpcListener listener, String username) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String) object;
|
||||
Log.d("isAccountActivatedAsync: " + result);
|
||||
|
||||
if ("OK".equals(result)) {
|
||||
listener.onAccountActivatedFetched(true);
|
||||
return;
|
||||
} else if (!"ERROR_ACCOUNT_NOT_ACTIVATED".equals(result)) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
listener.onAccountActivatedFetched(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "check_account_activated", username);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAccountActivated(String username) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("check_account_activated", username);
|
||||
String result = (String)object;
|
||||
Log.d("isAccountActivated: " + result);
|
||||
|
||||
if ("OK".equals(result)) {
|
||||
return true;
|
||||
} else if (!"ERROR_ACCOUNT_NOT_ACTIVATED".equals(result)) {
|
||||
Log.e(result);
|
||||
}
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void isTrialAccountAsync(final XmlRpcListener listener, String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("isTrialAccountAsync: " + result);
|
||||
|
||||
if (!"NOK".equals(result) && !"OK".equals(result)) {
|
||||
listener.onError(result);
|
||||
}
|
||||
listener.onAccountFetched("OK".equals(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "check_account_trial", username, password);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isTrialAccount(String username, String password) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("check_account_trial", username, password);
|
||||
String result = (String)object;
|
||||
Log.d("isTrialAccount: " + result);
|
||||
|
||||
return "OK".equals(result);
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void isAccountAsync(final XmlRpcListener listener, String username) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("isAccountAsync: " + result);
|
||||
|
||||
if ("OK".equals(result)) {
|
||||
listener.onAccountFetched(true);
|
||||
return;
|
||||
} else if (!"ERROR_ACCOUNT_DOESNT_EXIST".equals(result)) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
}
|
||||
listener.onAccountFetched(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "check_account_activated", username);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAccount(String username) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("check_account_activated", username);
|
||||
String result = (String)object;
|
||||
Log.d("isAccount: " + result);
|
||||
|
||||
if ("OK".equals(result)) {
|
||||
return true;
|
||||
} else if (!"ERROR_ACCOUNT_DOESNT_EXIST".equals(result)) {
|
||||
Log.e(result);
|
||||
}
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void changeAccountEmailAsync(final XmlRpcListener listener, String username, String password, String newEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountEmailAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountEmailChanged(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "change_email", username, password, newEmail);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String changeAccountEmail(String username, String password, String newEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("change_email", username, password, newEmail);
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountEmail: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void changeAccountPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountPasswordAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountPasswordChanged(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "change_password", username, oldPassword, newPassword);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String changeAccountPassword(String username, String oldPassword, String newPassword) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("change_password", username, oldPassword, newPassword);
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountPassword: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void changeAccountHashPasswordAsync(final XmlRpcListener listener, String username, String oldPassword, String newPassword) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountHashPasswordAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onAccountPasswordChanged(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "change_hash", username, oldPassword, newPassword);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String changeAccountHashPassword(String username, String oldPassword, String newPassword) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("change_hash", username, oldPassword, newPassword);
|
||||
String result = (String)object;
|
||||
Log.d("changeAccountHashPassword: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendRecoverPasswordLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("sendRecoverPasswordLinkByEmailAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onRecoverPasswordLinkSent(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "send_reset_account_password_email", usernameOrEmail);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String sendRecoverPasswordLinkByEmail(String usernameOrEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("send_reset_account_password_email", usernameOrEmail);
|
||||
String result = (String)object;
|
||||
Log.d("sendRecoverPasswordLinkByEmail: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendActivateAccountLinkByEmailAsync(final XmlRpcListener listener, String usernameOrEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("sendActivateAccountLinkByEmailAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onActivateAccountLinkSent(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "resend_activation_email", usernameOrEmail);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String sendActivateAccountLinkByEmail(String usernameOrEmail) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("resend_activation_email", usernameOrEmail);
|
||||
String result = (String)object;
|
||||
Log.d("sendActivateAccountLinkByEmail: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void sendUsernameByEmailAsync(final XmlRpcListener listener, String email) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("sendUsernameByEmailAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onUsernameSent(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "recover_username_from_email", email);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String sendUsernameByEmail(String email) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("recover_username_from_email", email);
|
||||
String result = (String)object;
|
||||
Log.d("sendUsernameByEmail: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return null;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void verifySignatureAsync(final XmlRpcListener listener, String payload, String signature) {
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("verifySignatureAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onSignatureVerified("OK".equals(result));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "verify_payload_signature", payload, signature);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean verifySignature(String payload, String signature) {
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("verify_payload_signature", payload, signature);
|
||||
String result = (String)object;
|
||||
Log.d("verifySignature: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return false;
|
||||
}
|
||||
return "OK".equals(result);
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void getRemoteProvisioningFilenameAsync(final XmlRpcListener listener,String username, String domain, String password){
|
||||
if (mXmlRpcClient != null) {
|
||||
mXmlRpcClient.callAsync(new XMLRPCCallback() {
|
||||
@Override
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(long id, Object object) {
|
||||
String result = (String)object;
|
||||
Log.d("getRemoteProvisioningFilenameAsync: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
listener.onError(result);
|
||||
return;
|
||||
}
|
||||
|
||||
listener.onRemoteProvisioningFilenameSent(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
Log.e(error);
|
||||
listener.onError(error.toString());
|
||||
}
|
||||
}, "get_remote_provisioning_filename", username, domain, password);
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
listener.onError(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
public String getRemoteProvisioningFilename(String username, String domain, String password){
|
||||
if (mXmlRpcClient != null) {
|
||||
try {
|
||||
Object object = mXmlRpcClient.call("get_remote_provisioning_filename", username, domain, password);
|
||||
String result = (String)object;
|
||||
Log.d("getRemoteProvisioningFilename:: " + result);
|
||||
|
||||
if (result.startsWith("ERROR_")) {
|
||||
Log.e(result);
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (XMLRPCException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
} else {
|
||||
Log.e(CLIENT_ERROR_INVALID_SERVER_URL);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
19
src/org/linphone/xmlrpc/XmlRpcListener.java
Normal file
19
src/org/linphone/xmlrpc/XmlRpcListener.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package org.linphone.xmlrpc;
|
||||
|
||||
public interface XmlRpcListener {
|
||||
public void onError(String error);
|
||||
public void onAccountCreated(String result);
|
||||
public void onAccountExpireFetched(String result);
|
||||
public void onAccountExpireUpdated(String result);
|
||||
public void onAccountActivated(String result);
|
||||
public void onAccountActivatedFetched(boolean isActivated);
|
||||
public void onTrialAccountFetched(boolean isTrial);
|
||||
public void onAccountFetched(boolean isExisting);
|
||||
public void onAccountEmailChanged(String result);
|
||||
public void onAccountPasswordChanged(String result);
|
||||
public void onRecoverPasswordLinkSent(String result);
|
||||
public void onActivateAccountLinkSent(String result);
|
||||
public void onSignatureVerified(boolean success);
|
||||
public void onUsernameSent(String result);
|
||||
public void onRemoteProvisioningFilenameSent(String result);
|
||||
}
|
||||
93
src/org/linphone/xmlrpc/XmlRpcListenerBase.java
Normal file
93
src/org/linphone/xmlrpc/XmlRpcListenerBase.java
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
package org.linphone.xmlrpc;
|
||||
|
||||
public class XmlRpcListenerBase implements XmlRpcListener {
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountCreated(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountExpireFetched(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountActivated(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountActivatedFetched(boolean isActivated) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrialAccountFetched(boolean isTrial) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountFetched(boolean isExisting) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountEmailChanged(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountPasswordChanged(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecoverPasswordLinkSent(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivateAccountLinkSent(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccountExpireUpdated(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSignatureVerified(boolean success) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsernameSent(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteProvisioningFilenameSent(String result) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 611b6c3b1d237dc9fa4113c39c2f5f070235b783
|
||||
Subproject commit 91ea725ebd9ce931de6356235bf1b500aeaa86fa
|
||||
2
submodules/externals/polarssl
vendored
2
submodules/externals/polarssl
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit ab2f403a3e0ec91257f0e943129c0eec272f34e8
|
||||
Subproject commit 919006f5f33febe72205078a125fae811b12a3d6
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 847f56bb4c91032c44335df53fb10bdb1001f8d6
|
||||
Subproject commit faa60922366ddb62f35ec4fe05bfd4bc8fc87aa6
|
||||
|
|
@ -4,7 +4,8 @@
|
|||
<string name="account_linphone_login">wizard15</string>
|
||||
<string name="account_linphone_pwd">wizard15</string>
|
||||
<string name="account_linphone_domain">sip.linphone.org</string>
|
||||
|
||||
<string name="account_linphone_display_name">Bob</string>
|
||||
|
||||
<string name="account_generic_login">wizard15</string>
|
||||
<string name="account_generic_pwd">wizard15</string>
|
||||
<string name="account_generic_domain">test.linphone.org</string>
|
||||
|
|
|
|||
|
|
@ -21,31 +21,33 @@ import android.widget.TextView;
|
|||
*/
|
||||
public class AccountAssistant extends SampleTest {
|
||||
|
||||
@SmallTest
|
||||
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testAWizardDisplayedAfterInstall() {
|
||||
solo.waitForActivity("SetupActivity", 3000);
|
||||
solo.assertCurrentActivity("Expected Setup Activity", AssistantActivity.class);
|
||||
solo.waitForActivity("AssistantActivity", 3000);
|
||||
solo.assertCurrentActivity("Expected Assistant Activity", AssistantActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testBLoginWithLinphoneAccount() {
|
||||
solo.waitForActivity("SetupActivity", 3000);
|
||||
solo.assertCurrentActivity("Expected Setup Activity", AssistantActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_login_linphone));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_linphone_login));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_linphone_pwd));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_apply));
|
||||
solo.waitForActivity("AssistantActivity", 3000);
|
||||
solo.assertCurrentActivity("Expected Assistant Activity", AssistantActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.login_linphone));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_username), iContext.getString(R.string.account_linphone_login));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_password), iContext.getString(R.string.account_linphone_pwd));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_display_name), iContext.getString(R.string.account_linphone_display_name));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.assistant_apply));
|
||||
|
||||
solo.sleep(1000);
|
||||
|
||||
//Test echo calibration launch at first start
|
||||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.assistant_ec_calibration)));
|
||||
|
||||
if (!Hacks.hasBuiltInEchoCanceller())
|
||||
solo.waitForActivity("LinphoneActivity", 8000);
|
||||
else
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.waitForActivity("LinphoneActivity", 8000);
|
||||
Assert.assertTrue(solo.searchText(iContext.getString(R.string.account_linphone_login) + "@sip.linphone.org"));
|
||||
|
||||
solo.sleep(3000); //Wait for registration to be done
|
||||
|
|
@ -65,27 +67,31 @@ public class AccountAssistant extends SampleTest {
|
|||
String proxy = prefs.getAccountProxy(0);
|
||||
Assert.assertEquals("<sip:" + aContext.getString(org.linphone.R.string.default_domain) + ":5223;transport=tls>", proxy);
|
||||
Assert.assertEquals(true, prefs.isAccountOutboundProxySet(0));
|
||||
|
||||
String display_name = prefs.getAccountDisplayName(0);
|
||||
Assert.assertEquals(iContext.getString(R.string.account_linphone_display_name), display_name);
|
||||
|
||||
boolean ice = prefs.isIceEnabled();
|
||||
Assert.assertEquals(ice, true);
|
||||
}
|
||||
|
||||
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testCWizardDoesntShowWhenAccountIsConfigured() {
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testDLoginWithGenericAccount() {
|
||||
startWizard();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_login_generic));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_generic_login));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_generic_pwd));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_domain), iContext.getString(R.string.account_generic_domain));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_apply));
|
||||
startAssistant();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.login_generic));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_username), iContext.getString(R.string.account_generic_login));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_password), iContext.getString(R.string.account_generic_pwd));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.assistant_domain), iContext.getString(R.string.account_generic_domain));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.assistant_apply));
|
||||
|
||||
if (!Hacks.hasBuiltInEchoCanceller())
|
||||
solo.waitForActivity("LinphoneActivity", 8000);
|
||||
|
|
@ -99,22 +105,24 @@ public class AccountAssistant extends SampleTest {
|
|||
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
|
||||
waitForRegistration(proxyConfig);
|
||||
}
|
||||
|
||||
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testECreateNewAccount() {
|
||||
startWizard();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.setup_next));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_create_account));
|
||||
|
||||
TextView error = (TextView) solo.getView(org.linphone.R.id.setup_error);
|
||||
ImageView createAccount = (ImageView) solo.getView(org.linphone.R.id.setup_create);
|
||||
//startAssistant();
|
||||
|
||||
//solo.clickOnView(solo.getView(org.linphone.R.id.create_account));
|
||||
|
||||
//solo.enterText((EditText) solo.getView(org.linphone.R.id.edittext), iContext.getString(R.string.account_create_login).substring(0,2));
|
||||
//solo.sleep(200);
|
||||
//Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_username_incorrect));
|
||||
// Assert.assertFalse(createAccount.isEnabled());
|
||||
|
||||
//TextView error = (TextView) solo.getView(org.linphone.R.id.setup_error);
|
||||
/*ImageView createAccount = (ImageView) solo.getView(org.linphone.R.id.assistant_create);
|
||||
int sleepingTime = 1500;
|
||||
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_create_login).substring(0,2));
|
||||
solo.sleep(sleepingTime);
|
||||
Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_username_incorrect));
|
||||
Assert.assertFalse(createAccount.isEnabled());
|
||||
|
||||
|
||||
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_username));
|
||||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_linphone_login));
|
||||
|
|
@ -149,23 +157,23 @@ public class AccountAssistant extends SampleTest {
|
|||
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_email), iContext.getString(R.string.account_create_email));
|
||||
solo.sleep(sleepingTime);
|
||||
Assert.assertEquals(error.getText(), "");
|
||||
Assert.assertTrue(createAccount.isEnabled());
|
||||
Assert.assertTrue(createAccount.isEnabled());*/
|
||||
}
|
||||
|
||||
|
||||
@LargeTest
|
||||
public void testFCancelWizard() {
|
||||
startWizard();
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.setup_cancel));
|
||||
startAssistant();
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.cancel));
|
||||
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
private void startWizard() {
|
||||
private void startAssistant() {
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.setup_title).substring(0, STRING_LENGTH_MAX));
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
|
||||
solo.clickOnText("Assistant");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ public class AccountManagement extends SampleTest {
|
|||
private void goToSettings() {
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
|
||||
solo.clickOnText("Settings");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@ package org.linphone.test;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.linphone.InCallActivity;
|
||||
import org.linphone.IncomingCallActivity;
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.CallIncomingActivity;
|
||||
import org.linphone.CallOutgoingActivity;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
|
|
@ -18,10 +18,6 @@ import android.test.suitebuilder.annotation.SmallTest;
|
|||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
|
@ -51,14 +47,16 @@ public class CallsAudio extends SampleTest {
|
|||
|
||||
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||
|
||||
solo.waitForActivity("CallOutgoingActivity", 400);
|
||||
//assertOutgoingCallIsCorrectlyRunning();
|
||||
|
||||
assertCallIsCorrectlyRunning();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hang_up));
|
||||
solo.waitForActivity("LinphoneActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testCDTMFRFC2833InPCMUCall() {
|
||||
|
|
@ -89,7 +87,8 @@ public class CallsAudio extends SampleTest {
|
|||
solo.waitForActivity("LinphoneActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testDDTMFSIPINFO() {
|
||||
|
|
@ -116,6 +115,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testEOutgoingCallToAudioClient() {
|
||||
|
|
@ -123,14 +123,15 @@ public class CallsAudio extends SampleTest {
|
|||
|
||||
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||
|
||||
solo.waitForActivity("CallOutgoingActivity", 2000);
|
||||
|
||||
assertCallIsCorrectlyRunning();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hang_up));
|
||||
solo.waitForActivity("LinphoneActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testFOutgoingCallToVideoClient() {
|
||||
|
|
@ -138,14 +139,15 @@ public class CallsAudio extends SampleTest {
|
|||
|
||||
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||
|
||||
solo.waitForActivity("CallOutgoingActivity", 5000);
|
||||
|
||||
assertCallIsCorrectlyRunning();
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hang_up));
|
||||
solo.waitForActivity("LinphoneActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testGOutgoingCallCancelled() {
|
||||
|
|
@ -153,20 +155,21 @@ public class CallsAudio extends SampleTest {
|
|||
|
||||
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
|
||||
|
||||
solo.waitForActivity("CallOutgoingActivity", 200);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallOutgoingActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
waitForCallState(LinphoneManager.getLc().getCalls()[0],LinphoneCall.State.OutgoingRinging);
|
||||
|
||||
LinphoneTestManager.getInstance().autoAnswer = true;
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.hang_up));
|
||||
solo.waitForActivity("LinphoneActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testHOutgoingCallDeclined() {
|
||||
|
|
@ -199,21 +202,24 @@ public class CallsAudio extends SampleTest {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.waitForActivity("CallIncomingActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
/*View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
int topLayoutHeigh = topLayout.getMeasuredHeight();
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int topOffset = dm.heightPixels - topLayoutHeigh;
|
||||
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
|
||||
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
|
||||
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);*/
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.accept));
|
||||
|
||||
assertCallIsCorrectlyRunning();
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@LargeTest
|
||||
public void testJIncomingVideoCall() {
|
||||
LinphoneTestManager.getLc().enableVideo(true, true);
|
||||
|
|
@ -225,21 +231,24 @@ public class CallsAudio extends SampleTest {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.waitForActivity("CallIncomingActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
/*solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
int topLayoutHeigh = topLayout.getMeasuredHeight();
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
int topOffset = dm.heightPixels - topLayoutHeigh;
|
||||
int slidersTop = topLayoutHeigh - 80 - topOffset; // 80 is the bottom margin set in incoming.xml
|
||||
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);
|
||||
solo.drag(10, topLayout.getMeasuredWidth() - 10, slidersTop, slidersTop, 10);*/
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.accept));
|
||||
|
||||
assertCallIsCorrectlyRunning();
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testKSelfPauseResumeCall() {
|
||||
|
|
@ -253,7 +262,7 @@ public class CallsAudio extends SampleTest {
|
|||
|
||||
waitForCallPaused(LinphoneManager.getLc().getCalls()[0]);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.pause));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.call_pause));
|
||||
solo.sleep(1000);
|
||||
|
||||
waitForCallResumed(LinphoneManager.getLc().getCalls()[0]);
|
||||
|
|
@ -263,6 +272,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testLRemotePauseResumeCall() {
|
||||
|
|
@ -287,6 +297,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@LargeTest
|
||||
public void testMSwitchOnVideoInCallIsNotAllowed() {
|
||||
solo.enterText(0, iContext.getString(org.linphone.test.R.string.account_test_calls_login) + "@" + iContext.getString(org.linphone.test.R.string.account_test_calls_domain));
|
||||
|
|
@ -301,6 +312,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@LargeTest
|
||||
public void testNDeclineIncomingCall() {
|
||||
LinphoneTestManager.getInstance().declineCall = false; // Just in case
|
||||
|
|
@ -313,8 +325,8 @@ public class CallsAudio extends SampleTest {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.waitForActivity("CallIncomingActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
|
|
@ -326,6 +338,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.drag(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testOCancelledIncomingCall() {
|
||||
|
|
@ -339,8 +352,8 @@ public class CallsAudio extends SampleTest {
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.waitForActivity("CallIncomingActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
LinphoneTestManager.getLc().terminateAllCalls();
|
||||
|
||||
|
|
@ -348,6 +361,7 @@ public class CallsAudio extends SampleTest {
|
|||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testPDisplayMissedCallsNumber() {
|
||||
|
|
@ -358,10 +372,20 @@ public class CallsAudio extends SampleTest {
|
|||
}
|
||||
|
||||
//TODO: Test each audio codec
|
||||
|
||||
private void assertOutgoingCallIsCorrectlyRunning() {
|
||||
solo.waitForActivity("CallOutgoingActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected OutgoingCall Activity", CallOutgoingActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
|
||||
waitForCallState(call, LinphoneCall.State.OutgoingProgress);
|
||||
}
|
||||
|
||||
private void assertCallIsCorrectlyRunning() {
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.waitForActivity("CallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
|
|
@ -373,7 +397,8 @@ public class CallsAudio extends SampleTest {
|
|||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
|
||||
solo.clickOnText("Settings");
|
||||
}
|
||||
|
||||
private void goToAudioCodecsSettings() {
|
||||
|
|
|
|||
|
|
@ -2,20 +2,17 @@ package org.linphone.test;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.linphone.InCallActivity;
|
||||
import org.linphone.IncomingCallActivity;
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.CallIncomingActivity;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphonePlayer;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
|
|
@ -24,7 +21,7 @@ import android.view.View;
|
|||
*/
|
||||
public class CallsVideo extends SampleTest {
|
||||
|
||||
@SmallTest
|
||||
// @SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testAInit() {
|
||||
|
|
@ -50,7 +47,7 @@ public class CallsVideo extends SampleTest {
|
|||
Assert.assertTrue(LinphoneManager.getLc().getVideoAutoInitiatePolicy());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
// @SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testBOutgoingCallWithDefaultConfig() {
|
||||
|
|
@ -165,7 +162,7 @@ public class CallsVideo extends SampleTest {
|
|||
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
|
||||
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
waitForCallState(LinphoneManager.getLc().getCalls()[0],LinphoneCall.State.OutgoingRinging);
|
||||
|
|
@ -208,7 +205,7 @@ public class CallsVideo extends SampleTest {
|
|||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
|
|
@ -222,7 +219,7 @@ public class CallsVideo extends SampleTest {
|
|||
assertCallIsCorrectlyRunning();
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
// @SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testJIncomingVideoCall() {
|
||||
|
|
@ -236,7 +233,7 @@ public class CallsVideo extends SampleTest {
|
|||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
|
|
@ -333,7 +330,7 @@ public class CallsVideo extends SampleTest {
|
|||
|
||||
private void assertCallIsCorrectlyRunning() {
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
|
|
@ -344,8 +341,8 @@ public class CallsVideo extends SampleTest {
|
|||
private void goToSettings() {
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
|
||||
solo.clickOnText("Settings");
|
||||
}
|
||||
|
||||
private void goToAudioCodecsSettings() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import android.widget.EditText;
|
|||
*/
|
||||
public class Chat extends SampleTest {
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testAEmptyChatHistory() {
|
||||
|
|
@ -33,7 +33,7 @@ public class Chat extends SampleTest {
|
|||
chatStorage.removeDiscussion(conversation);
|
||||
}
|
||||
|
||||
Assert.assertEquals(0, chatStorage.getUnreadMessageCount());
|
||||
Assert.assertEquals(0, LinphoneActivity.instance().getUnreadMessageCount());
|
||||
}
|
||||
|
||||
@LargeTest
|
||||
|
|
@ -43,13 +43,13 @@ public class Chat extends SampleTest {
|
|||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testCSendTextMessage() {
|
||||
goToChat();
|
||||
|
||||
solo.enterText(0, "sip:" + iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
|
||||
/* solo.enterText(0, "sip:" + iContext.getString(R.string.account_test_calls_login) + "@" + iContext.getString(R.string.account_test_calls_domain));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.newDiscussion));
|
||||
|
||||
solo.enterText((EditText)solo.getView(org.linphone.R.id.message), iContext.getString(R.string.chat_test_text_sent));
|
||||
|
|
@ -57,7 +57,7 @@ public class Chat extends SampleTest {
|
|||
|
||||
solo.sleep(1000);
|
||||
Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_sent)));
|
||||
Assert.assertEquals(iContext.getString(R.string.chat_test_text_sent), LinphoneTestManager.getInstance().lastMessageReceived);
|
||||
Assert.assertEquals(iContext.getString(R.string.chat_test_text_sent), LinphoneTestManager.getInstance().lastMessageReceived);*/
|
||||
}
|
||||
|
||||
@LargeTest
|
||||
|
|
@ -67,7 +67,7 @@ public class Chat extends SampleTest {
|
|||
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testEReceiveTextMessage() {
|
||||
|
|
|
|||
|
|
@ -4,24 +4,22 @@ import java.util.ArrayList;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.linphone.InCallActivity;
|
||||
import org.linphone.IncomingCallActivity;
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.CallIncomingActivity;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
public class ConferenceAndMultiCall extends SampleTest {
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testAInit() {
|
||||
|
|
@ -42,7 +40,7 @@ public class ConferenceAndMultiCall extends SampleTest {
|
|||
Assert.assertFalse(LinphoneManager.getLc().isVideoEnabled());
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testBSimpleConference() {
|
||||
|
|
@ -190,7 +188,7 @@ public class ConferenceAndMultiCall extends SampleTest {
|
|||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
|
|
@ -224,7 +222,7 @@ public class ConferenceAndMultiCall extends SampleTest {
|
|||
}
|
||||
|
||||
solo.waitForActivity("IncomingCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected Incoming Call Activity", CallIncomingActivity.class);
|
||||
|
||||
solo.sleep(1000);
|
||||
View topLayout = solo.getView(org.linphone.R.id.topLayout);
|
||||
|
|
@ -250,8 +248,8 @@ public class ConferenceAndMultiCall extends SampleTest {
|
|||
private void goToSettings() {
|
||||
solo.waitForActivity("LinphoneActivity", 2000);
|
||||
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
|
||||
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.side_menu_button));
|
||||
solo.clickOnText("Settings");
|
||||
}
|
||||
|
||||
private void startTwoCalls() {
|
||||
|
|
@ -280,7 +278,7 @@ public class ConferenceAndMultiCall extends SampleTest {
|
|||
|
||||
private void assertCallIsCorrectlyRunning(int lcId) {
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
Assert.assertEquals(1, LinphoneTestManager.getLc(lcId).getCallsNb());
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class Contacts extends SampleTest {
|
|||
Assert.assertFalse(solo.searchText(iContext.getString(org.linphone.test.R.string.contact_name)));
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testBCreateContactWithPhoneNumber() {
|
||||
|
|
@ -102,11 +102,11 @@ public class Contacts extends SampleTest {
|
|||
goToContacts();
|
||||
|
||||
solo.clickOnText(iContext.getString(org.linphone.test.R.string.contact_name));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.start_chat));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.chat));
|
||||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.button_send_message)));
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testGDeleteContact() {
|
||||
|
|
|
|||
|
|
@ -2,20 +2,19 @@ package org.linphone.test;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.linphone.InCallActivity;
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
public class History extends SampleTest {
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testACheckForTestCallInHistory() {
|
||||
|
|
@ -40,7 +39,7 @@ public class History extends SampleTest {
|
|||
solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
|
||||
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
Assert.assertEquals(1, LinphoneTestManager.getLc().getCallsNb());
|
||||
|
|
@ -62,16 +61,16 @@ public class History extends SampleTest {
|
|||
solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
|
||||
}
|
||||
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testEDeleteAll() {
|
||||
goToHistory();
|
||||
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
|
||||
/*solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
|
||||
solo.clickOnView(solo.getView(org.linphone.R.id.deleteAll));
|
||||
solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
|
||||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_call_history)));
|
||||
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_call_history)));*/
|
||||
}
|
||||
|
||||
private void goToHistory() {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package org.linphone.test;
|
|||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.linphone.InCallActivity;
|
||||
import org.linphone.CallActivity;
|
||||
import org.linphone.LinphoneActivity;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
|
|
@ -10,10 +10,9 @@ import org.linphone.mediastream.Log;
|
|||
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.test.suitebuilder.annotation.MediumTest;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
public class Transfer extends SampleTest {
|
||||
@SmallTest
|
||||
//@SmallTest
|
||||
@MediumTest
|
||||
@LargeTest
|
||||
public void testACallTransfer() {
|
||||
|
|
@ -41,7 +40,7 @@ public class Transfer extends SampleTest {
|
|||
|
||||
private void assertCallIsCorrectlyRunning() {
|
||||
solo.waitForActivity("InCallActivity", 5000);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
|
||||
solo.assertCurrentActivity("Expected InCall Activity", CallActivity.class);
|
||||
|
||||
solo.sleep(2000);
|
||||
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue