update linphone factory to handle LinphoneAddress parsing error
This commit is contained in:
parent
a2a5cc6ad4
commit
c461dd3f1e
10 changed files with 57 additions and 15 deletions
|
@ -20,7 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
@ -234,7 +236,13 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
view.setTag(contact);
|
view.setTag(contact);
|
||||||
int unreadMessagesCount = LinphoneActivity.instance().getChatStorage().getUnreadMessageCount(contact);
|
int unreadMessagesCount = LinphoneActivity.instance().getChatStorage().getUnreadMessageCount(contact);
|
||||||
|
|
||||||
LinphoneAddress address = LinphoneCoreFactory.instance().createLinphoneAddress(contact);
|
LinphoneAddress address;
|
||||||
|
try {
|
||||||
|
address = LinphoneCoreFactory.instance().createLinphoneAddress(contact);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
Log.e("Chat view cannot parse address",e);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, view.getContext().getContentResolver());
|
LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, view.getContext().getContentResolver());
|
||||||
|
|
||||||
List<ChatMessage> messages = LinphoneActivity.instance().getChatMessages(contact);
|
List<ChatMessage> messages = LinphoneActivity.instance().getChatMessages(contact);
|
||||||
|
|
|
@ -21,7 +21,9 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.ui.AvatarWithShadow;
|
import org.linphone.ui.AvatarWithShadow;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
|
@ -104,7 +106,13 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||||
time.setText(callTime == null ? "" : callTime);
|
time.setText(callTime == null ? "" : callTime);
|
||||||
date.setText(timestampToHumanDate(callDate));
|
date.setText(timestampToHumanDate(callDate));
|
||||||
|
|
||||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
Log.e("History details error",e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, view.getContext().getContentResolver());
|
LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, view.getContext().getContentResolver());
|
||||||
String displayName = lAddress.getDisplayName();
|
String displayName = lAddress.getDisplayName();
|
||||||
if (displayName != null) {
|
if (displayName != null) {
|
||||||
|
|
|
@ -1270,7 +1270,13 @@ public class InCallActivity extends FragmentActivity implements
|
||||||
|
|
||||||
private void displayCall(Resources resources, LinphoneCall call, int index) {
|
private void displayCall(Resources resources, LinphoneCall call, int index) {
|
||||||
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
String sipUri = call.getRemoteAddress().asStringUriOnly();
|
||||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
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");
|
||||||
|
}
|
||||||
|
|
||||||
// Control Row
|
// Control Row
|
||||||
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
|
LinearLayout callView = (LinearLayout) inflater.inflate(R.layout.active_call_control_row, container, false);
|
||||||
|
|
|
@ -430,7 +430,13 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
|
public void displayHistoryDetail(String sipUri, LinphoneCallLog log) {
|
||||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
Log.e("Cannot display history details",e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
|
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
|
||||||
|
|
||||||
String displayName = lAddress.getDisplayName();
|
String displayName = lAddress.getDisplayName();
|
||||||
|
@ -517,7 +523,13 @@ public class LinphoneActivity extends FragmentActivity implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
Log.e("Cannot display chat",e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
|
Uri uri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(lAddress, getContentResolver());
|
||||||
String displayName = lAddress.getDisplayName();
|
String displayName = lAddress.getDisplayName();
|
||||||
String pictureUri = uri == null ? null : uri.toString();
|
String pictureUri = uri == null ? null : uri.toString();
|
||||||
|
|
|
@ -323,7 +323,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
||||||
mMsgNotifCount++;
|
mMsgNotifCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactoryImpl.instance().createLinphoneAddress(fromSipUri), getContentResolver());
|
Uri pictureUri;
|
||||||
|
try {
|
||||||
|
pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(LinphoneCoreFactoryImpl.instance().createLinphoneAddress(fromSipUri), getContentResolver());
|
||||||
|
} catch (LinphoneCoreException e1) {
|
||||||
|
Log.e("Cannot parse from address",e1);
|
||||||
|
pictureUri=null;
|
||||||
|
}
|
||||||
Bitmap bm = null;
|
Bitmap bm = null;
|
||||||
try {
|
try {
|
||||||
bm = MediaStore.Images.Media.getBitmap(getContentResolver(), pictureUri);
|
bm = MediaStore.Images.Media.getBitmap(getContentResolver(), pictureUri);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.linphone.core.LinphoneAddress;
|
||||||
import org.linphone.core.LinphoneCall;
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCall.State;
|
import org.linphone.core.LinphoneCall.State;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
|
import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
|
@ -71,7 +72,12 @@ public final class LinphoneUtils {
|
||||||
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
|
//private static final String strictSipAddressRegExp = "^sip:(\\+)?[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\\.-][a-z0-9]+)*)+\\.[a-z]{2,}$";
|
||||||
|
|
||||||
public static boolean isSipAddress(String numberOrAddress) {
|
public static boolean isSipAddress(String numberOrAddress) {
|
||||||
return LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress) != null;
|
try {
|
||||||
|
LinphoneCoreFactory.instance().createLinphoneAddress(numberOrAddress);
|
||||||
|
return true;
|
||||||
|
} catch (LinphoneCoreException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isStrictSipAddress(String numberOrAddress) {
|
public static boolean isStrictSipAddress(String numberOrAddress) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 249c4d986954243e03a4c3e7044a772aca27090c
|
Subproject commit da87ffc3e63942ee29ac00da674afdc216e19774
|
|
@ -4,11 +4,7 @@
|
||||||
<classpathentry kind="src" path="gen"/>
|
<classpathentry kind="src" path="gen"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||||
<classpathentry kind="lib" path="libs/robotium-solo-3.6.jar">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="javadoc_location" value="jar:platform:/resource/Linphone-Android-NewUI-Tests/libs/robotium-solo-3.6-javadoc.jar!/"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/linphone-android-private"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/linphone-android-private"/>
|
||||||
|
<classpathentry kind="lib" path="libs/robotium-solo-4.1.jar"/>
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -17,7 +17,7 @@ import android.widget.ListView;
|
||||||
import com.jayway.android.robotium.solo.Solo;
|
import com.jayway.android.robotium.solo.Solo;
|
||||||
|
|
||||||
public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
||||||
private static final String sipAdressToCall = "cotcot@sip.linphone.org";
|
private static final String sipAdressToCall = "macmini@sip.linphone.org";
|
||||||
private Solo solo;
|
private Solo solo;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
|
@ -14,7 +14,7 @@ import android.widget.ListView;
|
||||||
import com.jayway.android.robotium.solo.Solo;
|
import com.jayway.android.robotium.solo.Solo;
|
||||||
|
|
||||||
public class SignalingTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
public class SignalingTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
|
||||||
private static final String sipAdressToCall = "cotcot@sip.linphone.org";
|
private static final String sipAdressToCall = "macmini@sip.linphone.org";
|
||||||
private Solo solo;
|
private Solo solo;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
Loading…
Reference in a new issue