Removed previous xmlrpc lib by the one in liblinphone
This commit is contained in:
parent
937b7d9953
commit
74e19a769a
12 changed files with 321 additions and 809 deletions
|
@ -4,7 +4,6 @@
|
|||
<classpathentry kind="src" path="submodules/linphone/java/j2se"/>
|
||||
<classpathentry kind="src" path="submodules/linphone/java/common"/>
|
||||
<classpathentry kind="src" path="submodules/linphone/java/impl"/>
|
||||
<classpathentry kind="src" path="submodules/externals/axmlrpc/src/main/java"/>
|
||||
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
|
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -55,9 +55,6 @@
|
|||
[submodule "submodules/externals/libupnp"]
|
||||
path = submodules/externals/libupnp
|
||||
url = git://git.linphone.org/libupnp.git
|
||||
[submodule "submodules/externals/axmlrpc"]
|
||||
path = submodules/externals/axmlrpc
|
||||
url = git://git.linphone.org/axmlrpc.git
|
||||
[submodule "submodules/externals/opus"]
|
||||
path = submodules/externals/opus
|
||||
url = git://git.linphone.org/opus.git
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java:submodules/externals/axmlrpc/src/main/java
|
||||
source.dir=src:submodules/linphone/mediastreamer2/java/src:submodules/linphone/java/j2se:submodules/linphone/java/common:submodules/linphone/java/impl:submodules/linphone/coreapi/help/java
|
||||
key.store=bc-android.keystore
|
||||
key.alias=nw8000
|
||||
version.name=2.5.0
|
||||
|
|
|
@ -372,7 +372,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
if (lc == null) return;
|
||||
|
||||
friend.edit();
|
||||
friend.setFamillyName(lastName);
|
||||
friend.setFamilyName(lastName);
|
||||
friend.setGivenName(firstName);
|
||||
|
||||
for (LinphoneAddress address : friend.getAddresses()) {
|
||||
|
@ -461,7 +461,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
} else if (isLinphoneFriend()) {
|
||||
fullName = friend.getName();
|
||||
lastName = friend.getFamillyName();
|
||||
lastName = friend.getFamilyName();
|
||||
firstName = friend.getGivenName();
|
||||
thumbnailUri = null;
|
||||
photoUri = null;
|
||||
|
@ -491,7 +491,7 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
createOrUpdateFriend();
|
||||
} else if (isLinphoneFriend()) {
|
||||
fullName = friend.getName();
|
||||
lastName = friend.getFamillyName();
|
||||
lastName = friend.getFamilyName();
|
||||
firstName = friend.getGivenName();
|
||||
thumbnailUri = null;
|
||||
photoUri = null;
|
||||
|
|
|
@ -25,16 +25,13 @@ import static android.media.AudioManager.STREAM_VOICE_CALL;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
@ -81,14 +78,11 @@ import android.annotation.TargetApi;
|
|||
import android.app.Activity;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorEvent;
|
||||
import android.hardware.SensorEventListener;
|
||||
|
@ -99,13 +93,10 @@ import android.net.ConnectivityManager;
|
|||
import android.net.NetworkInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.Vibrator;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.MediaStore.Images;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.SettingNotFoundException;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
@ -220,7 +211,8 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
routeAudioToSpeakerHelper(true);
|
||||
}
|
||||
|
||||
public String getUserAgent() throws NameNotFoundException {
|
||||
public String getUserAgent() {
|
||||
try {
|
||||
StringBuilder userAgent = new StringBuilder();
|
||||
userAgent.append("LinphoneAndroid/" + mServiceContext.getPackageManager().getPackageInfo(mServiceContext.getPackageName(),0).versionCode);
|
||||
userAgent.append(" (");
|
||||
|
@ -228,6 +220,10 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
userAgent.append(Build.DEVICE + " " + Build.MODEL + " Android/" + Build.VERSION.SDK_INT);
|
||||
userAgent.append(")");
|
||||
return userAgent.toString();
|
||||
} catch (NameNotFoundException nnfe) {
|
||||
Log.e(nnfe);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void routeAudioToReceiver() {
|
||||
|
|
|
@ -17,20 +17,22 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||
import org.linphone.core.LinphoneXmlRpcSession;
|
||||
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
|
@ -45,10 +47,6 @@ import android.widget.Button;
|
|||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import de.timroes.axmlrpc.XMLRPCCallback;
|
||||
import de.timroes.axmlrpc.XMLRPCClient;
|
||||
import de.timroes.axmlrpc.XMLRPCException;
|
||||
import de.timroes.axmlrpc.XMLRPCServerException;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
@ -63,6 +61,7 @@ public class CreateAccountFragment extends Fragment {
|
|||
private boolean confirmPasswordOk = false;
|
||||
private Button createAccount;
|
||||
private final Pattern UPPER_CASE_REGEX = Pattern.compile("[A-Z]");
|
||||
private LinphoneXmlRpcSession xmlRpcSession;
|
||||
|
||||
private String getUsername() {
|
||||
String username = usernameEdit.getText().toString();
|
||||
|
@ -120,6 +119,8 @@ public class CreateAccountFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -145,59 +146,47 @@ public class CreateAccountFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void isUsernameRegistred(final String username, final ImageView icon) {
|
||||
final Runnable runNotReachable = new Runnable() {
|
||||
final Runnable runNotOk = new Runnable() {
|
||||
public void run() {
|
||||
usernameOk = false;
|
||||
displayError(usernameOk, usernameError, usernameEdit, getResources().getString(R.string.wizard_server_unavailable));
|
||||
displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_username_unavailable));
|
||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
XMLRPCClient client = new XMLRPCClient(new URL(getString(R.string.wizard_url)));
|
||||
|
||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
||||
Runnable runNotOk = new Runnable() {
|
||||
public void run() {
|
||||
usernameOk = false;
|
||||
displayError(usernameOk, usernameError, usernameEdit, getResources().getString(R.string.wizard_username_unavailable));
|
||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||
}
|
||||
};
|
||||
|
||||
Runnable runOk = new Runnable() {
|
||||
final Runnable runOk = new Runnable() {
|
||||
public void run() {
|
||||
usernameOk = true;
|
||||
displayError(usernameOk, usernameError, usernameEdit, "");
|
||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||
}
|
||||
};
|
||||
|
||||
public void onResponse(long id, Object result) {
|
||||
int answer = (Integer) result;
|
||||
if (answer != 0) {
|
||||
mHandler.post(runNotOk);
|
||||
}
|
||||
else {
|
||||
mHandler.post(runOk);
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
mHandler.post(runNotReachable);
|
||||
}
|
||||
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
mHandler.post(runNotReachable);
|
||||
final Runnable runNotReachable = new Runnable() {
|
||||
public void run() {
|
||||
usernameOk = false;
|
||||
displayError(usernameOk, usernameError, usernameEdit, LinphoneManager.getInstance().getContext().getString(R.string.wizard_server_unavailable));
|
||||
createAccount.setEnabled(usernameOk && passwordOk && confirmPasswordOk && emailOk);
|
||||
}
|
||||
};
|
||||
|
||||
client.callAsync(listener, "check_account", username);
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("check_account", LinphoneXmlRpcRequest.ArgType.Int);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
int response = request.getIntResponse();
|
||||
if (response != 0) {
|
||||
mHandler.post(runNotOk);
|
||||
} else {
|
||||
mHandler.post(runOk);
|
||||
}
|
||||
catch(Exception ex) {
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
mHandler.post(runNotReachable);
|
||||
}
|
||||
}
|
||||
});
|
||||
xmlRpcRequest.addStringArg(username);
|
||||
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||
}
|
||||
|
||||
private boolean isEmailCorrect(String email) {
|
||||
Pattern emailPattern = Patterns.EMAIL_ADDRESS;
|
||||
|
@ -209,53 +198,43 @@ public class CreateAccountFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void createAccount(final String username, final String password, String email, boolean suscribe) {
|
||||
final Runnable runNotReachable = new Runnable() {
|
||||
public void run() {
|
||||
//TODO errorMessage.setText(R.string.wizard_server_unavailable);
|
||||
}
|
||||
};
|
||||
|
||||
final Context context = AssistantActivity.instance() == null ? LinphoneService.instance().getApplicationContext() : AssistantActivity.instance();
|
||||
|
||||
try {
|
||||
XMLRPCClient client = new XMLRPCClient(new URL(context.getString(R.string.wizard_url)));
|
||||
|
||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
||||
Runnable runNotOk = new Runnable() {
|
||||
final Runnable runNotOk = new Runnable() {
|
||||
public void run() {
|
||||
//TODO errorMessage.setText(R.string.wizard_failed);
|
||||
}
|
||||
};
|
||||
|
||||
Runnable runOk = new Runnable() {
|
||||
final Runnable runOk = new Runnable() {
|
||||
public void run() {
|
||||
AssistantActivity.instance().displayAssistantConfirm(username, password);
|
||||
}
|
||||
};
|
||||
final Runnable runNotReachable = new Runnable() {
|
||||
public void run() {
|
||||
//TODO errorMessage.setText(R.string.wizard_not_reachable);
|
||||
}
|
||||
};
|
||||
|
||||
public void onResponse(long id, Object result) {
|
||||
int answer = (Integer) result;
|
||||
if (answer != 0) {
|
||||
LinphoneXmlRpcRequest xmlRpcRequest = new LinphoneXmlRpcRequestImpl("create_account_with_useragent", LinphoneXmlRpcRequest.ArgType.Int);
|
||||
xmlRpcRequest.setListener(new LinphoneXmlRpcRequestListener() {
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
if (request.getStatus() == LinphoneXmlRpcRequest.Status.Ok) {
|
||||
int response = request.getIntResponse();
|
||||
if (response != 0) {
|
||||
mHandler.post(runNotOk);
|
||||
} else {
|
||||
mHandler.post(runOk);
|
||||
}
|
||||
}
|
||||
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
} else if (request.getStatus() == LinphoneXmlRpcRequest.Status.Failed) {
|
||||
mHandler.post(runNotReachable);
|
||||
}
|
||||
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
mHandler.post(runNotReachable);
|
||||
}
|
||||
};
|
||||
|
||||
client.callAsync(listener, "create_account_with_useragent", username, password, email, LinphoneManager.getInstance().getUserAgent());
|
||||
}
|
||||
catch(Exception ex) {
|
||||
mHandler.post(runNotReachable);
|
||||
}
|
||||
});
|
||||
xmlRpcRequest.addStringArg(username);
|
||||
xmlRpcRequest.addStringArg(password);
|
||||
xmlRpcRequest.addStringArg(email);
|
||||
xmlRpcRequest.addStringArg(LinphoneManager.getInstance().getUserAgent());
|
||||
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||
}
|
||||
|
||||
private void addXMLRPCUsernameHandler(final EditText field, final ImageView icon) {
|
||||
|
|
|
@ -19,35 +19,37 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.R;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest;
|
||||
import org.linphone.core.LinphoneXmlRpcRequest.LinphoneXmlRpcRequestListener;
|
||||
import org.linphone.core.LinphoneXmlRpcRequestImpl;
|
||||
import org.linphone.core.LinphoneXmlRpcSession;
|
||||
import org.linphone.core.LinphoneXmlRpcSessionImpl;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import de.timroes.axmlrpc.XMLRPCCallback;
|
||||
import de.timroes.axmlrpc.XMLRPCClient;
|
||||
import de.timroes.axmlrpc.XMLRPCException;
|
||||
import de.timroes.axmlrpc.XMLRPCServerException;
|
||||
|
||||
/**
|
||||
* @author Ghislain MARY
|
||||
*/
|
||||
public class EchoCancellerCalibrationFragment extends Fragment {
|
||||
public class EchoCancellerCalibrationFragment extends Fragment implements LinphoneXmlRpcRequestListener {
|
||||
private Handler mHandler = new Handler();
|
||||
private boolean mSendEcCalibrationResult = false;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private LinphoneXmlRpcSession xmlRpcSession;
|
||||
private LinphoneXmlRpcRequest xmlRpcRequest;
|
||||
private Runnable runFinished;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -65,6 +67,15 @@ public class EchoCancellerCalibrationFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
};
|
||||
runFinished = new Runnable() {
|
||||
public void run() {
|
||||
AssistantActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
};
|
||||
|
||||
xmlRpcSession = new LinphoneXmlRpcSessionImpl(LinphoneManager.getLcIfManagerNotDestroyedOrNull(), getString(R.string.wizard_url));
|
||||
xmlRpcRequest = new LinphoneXmlRpcRequestImpl("add_ec_calibration_result", LinphoneXmlRpcRequest.ArgType.None);
|
||||
xmlRpcRequest.setListener(this);
|
||||
|
||||
try {
|
||||
LinphoneManager.getInstance().startEcCalibration(mListener);
|
||||
|
@ -79,34 +90,19 @@ public class EchoCancellerCalibrationFragment extends Fragment {
|
|||
mSendEcCalibrationResult = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onXmlRpcRequestResponse(LinphoneXmlRpcRequest request) {
|
||||
mHandler.post(runFinished);
|
||||
}
|
||||
|
||||
private void sendEcCalibrationResult(EcCalibratorStatus status, int delayMs) {
|
||||
try {
|
||||
XMLRPCClient client = new XMLRPCClient(new URL(getString(R.string.wizard_url)));
|
||||
|
||||
XMLRPCCallback listener = new XMLRPCCallback() {
|
||||
Runnable runFinished = new Runnable() {
|
||||
public void run() {
|
||||
AssistantActivity.instance().isEchoCalibrationFinished();
|
||||
}
|
||||
};
|
||||
|
||||
public void onResponse(long id, Object result) {
|
||||
mHandler.post(runFinished);
|
||||
}
|
||||
|
||||
public void onError(long id, XMLRPCException error) {
|
||||
mHandler.post(runFinished);
|
||||
}
|
||||
|
||||
public void onServerError(long id, XMLRPCServerException error) {
|
||||
mHandler.post(runFinished);
|
||||
}
|
||||
};
|
||||
|
||||
Boolean hasBuiltInEchoCanceler = LinphoneManager.getLc().hasBuiltInEchoCanceler();
|
||||
Log.i("Add echo canceller calibration result: manufacturer=" + Build.MANUFACTURER + " model=" + Build.MODEL + " status=" + status + " delay=" + delayMs + "ms" + " hasBuiltInEchoCanceler " + hasBuiltInEchoCanceler);
|
||||
client.callAsync(listener, "add_ec_calibration_result", Build.MANUFACTURER, Build.MODEL, status.toString(), delayMs, hasBuiltInEchoCanceler);
|
||||
}
|
||||
catch(Exception ex) {}
|
||||
xmlRpcRequest.addStringArg(Build.MANUFACTURER);
|
||||
xmlRpcRequest.addStringArg(Build.MODEL);
|
||||
xmlRpcRequest.addStringArg(status.toString());
|
||||
xmlRpcRequest.addIntArg(delayMs);
|
||||
xmlRpcRequest.addIntArg(hasBuiltInEchoCanceler ? 1 : 0);
|
||||
xmlRpcSession.sendRequest(xmlRpcRequest);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -339,7 +339,8 @@ public class InAppPurchaseHelper {
|
|||
}
|
||||
|
||||
private Purchasable verifySignature(String payload, String signature) {
|
||||
XmlRpcHelper helper = new XmlRpcHelper();
|
||||
// TODO FIXME rework to be async
|
||||
/*XmlRpcHelper helper = new XmlRpcHelper();
|
||||
if (helper.verifySignature(payload, signature)) {
|
||||
try {
|
||||
JSONObject json = new JSONObject(payload);
|
||||
|
@ -350,7 +351,7 @@ public class InAppPurchaseHelper {
|
|||
} catch (JSONException e) {
|
||||
Log.e(e);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1 +1 @@
|
|||
Subproject commit 856a7ce3dc94e61c4c1d5796b1bdb8dbaaee10b4
|
||||
Subproject commit 9daabd3dbfc72d6799f6bd54474a8f262e6716f2
|
1
submodules/externals/axmlrpc
vendored
1
submodules/externals/axmlrpc
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit c47eaa453fb75d55d32304413672c16706af85e0
|
|
@ -1 +1 @@
|
|||
Subproject commit eb17eca54aba68112788af79d81bd2614c3ef6f6
|
||||
Subproject commit 7bd469baa080f657cfe3fd015f58ae32f57dbafc
|
Loading…
Reference in a new issue