Fixes and improvements on previous migration
This commit is contained in:
parent
857c0ed130
commit
809a29c8fe
9 changed files with 127 additions and 87 deletions
|
@ -147,10 +147,17 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
||||||
|
|
||||||
public void switchCamera() {
|
public void switchCamera() {
|
||||||
try {
|
try {
|
||||||
/*int videoDeviceId = LinphoneManager.getLc().getVideoDevice();
|
String currentDevice = LinphoneManager.getLc().getVideoDevice();
|
||||||
videoDeviceId = (videoDeviceId + 1) % AndroidCameraConfiguration.retrieveCameras().length;
|
String[] devices = LinphoneManager.getLc().getVideoDevicesList();
|
||||||
LinphoneManager.getLc().setVideoDevice(videoDeviceId);*/
|
int index = 0;
|
||||||
Log.e("TODO FIXME switchCamera");
|
for (String d : devices) {
|
||||||
|
if (d == currentDevice) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
String newDevice = devices[(index + 1) % devices.length];
|
||||||
|
LinphoneManager.getLc().setVideoDevice(newDevice);
|
||||||
|
|
||||||
CallManager.getInstance().updateCall();
|
CallManager.getInstance().updateCall();
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ public class ContactsManager extends ContentObserver {
|
||||||
} else {
|
} else {
|
||||||
if (friend.getRefKey() != null) {
|
if (friend.getRefKey() != null) {
|
||||||
// Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it
|
// Friend has a refkey and but no LinphoneContact => represents a native contact stored in db from a previous version of Linphone, remove it
|
||||||
//lc.removeFriend(friend); //TODO FIXME
|
list.removeFriend(friend);
|
||||||
} else {
|
} else {
|
||||||
// No refkey so it's a standalone contact
|
// No refkey so it's a standalone contact
|
||||||
contact = new LinphoneContact();
|
contact = new LinphoneContact();
|
||||||
|
@ -359,7 +359,9 @@ public class ContactsManager extends ContentObserver {
|
||||||
String id = contact.getAndroidId();
|
String id = contact.getAndroidId();
|
||||||
if (id != null && !nativeIds.contains(id)) {
|
if (id != null && !nativeIds.contains(id)) {
|
||||||
// Has been removed since last fetch
|
// Has been removed since last fetch
|
||||||
//lc.removeFriend(contact.getFriend()); //TODO FIXME
|
for (FriendList list : lc.getFriendsLists()) {
|
||||||
|
list.removeFriend(contact.getFriend());
|
||||||
|
}
|
||||||
contacts.remove(contact);
|
contacts.remove(contact);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.linphone.core.Core;
|
||||||
import org.linphone.core.CoreException;
|
import org.linphone.core.CoreException;
|
||||||
import org.linphone.core.Friend;
|
import org.linphone.core.Friend;
|
||||||
import org.linphone.core.Friend.SubscribePolicy;
|
import org.linphone.core.Friend.SubscribePolicy;
|
||||||
|
import org.linphone.core.FriendList;
|
||||||
import org.linphone.core.PresenceBasicStatus;
|
import org.linphone.core.PresenceBasicStatus;
|
||||||
import org.linphone.core.PresenceModel;
|
import org.linphone.core.PresenceModel;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
@ -486,8 +487,11 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteFriend() {
|
public void deleteFriend() {
|
||||||
if (friend != null) {
|
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
//LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend); //TODO FIXME
|
if (friend != null && lc != null) {
|
||||||
|
for (FriendList list : lc.getFriendsLists()) {
|
||||||
|
list.removeFriend(friend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ import org.linphone.core.CallStats;
|
||||||
import org.linphone.core.ChatMessage;
|
import org.linphone.core.ChatMessage;
|
||||||
import org.linphone.core.ChatMessageListener;
|
import org.linphone.core.ChatMessageListener;
|
||||||
import org.linphone.core.ChatRoom;
|
import org.linphone.core.ChatRoom;
|
||||||
|
import org.linphone.core.ChatRoomListener;
|
||||||
import org.linphone.core.Content;
|
import org.linphone.core.Content;
|
||||||
import org.linphone.core.Core;
|
import org.linphone.core.Core;
|
||||||
import org.linphone.core.Core.AuthMethod;
|
import org.linphone.core.Core.AuthMethod;
|
||||||
|
@ -102,6 +103,7 @@ import org.linphone.core.Event;
|
||||||
import org.linphone.core.Friend;
|
import org.linphone.core.Friend;
|
||||||
import org.linphone.core.FriendList;
|
import org.linphone.core.FriendList;
|
||||||
import org.linphone.core.InfoMessage;
|
import org.linphone.core.InfoMessage;
|
||||||
|
import org.linphone.core.Participant;
|
||||||
import org.linphone.core.PresenceActivity;
|
import org.linphone.core.PresenceActivity;
|
||||||
import org.linphone.core.ProxyConfig;
|
import org.linphone.core.ProxyConfig;
|
||||||
import org.linphone.core.VersionUpdateCheckResult;
|
import org.linphone.core.VersionUpdateCheckResult;
|
||||||
|
@ -153,7 +155,7 @@ import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||||
* Add Service Listener to react to Linphone state changes.
|
* Add Service Listener to react to Linphone state changes.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LinphoneManager implements CoreListener, ChatMessageListener, SensorEventListener, AccountCreatorListener {
|
public class LinphoneManager implements CoreListener, ChatMessageListener, SensorEventListener, AccountCreatorListener, ChatRoomListener {
|
||||||
|
|
||||||
private static LinphoneManager instance;
|
private static LinphoneManager instance;
|
||||||
private Context mServiceContext;
|
private Context mServiceContext;
|
||||||
|
@ -598,15 +600,100 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
|
|
||||||
private void resetCameraFromPreferences() {
|
private void resetCameraFromPreferences() {
|
||||||
boolean useFrontCam = mPrefs.useFrontCam();
|
boolean useFrontCam = mPrefs.useFrontCam();
|
||||||
|
int camId = 0;
|
||||||
/*int camId = 0;
|
|
||||||
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
||||||
for (AndroidCamera androidCamera : cameras) {
|
for (AndroidCamera androidCamera : cameras) {
|
||||||
if (androidCamera.frontFacing == useFrontCam)
|
if (androidCamera.frontFacing == useFrontCam)
|
||||||
camId = androidCamera.id;
|
camId = androidCamera.id;
|
||||||
}
|
}
|
||||||
LinphoneManager.getLc().setVideoDevice(camId);*/
|
String[] devices = getLc().getVideoDevicesList();
|
||||||
// TODO FIXME
|
String newDevice = devices[camId];
|
||||||
|
LinphoneManager.getLc().setVideoDevice(newDevice);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUndecryptableMessageReceived(ChatRoom cr, ChatMessage message) {
|
||||||
|
if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Address from = message.getFromAddress();
|
||||||
|
String to = message.getToAddress().asString();
|
||||||
|
try {
|
||||||
|
final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
|
||||||
|
if (LinphoneActivity.instance().isOnBackground()) {
|
||||||
|
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) {
|
||||||
|
if (contact != null) {
|
||||||
|
LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), contact.getFullName()
|
||||||
|
, getString(R.string.message_cant_be_decrypted_notif));
|
||||||
|
} else {
|
||||||
|
LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), from.getUsername()
|
||||||
|
, getString(R.string.message_cant_be_decrypted_notif));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!mAreDisplayAlertMessage){
|
||||||
|
mAreDisplayAlertMessage = true;
|
||||||
|
final Dialog dialog = LinphoneActivity.instance().displayDialog(
|
||||||
|
getString(R.string.message_cant_be_decrypted).replace("%s"
|
||||||
|
, (contact != null) ? contact.getFullName() : from.getUsername()));
|
||||||
|
Button delete = (Button) dialog.findViewById(R.id.delete_button);
|
||||||
|
delete.setText(getString(R.string.call));
|
||||||
|
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||||
|
cancel.setText(getString(R.string.ok));
|
||||||
|
|
||||||
|
delete.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
LinphoneManager.getInstance().newOutgoingCall(from.asStringUriOnly()
|
||||||
|
, (contact != null) ? contact.getFullName() : from.getUsername());
|
||||||
|
dialog.dismiss();
|
||||||
|
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dialog.dismiss();
|
||||||
|
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory)
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onParticipantAdded(ChatRoom cr, Participant participant) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubjectChanged(ChatRoom cr, String subject) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageReceived(ChatRoom cr, ChatMessage msg) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onParticipantAdminStatusChanged(ChatRoom cr, Participant participant, boolean isAdmin) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onParticipantRemoved(ChatRoom cr, Participant participant) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface AddressType {
|
public static interface AddressType {
|
||||||
|
@ -677,7 +764,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTunnelNeeded(NetworkInfo info) {
|
private boolean isTunnelNeeded(NetworkInfo info) {
|
||||||
if (info == null) {
|
/*if (info == null) {
|
||||||
Log.i("No connectivity: tunnel should be disabled");
|
Log.i("No connectivity: tunnel should be disabled");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -692,7 +779,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
&& getString(R.string.tunnel_mode_entry_value_3G_only).equals(pref)) {
|
||||||
Log.i("need tunnel: 'no wifi' connection");
|
Log.i("need tunnel: 'no wifi' connection");
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/ // TODO FIXME
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1255,62 +1342,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
Log.i("Set audio mode on 'Normal'");
|
Log.i("Set audio mode on 'Normal'");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void messageReceivedUnableToDecrypted(Core lc, ChatRoom cr,
|
|
||||||
ChatMessage message) {
|
|
||||||
//TODO FIXME
|
|
||||||
if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Address from = message.getFromAddress();
|
|
||||||
String to = message.getToAddress().asString();
|
|
||||||
try {
|
|
||||||
final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
|
|
||||||
if (LinphoneActivity.instance().isOnBackground()) {
|
|
||||||
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) {
|
|
||||||
if (contact != null) {
|
|
||||||
LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), contact.getFullName()
|
|
||||||
, getString(R.string.message_cant_be_decrypted_notif));
|
|
||||||
} else {
|
|
||||||
LinphoneService.instance().removedNotification(to, from.asStringUriOnly(), from.getUsername()
|
|
||||||
, getString(R.string.message_cant_be_decrypted_notif));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (!mAreDisplayAlertMessage){
|
|
||||||
mAreDisplayAlertMessage = true;
|
|
||||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(
|
|
||||||
getString(R.string.message_cant_be_decrypted).replace("%s"
|
|
||||||
, (contact != null) ? contact.getFullName() : from.getUsername()));
|
|
||||||
Button delete = (Button) dialog.findViewById(R.id.delete_button);
|
|
||||||
delete.setText(getString(R.string.call));
|
|
||||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
|
||||||
cancel.setText(getString(R.string.ok));
|
|
||||||
|
|
||||||
delete.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
LinphoneManager.getInstance().newOutgoingCall(from.asStringUriOnly()
|
|
||||||
, (contact != null) ? contact.getFullName() : from.getUsername());
|
|
||||||
dialog.dismiss();
|
|
||||||
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cancel.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
dialog.dismiss();
|
|
||||||
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(LinphoneManager.getLc().limeEnabled() == Core.LimeState.Mandatory)
|
|
||||||
dialog.show();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAreDisplayAlertMessage(boolean b) {
|
public void setAreDisplayAlertMessage(boolean b) {
|
||||||
mAreDisplayAlertMessage = b;
|
mAreDisplayAlertMessage = b;
|
||||||
}
|
}
|
||||||
|
@ -1881,10 +1912,6 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removed(Core lc, Call call,
|
|
||||||
Address from, byte[] event) {
|
|
||||||
}
|
|
||||||
@Override
|
@Override
|
||||||
public void onTransferStateChanged(Core lc, Call call,
|
public void onTransferStateChanged(Core lc, Call call,
|
||||||
State new_call_state) {
|
State new_call_state) {
|
||||||
|
@ -1893,7 +1920,7 @@ public class LinphoneManager implements CoreListener, ChatMessageListener, Senso
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChatRoomInstantiated(Core lc, ChatRoom cr) {
|
public void onChatRoomInstantiated(Core lc, ChatRoom cr) {
|
||||||
|
cr.setListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1235,7 +1235,9 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultDisplayName(String displayName) {
|
public void setDefaultDisplayName(String displayName) {
|
||||||
//getLc().setPrimaryContact(displayName, getDefaultUsername()); //TODO FIXME
|
Address primary = getLc().getPrimaryContactParsed();
|
||||||
|
primary.setDisplayName(displayName);
|
||||||
|
getLc().setPrimaryContact(primary.asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultDisplayName() {
|
public String getDefaultDisplayName() {
|
||||||
|
@ -1243,7 +1245,9 @@ public class LinphonePreferences {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultUsername(String username) {
|
public void setDefaultUsername(String username) {
|
||||||
//getLc().setPrimaryContact(getDefaultDisplayName(), username); // TODO FIXME
|
Address primary = getLc().getPrimaryContactParsed();
|
||||||
|
primary.setUsername(username);
|
||||||
|
getLc().setPrimaryContact(primary.asString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultUsername() {
|
public String getDefaultUsername() {
|
||||||
|
|
|
@ -200,11 +200,7 @@ public class CodecDownloaderFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (h264 != null) {
|
if (h264 != null) {
|
||||||
try {
|
h264.enable(enable);
|
||||||
LinphoneManager.getLc().enablePayloadType(h264, enable);
|
|
||||||
} catch (CoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class EchoCancellerCalibrationFragment extends Fragment implements XmlRpc
|
||||||
|
|
||||||
mListener = new CoreListenerStub(){
|
mListener = new CoreListenerStub(){
|
||||||
@Override
|
@Override
|
||||||
public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms, Object data) {
|
public void onEcCalibrationResult(Core lc, Core.EcCalibratorStatus status, int delay_ms) {
|
||||||
LinphoneManager.getInstance().routeAudioToReceiver();
|
LinphoneManager.getInstance().routeAudioToReceiver();
|
||||||
if (mSendEcCalibrationResult) {
|
if (mSendEcCalibrationResult) {
|
||||||
sendEcCalibrationResult(status, delay_ms);
|
sendEcCalibrationResult(status, delay_ms);
|
||||||
|
|
|
@ -79,8 +79,8 @@ public class LinphoneOverlay extends org.linphone.mediastream.video.display.GL2J
|
||||||
|
|
||||||
Call call = LinphoneManager.getLc().getCurrentCall();
|
Call call = LinphoneManager.getLc().getCurrentCall();
|
||||||
CallParams callParams = call.getCurrentParams();
|
CallParams callParams = call.getCurrentParams();
|
||||||
params.width = callParams.getReceivedVideoDefinition().width;
|
params.width = callParams.getReceivedVideoDefinition().getWidth();
|
||||||
params.height = callParams.getReceivedVideoDefinition().height;
|
params.height = callParams.getReceivedVideoDefinition().getHeight();
|
||||||
LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl);
|
LinphoneManager.getLc().setNativeVideoWindowId(androidVideoWindowImpl);
|
||||||
|
|
||||||
setOnClickListener(new OnClickListener() {
|
setOnClickListener(new OnClickListener() {
|
||||||
|
|
Loading…
Reference in a new issue