Merge remote-tracking branch 'private/belle-sip'

Conflicts:
	Makefile
	submodules/externals/exosip
This commit is contained in:
Sylvain Berfini 2013-07-29 16:07:37 +02:00
commit d320195dd8
110 changed files with 4082 additions and 5802 deletions

View file

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="gen"/>
<classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/> <classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="submodules/linphone/mediastreamer2/java/src"/>
<classpathentry kind="src" path="submodules/linphone/java/j2se"/> <classpathentry kind="src" path="submodules/linphone/java/j2se"/>
<classpathentry kind="src" path="submodules/linphone/java/common"/> <classpathentry kind="src" path="submodules/linphone/java/common"/>
<classpathentry kind="src" path="submodules/linphone/java/impl"/> <classpathentry kind="src" path="submodules/linphone/java/impl"/>
<classpathentry kind="src" path="submodules/externals/axmlrpc/src/main/java"/> <classpathentry kind="src" path="submodules/externals/axmlrpc/src/main/java"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/> <classpathentry kind="src" path="submodules/linphone/coreapi/help/java"/>
<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/android-support-v4.jar"/> <classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry exported="true" kind="lib" path="libs/gcm.jar"/> <classpathentry exported="true" kind="lib" path="libs/gcm.jar"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

4
.gitignore vendored
View file

@ -3,6 +3,10 @@ obj
gen gen
bin bin
doc doc
*.orig
*.rej
.settings
.DS_Store
default.properties default.properties
local.properties local.properties
project.properties project.properties

20
.gitmodules vendored
View file

@ -1,12 +1,6 @@
[submodule "linphone"] [submodule "linphone"]
path = submodules/linphone path = submodules/linphone
url = git://git.linphone.org/linphone.git url = gitosis@git.linphone.org:linphone-private
[submodule "submodules/externals/osip"]
path = submodules/externals/osip
url = git://git.linphone.org/osip.git
[submodule "submodules/externals/exosip"]
path = submodules/externals/exosip
url = git://git.linphone.org/exosip.git
[submodule "submodules/externals/gsm"] [submodule "submodules/externals/gsm"]
path = submodules/externals/gsm path = submodules/externals/gsm
url = git://git.linphone.org/gsm.git url = git://git.linphone.org/gsm.git
@ -58,12 +52,24 @@
[submodule "submodules/externals/webrtc"] [submodule "submodules/externals/webrtc"]
path = submodules/externals/webrtc path = submodules/externals/webrtc
url = git://git.linphone.org/webrtc.git url = git://git.linphone.org/webrtc.git
[submodule "submodules/belle-sip"]
path = submodules/belle-sip
url = gitosis@git.linphone.org:belle-sip
[submodule "submodules/externals/antlr3"]
path = submodules/externals/antlr3
url = git://git.linphone.org/antlr3.git
[submodule "submodules/externals/libxml2"] [submodule "submodules/externals/libxml2"]
path = submodules/externals/libxml2 path = submodules/externals/libxml2
url = git://git.gnome.org/libxml2 url = git://git.gnome.org/libxml2
[submodule "submodules/externals/libupnp"] [submodule "submodules/externals/libupnp"]
path = submodules/externals/libupnp path = submodules/externals/libupnp
url = git://git.code.sf.net/p/pupnp/code url = git://git.code.sf.net/p/pupnp/code
[submodule "submodules/externals/cunit"]
path = submodules/externals/cunit
url = git://git.linphone.org/cunit.git
[submodule "submodules/externals/axmlrpc"] [submodule "submodules/externals/axmlrpc"]
path = submodules/externals/axmlrpc path = submodules/externals/axmlrpc
url = git://git.linphone.org/axmlrpc.git url = git://git.linphone.org/axmlrpc.git
[submodule "submodules/externals/polarssl"]
path = submodules/externals/polarssl
url = git://git.linphone.org/polarssl.git

View file

@ -126,7 +126,8 @@
<receiver android:name="org.linphone.PhoneStateChangedReceiver"> <receiver android:name="org.linphone.PhoneStateChangedReceiver">
<intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter> <intent-filter><action android:name="android.intent.action.PHONE_STATE" /></intent-filter>
</receiver> </receiver>
<receiver android:name="KeepAliveHandler" >
</receiver>
<!-- Needed for push notification --> <!-- Needed for push notification -->
<receiver android:name="org.linphone.gcm.GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <receiver android:name="org.linphone.gcm.GCMReceiver" android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter> <intent-filter>

View file

@ -11,7 +11,7 @@ ANDROID_MOST_RECENT_TARGET=$(shell android list target -c | grep android | tail
NDK_DEBUG=0 NDK_DEBUG=0
BUILD_UPNP=1 BUILD_UPNP=1
BUILD_REMOTE_PROVISIONING=1 BUILD_REMOTE_PROVISIONING=1
BUILD_X264=1 BUILD_X264=0
BUILD_AMRNB=full # 0, light or full BUILD_AMRNB=full # 0, light or full
BUILD_AMRWB=0 BUILD_AMRWB=0
BUILD_GPLV3_ZRTP=0 BUILD_GPLV3_ZRTP=0
@ -21,8 +21,23 @@ BUILD_TUNNEL=0
BUILD_WEBRTC_AECM=1 BUILD_WEBRTC_AECM=1
BUILD_FOR_X86=1 BUILD_FOR_X86=1
USE_JAVAH=1 USE_JAVAH=1
LINPHONE_VIDEO=1
BUILD_TLS=1
# Checks
CHECK_MSG=$(shell ./check_tools.sh)
ifneq ($(CHECK_MSG),)
$(error $(CHECK_MSG))
endif
include check_tools.mk
OPENSSL_DIR=$(shell openssl version -d | sed "s/OPENSSLDIR: \"\(.*\)\"/\1/")
ifneq ($(shell ls $(OPENSSL_DIR)/certs),)
HTTPS_CA_DIR=$(OPENSSL_DIR)/certs
else
HTTPS_CA_DIR=$(OPENSSL_DIR)
endif
NDK_BUILD_OPTIONS=NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) -j$(NUMCPUS)
all: update-project prepare-sources generate-apk all: update-project prepare-sources generate-apk
@ -98,15 +113,49 @@ prepare-mediastreamer2:
if ! [ -e yuv2rgb.vs.h ]; then echo "yuv2rgb.vs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi && \ if ! [ -e yuv2rgb.vs.h ]; then echo "yuv2rgb.vs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi && \
if ! [ -e yuv2rgb.fs.h ]; then echo "yuv2rgb.fs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi if ! [ -e yuv2rgb.fs.h ]; then echo "yuv2rgb.fs.h creation error (do you have 'xxd' application installed ?)"; exit 1; fi
prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-srtp prepare-zrtp prepare-mediastreamer2 ANLTR3_SRC_DIR=$(TOPDIR)/submodules/externals/antlr3/runtime/C/include/
ANTLR3_BUILD_DIR=$(ANTLR3_SRC_DIR)
$(ANLTR3_SRC_DIR)/antlr3config.h: $(TOPDIR)/submodules/externals/build/antlr3/antlr3config.h
cp $(TOPDIR)/submodules/externals/build/antlr3/antlr3config.h $(ANLTR3_SRC_DIR)
prepare-antlr3: $(ANLTR3_SRC_DIR)/antlr3config.h
generate-libs: %.tokens: %.g
$(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) $(ANTLR) -make -fo $(dir $^) $^
BELLESIP_SRC_DIR=$(TOPDIR)/submodules/belle-sip
BELLESIP_BUILD_DIR=$(BELLESIP_SRC_DIR)
prepare-belle-sip: $(BELLESIP_SRC_DIR)/src/belle_sip_message.tokens $(BELLESIP_SRC_DIR)/src/belle_sdp.tokens
prepare-cunit: $(TOPDIR)/submodules/externals/cunit/CUnit/Headers/*.h
[ -d $(TOPDIR)/submodules/externals/build/cunit/CUnit ] || mkdir $(TOPDIR)/submodules/externals/build/cunit/CUnit
cp $^ $(TOPDIR)/submodules/externals/build/cunit/CUnit
$(TOPDIR)/res/raw/rootca.pem:
HTTPS_CA_DIR=$(HTTPS_CA_DIR) $(TOPDIR)/submodules/linphone/scripts/mk-ca-bundle.pl $@
prepare-liblinphone_tester: $(TOPDIR)/submodules/linphone/tester/*_lrc $(TOPDIR)/submodules/linphone/tester/*_rc $(TOPDIR)/submodules/linphone/tester/tester_hosts $(TOPDIR)/submodules/linphone/tester/certificates/* $(TOPDIR)/res/raw/rootca.pem
for file in $^; do \
cp -f $$file $(TOPDIR)/liblinphone_tester/res/raw/. \
;done
prepare-sources: prepare-ffmpeg prepare-ilbc prepare-vpx prepare-silk prepare-srtp prepare-mediastreamer2 prepare-antlr3 prepare-belle-sip $(TOPDIR)/res/raw/rootca.pem
LIBLINPHONE_OPTIONS = NDK_DEBUG=$(NDK_DEBUG) LINPHONE_VERSION=$(LINPHONE_VERSION) BUILD_UPNP=$(BUILD_UPNP) BUILD_REMOTE_PROVISIONING=$(BUILD_REMOTE_PROVISIONING) BUILD_X264=$(BUILD_X264) BUILD_AMRNB=$(BUILD_AMRNB) BUILD_AMRWB=$(BUILD_AMRWB) BUILD_GPLV3_ZRTP=$(BUILD_GPLV3_ZRTP) BUILD_SILK=$(BUILD_SILK) BUILD_G729=$(BUILD_G729) BUILD_TUNNEL=$(BUILD_TUNNEL) BUILD_WEBRTC_AECM=$(BUILD_WEBRTC_AECM) BUILD_FOR_X86=$(BUILD_FOR_X86) USE_JAVAH=$(USE_JAVAH) BUILD_TLS=$(BUILD_TLS)
generate-libs: prepare-sources javah
$(NDK_PATH)/ndk-build $(LIBLINPHONE_OPTIONS) -j$(NUMCPUS)
update-project: update-project:
$(SDK_PATH)/android update project --path . --target $(ANDROID_MOST_RECENT_TARGET) $(SDK_PATH)/android update project --path . --target $(ANDROID_MOST_RECENT_TARGET)
$(SDK_PATH)/android update project --path liblinphone_tester --target $(ANDROID_MOST_RECENT_TARGET)
generate-apk: liblinphone_tester: prepare-sources prepare-cunit prepare-liblinphone_tester javah
$(NDK_PATH)/ndk-build -C liblinphone_tester $(LIBLINPHONE_OPTIONS) -j$(NUMCPUS)
javah:
ant javah
generate-apk: generate-libs
ant partial-clean ant partial-clean
echo "version.name=$(LINPHONE_ANDROID_DEBUG_VERSION)" > default.properties echo "version.name=$(LINPHONE_ANDROID_DEBUG_VERSION)" > default.properties
ant debug ant debug
@ -135,8 +184,11 @@ run-tests:
adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner
clean: clean:
$(NDK_PATH)/ndk-build $(NDK_BUILD_OPTIONS) clean $(NDK_PATH)/ndk-build clean $(LIBLINPHONE_OPTIONS)
ant clean ant clean
.PHONY: clean .PHONY: clean
generate-sdk: generate-apk
ant liblinphone-sdk

6
README
View file

@ -5,11 +5,15 @@ To build liblinphone for Android, you must:
0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path. 0) download the Android sdk with platform-tools and tools updated to latest revision (at least API 16 is needed), then add both 'tools' and 'platform-tools' folders in your path.
1) download the Android ndk (>=r8b) from google and add it to your path. 1) download the Android ndk (>=r8b) from google and add it to your path.
2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig 2) install the autotools: autoconf, automake, aclocal, libtoolize, pkgconfig
2bis) on some 64 bits systems you'll need the ia32-libs package On 64 bits linux systems you'll need the ia32-libs package
3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project. 3) run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.
$ make $ make
4) To install the generated apk into a plugged device, run 4) To install the generated apk into a plugged device, run
$ make install $ make install
5) (Optional) To generate a liblinphone SDK zip containing a full jar and native libraries, run
$ make generate-sdk
To run the tutorials: To run the tutorials:
1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true. 1) open the res/values/non_localizable_custom.xml file and change the value of the show_tutorials_instead_of_app to true.

View file

@ -90,4 +90,21 @@
<!-- version-tag: custom --> <!-- version-tag: custom -->
<import file="${sdk.dir}/tools/ant/build.xml" /> <import file="${sdk.dir}/tools/ant/build.xml" />
<target name="liblinphone-sdk">
<echo level="info">Creating library output jar file...</echo>
<property name="out.library.jar.file" location="${out.absolute.dir}/liblinphone.jar" />
<jar destfile="${out.library.jar.file}">
<fileset dir="${out.classes.absolute.dir}"
includes="org/linphone/mediastream/**/*.class org/linphone/core/**/*.class"/>
<fileset dir="submodules/linphone/java" >
<include name="common/org/linphone/core/*.java"/>
<include name="j2se/org/linphone/core/*.java"/>
</fileset>
</jar>
<zip destfile="liblinphone-sdk-${version.name}.zip">
<zipfileset dir="libs" prefix="libs" includes="**/*.so" />
<zipfileset dir="${out.absolute.dir}" includes="liblinphone.jar" prefix="libs"/>
</zip>
</target>
</project> </project>

37
check_tools.sh Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
rm -f check_tools.mk
touch check_tools.mk
# Check java
JAVA=\"$(which java)\"
if [ -z ${JAVA} ]; then
echo "Could not find java. Please install java";
exit -1;
fi
# Check antlr
ANTLR="${JAVA} -jar \"submodules/externals/antlr3/antlr-3.4-complete.jar\"";
# Check NDK
NDK=$(which ndk-build)
if [ -z ${NDK} ]; then
echo "Could not find ndk-build. Please install android ndk";
exit -1;
fi
# Check SDK
SDK=$(which android)
if [ -z ${SDK} ]; then
echo "Could not find android. Please install android sdk";
exit -1;
fi
SDK_PLATFORM_TOOLS=$(which adb)
if [ -z ${SDK_PLATFORM_TOOLS} ]; then
echo "Could not find adb. Please install android sdk platform tools";
exit -1;
fi
echo JAVA=${JAVA} >> check_tools.mk
echo ANTLR=${ANTLR} >> check_tools.mk

View file

@ -17,7 +17,7 @@
failonerror="false" /> failonerror="false" />
</target> </target>
<target name="javah"> <target name="javah" depends="-set-debug-mode,-compile">
<echo level="info">Generate JNI header</echo> <echo level="info">Generate JNI header</echo>
<javah outputfile="gen/linphonecore_jni.h"> <javah outputfile="gen/linphonecore_jni.h">
<classpath> <classpath>
@ -37,6 +37,11 @@
<class name="org.linphone.core.LinphoneProxyConfigImpl" /> <class name="org.linphone.core.LinphoneProxyConfigImpl" />
<class name="org.linphone.core.PayloadTypeImpl" /> <class name="org.linphone.core.PayloadTypeImpl" />
<class name="org.linphone.core.LpConfigImpl" /> <class name="org.linphone.core.LpConfigImpl" />
<class name="org.linphone.core.LinphoneInfoMessageImpl" />
<class name="org.linphone.core.LinphoneEventImpl" />
<class name="org.linphone.core.PresenceModelImpl" />
<class name="org.linphone.core.PresenceActivityImpl" />
<class name="org.linphone.core.PresenceNoteImpl" />
</javah> </javah>
<javah outputfile="gen/xml2lpc_jni.h"> <javah outputfile="gen/xml2lpc_jni.h">
<classpath> <classpath>
@ -56,15 +61,6 @@
<delete file="bin/${ant.project.name}.ap_" /> <delete file="bin/${ant.project.name}.ap_" />
</target> </target>
<target name="build-libs">
<exec executable="make" failonerror="true">
<arg value="generate-libs" />
</exec>
</target>
<target name="-post-compile" depends="javah, build-libs">
</target>
<target name="javadoc"> <target name="javadoc">
<echo level="info">Generate Javadoc</echo> <echo level="info">Generate Javadoc</echo>
<javadoc <javadoc
@ -121,4 +117,23 @@
<arg value="${linphone.package.name}/org.linphone.LinphoneLauncherActivity" /> <arg value="${linphone.package.name}/org.linphone.LinphoneLauncherActivity" />
</exec> </exec>
</target> </target>
<target name="liblinphone-sdk">
<echo level="info">Creating library output jar file...</echo>
<property name="out.library.jar.file" location="${out.absolute.dir}/liblinphone.jar" />
<jar destfile="${out.library.jar.file}">
<fileset dir="${out.classes.absolute.dir}"
includes="org/linphone/mediastream/**/*.class org/linphone/core/**/*.class"/>
<fileset dir="submodules/linphone/java" >
<include name="common/org/linphone/core/*.java"/>
<include name="j2se/org/linphone/core/*.java"/>
</fileset>
</jar>
<zip destfile="liblinphone-sdk-${version.name}.zip">
<zipfileset dir="libs" prefix="libs" includes="**/*.so" />
<zipfileset dir="${out.absolute.dir}" includes="liblinphone.jar" prefix="libs"/>
</zip>
</target>
</project> </project>

View file

@ -41,12 +41,8 @@ ifeq ($(BUILD_UPNP),1)
include $(linphone-root-dir)/submodules/externals/build/libupnp/Android.mk include $(linphone-root-dir)/submodules/externals/build/libupnp/Android.mk
endif endif
#libxml2 + xml2lpc + lpc2xml #libxml2
ifeq ($(BUILD_REMOTE_PROVISIONING),1)
include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk include $(linphone-root-dir)/submodules/externals/build/libxml2/Android.mk
include $(linphone-root-dir)/submodules/linphone/build/android/xml2lpc.mk
include $(linphone-root-dir)/submodules/linphone/build/android/lpc2xml.mk
endif
# Speex # Speex
include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
@ -54,12 +50,11 @@ include $(linphone-root-dir)/submodules/externals/build/speex/Android.mk
# Gsm # Gsm
include $(linphone-root-dir)/submodules/externals/build/gsm/Android.mk include $(linphone-root-dir)/submodules/externals/build/gsm/Android.mk
include $(linphone-root-dir)/submodules/externals/build/exosip/Android.mk include $(linphone-root-dir)/submodules/externals/build/polarssl/Android.mk
include $(linphone-root-dir)/submodules/externals/build/antlr3/Android.mk
include $(linphone-root-dir)/submodules/belle-sip/build/android/Android.mk
include $(linphone-root-dir)/submodules/externals/build/osip/Android.mk
# Openssl
include $(linphone-root-dir)/submodules/externals/openssl/Android.mk
include $(linphone-root-dir)/submodules/linphone/oRTP/build/android/Android.mk include $(linphone-root-dir)/submodules/linphone/oRTP/build/android/Android.mk
@ -68,6 +63,14 @@ include $(linphone-root-dir)/submodules/linphone/mediastreamer2/tools/Android.mk
ifeq ($(BUILD_TUNNEL), 1) ifeq ($(BUILD_TUNNEL), 1)
# Openssl
ifeq ($(wildcard $(linphone-root-dir)/submodules/externals/prebuilts/ssl.mk),)
include $(linphone-root-dir)/submodules/externals/openssl/Android.mk
else
include $(linphone-root-dir)/submodules/externals/prebuilts/ssl.mk
include $(linphone-root-dir)/submodules/externals/prebuilts/crypto.mk
endif
#tunnel
include $(linphone-root-dir)/submodules/tunnel/Android.mk include $(linphone-root-dir)/submodules/tunnel/Android.mk
endif endif

View file

@ -1,5 +1,5 @@
APP_PROJECT_PATH := $(call my-dir)/../ APP_PROJECT_PATH := $(call my-dir)/../
APP_MODULES :=libspeex libgsm libortp libosip2 libeXosip2 libmediastreamer2 liblinphone liblinphonenoneon libneon APP_MODULES :=libspeex libgsm libortp antlr3 libbellesip libmediastreamer2 liblinphone liblinphonenoneon libneon liblpxml2
APP_STL := stlport_static APP_STL := stlport_static
#uPnp #uPnp
@ -7,9 +7,8 @@ ifeq ($(BUILD_UPNP),1)
APP_MODULES += libupnp APP_MODULES += libupnp
endif endif
#remote provisioning ifeq ($(BUILD_TLS),1)
ifeq ($(BUILD_REMOTE_PROVISIONING),1) APP_MODULES +=polarssl
APP_MODULES += liblpxml2 libxml2lpc liblpc2xml
endif endif
#default values #default values
@ -72,7 +71,10 @@ APP_MODULES += libtunnelclient
endif endif
ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
ifeq ($(BUILD_TUNNEL), 1)
APP_MODULES += liblincrypto liblinssl APP_MODULES += liblincrypto liblinssl
endif
APP_MODULES +=libmsilbc APP_MODULES +=libmsilbc
ifeq ($(BUILD_GPLV3_ZRTP), 1) ifeq ($(BUILD_GPLV3_ZRTP), 1)
@ -93,4 +95,3 @@ APP_ABI := armeabi-v7a armeabi
ifeq ($(BUILD_FOR_X86), 1) ifeq ($(BUILD_FOR_X86), 1)
APP_ABI += x86 APP_ABI += x86
endif endif
APP_CFLAGS:=-DDISABLE_NEON

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry excluding="org/linphone/mediastream/MediastreamerActivity.java" kind="src" path="mediastreamer2"/>
<classpathentry kind="lib" path="libs/android-support-v4.jar"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>

18
liblinphone_tester/.gitignore vendored Normal file
View file

@ -0,0 +1,18 @@
# built application files
*.apk
*.ap_
# files for the dex VM
*.dex
# Java class files
*.class
# generated files
bin/
gen/
libs/
obj/
# Local configuration file (sdk path, etc)
local.properties

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>liblinphoneTester</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>mediastreamer2</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOCATION/submodules/linphone/mediastreamer2/java/src</locationURI>
</link>
</linkedResources>
</projectDescription>

View file

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone.tester"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<instrumentation
android:targetPackage="org.linphone.tester"
android:name="org.linphone.tester.TestRunner" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.linphone.tester.MainActivity"
android:label="@string/app_name"
android:screenOrientation="nosensor"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.linphone.tester.LogsActivity"
android:label="@string/title_activity_logs"
android:screenOrientation="nosensor"
android:launchMode="singleTask">
</activity>
<activity
android:name="org.linphone.tester.SuitesActivity"
android:label="@string/title_activity_suites"
android:screenOrientation="nosensor"
android:launchMode="singleTask">
</activity>
<uses-library android:name="android.test.runner" />
</application>
</manifest>

View file

@ -0,0 +1 @@
source.dir=src:../submodules/linphone/mediastreamer2/java/src:../submodules/linphone/java/j2se:../submodules/linphone/java/common:../submodules/linphone/java/impl

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="liblinphone_tester" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<property file="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
unless="sdk.dir"
/>
<!--
Import per project custom build rules if present at the root of the project.
This is the place to put custom intermediary targets such as:
-pre-build
-pre-compile
-post-compile (This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir})
-post-package
-post-build
-pre-clean
-->
<import file="custom_rules.xml" optional="true" />
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="custom_rules">
<target name="run">
<exec executable="adb">
<arg value="shell" />
<arg value="am" />
<arg value="start" />
<arg value="-a" />
<arg value="android.intent.action.MAIN" />
<arg value="-n" />
<arg value="org.linphone.tester/org.linphone.tester.MainActivity" />
</exec>
</target>
<target name="test">
<exec executable="adb" failonerror="true" outputproperty="tests.output">
<arg value="shell" />
<arg value="am" />
<arg value="instrument" />
<arg value="-r" />
<arg value="-w" />
<arg value="org.linphone.tester/org.linphone.tester.TestRunner" />
</exec>
<echo message="${tests.output}"/>
<fail message="Tests failed">
<condition>
<contains string="${tests.output}" substring="FAILURES" />
</condition>
</fail>
<fail message="Tests crashed">
<condition>
<contains string="${tests.output}" substring="Process crashed" />
</condition>
</fail>
</target>
</project>

View file

@ -0,0 +1,3 @@
include ../jni/Android.mk
include $(linphone-root-dir)/submodules/externals/build/cunit/Android.mk
include $(linphone-root-dir)/submodules/linphone/build/android/liblinphone_tester.mk

View file

@ -0,0 +1,7 @@
LOCAL_PATH:= $(call my-dir)
include ../jni/Application.mk
APP_PROJECT_PATH := $(LOCAL_PATH)/../
APP_BUILD_SCRIPT := $(LOCAL_PATH)/Android.mk
APP_OPTIM := debug
APP_MODULES += cunit liblinphone_tester liblinphone_testernoneon

View file

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View file

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,12 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
tools:context=".LogsActivity">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
</ScrollView>

View file

@ -0,0 +1,15 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SuitesActivity" >
<LinearLayout
android:id="@+id/suites_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>

View file

@ -0,0 +1,15 @@
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SuitesActivity" >
<LinearLayout
android:id="@+id/tests_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>

View file

@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/menu_settings"/>
</menu>

View file

@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/menu_settings"/>
</menu>

View file

@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/menu_settings"/>
</menu>

12
liblinphone_tester/res/raw/.gitignore vendored Normal file
View file

@ -0,0 +1,12 @@
agent.pem
cacert.pem
empty_rc
laure_rc
marie_early_rc
marie_no_sdp_rc
marie_rc
multi_account_lrc
pauline_rc
rootca.pem
tester_hosts
upnp_rc

View file

@ -0,0 +1,11 @@
<resources>
<!--
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>
</resources>

View file

@ -0,0 +1,12 @@
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">liblinphone tester</string>
<string name="all">All</string>
<string name="menu_settings">Settings</string>
<string name="title_activity_logs">LogsActivity</string>
<string name="title_activity_suites">SuitesActivity</string>
</resources>

View file

@ -0,0 +1,20 @@
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>

View file

@ -0,0 +1,91 @@
package org.linphone.tester;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.TextView;
public class LogsActivity extends Activity {
private String mLogs = "";
private LogsThread mLogsThread;
private class LogsThread extends Thread {
LogsActivity mLogsActivity;
String mArgs[];
TesterLogger tester;
public LogsThread(LogsActivity logsActivity, String[] args) {
mLogsActivity = logsActivity;
mArgs = args;
}
@Override
public void run() {
String path = mLogsActivity.getFilesDir().getAbsolutePath();
tester = new TesterLogger(mLogsActivity);
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path}));
list.addAll(Arrays.asList(mArgs));
String[] array = list.toArray(new String[list.size()]);
tester.run(array);
mLogsActivity.runOnUiThread(new Runnable() {
public void run() {
mLogsActivity.done();
}
});
}
}
private static String join(String [] array, String separator) {
String ret = "";
for(int i = 0; i < array.length; ++i) {
if(i != 0) {
ret += separator;
}
ret += array[i];
}
return ret;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_logs);
((TextView)findViewById(R.id.textView1)).setText(mLogs);
Bundle extras = getIntent().getExtras();
if (extras != null) {
String[] values = extras.getStringArray("args");
if(values != null) {
if(mLogsThread == null || !mLogsThread.isAlive()) {
this.setTitle("Test Logs (" + join(values, " ") + ")");
mLogs = "";
((TextView)findViewById(R.id.textView1)).setText(mLogs);
mLogsThread = new LogsThread(this, values);
mLogsThread.start();
}
}
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_logs, menu);
return true;
}
public void addLog(int level, String message) {
mLogs += message;
((TextView)findViewById(R.id.textView1)).append(message);
}
@Override
public void onBackPressed() {
if(mLogsThread == null || !mLogsThread.isAlive()) {
finish();
}
}
public void done() {
}
}

View file

@ -0,0 +1,89 @@
package org.linphone.tester;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
public class MainActivity extends Activity {
private void copyFromPackage(int ressourceId,String target) throws IOException{
FileOutputStream lOutputStream = openFileOutput (target, 0);
InputStream lInputStream = getResources().openRawResource(ressourceId);
int readByte;
byte[] buff = new byte[8048];
while (( readByte = lInputStream.read(buff)) != -1) {
lOutputStream.write(buff,0, readByte);
}
lOutputStream.flush();
lOutputStream.close();
lInputStream.close();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
copyFromPackage(R.raw.laure_rc, new File("laure_rc").getName());
copyFromPackage(R.raw.marie_rc, new File("marie_rc").getName());
copyFromPackage(R.raw.marie_early_rc, new File("marie_early_rc").getName());
copyFromPackage(R.raw.multi_account_lrc, new File("multi_account_lrc").getName());
copyFromPackage(R.raw.pauline_rc, new File("pauline_rc").getName());
copyFromPackage(R.raw.rootca, new File("rootca.pem").getName());
copyFromPackage(R.raw.cacert, new File("cacert.pem").getName());
copyFromPackage(R.raw.tester_hosts, new File("tester_hosts").getName());
} catch (IOException e) {
e.printStackTrace();
}
setContentView(R.layout.activity_main);
TesterList suitesTest = new TesterList();
suitesTest.run(new String[]{"tester", "--list-suites"});
LinearLayout layout = ((LinearLayout)findViewById(R.id.suites_list));
layout.removeAllViews();
addButton(layout, "All", null);
for(String str: suitesTest.getList()) {
str = str.trim();
addButton(layout, str, str);
}
}
private void addButton(LinearLayout layout, String text, String data) {
Button button = new Button(this);
button.setText(text);
button.setTag(data);
button.setGravity(Gravity.CENTER);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Button button = (Button) v;
String data = (String)button.getTag();
if(data == null) {
Intent intent = new Intent(getBaseContext(), LogsActivity.class);
intent.putExtra("args", new String[]{});
startActivity(intent);
} else {
Intent intent = new Intent(getBaseContext(), SuitesActivity.class);
intent.putExtra("suite", data);
startActivity(intent);
}
}
});
layout.addView(button);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}

View file

@ -0,0 +1,70 @@
package org.linphone.tester;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
public class SuitesActivity extends Activity {
String mSuite;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_suites);
Bundle extras = getIntent().getExtras();
if (extras != null) {
mSuite = extras.getString("suite");
if(mSuite != null) {
this.setTitle(this.getResources().getString(R.string.app_name) + " | " + mSuite);
TesterList suitesTest = new TesterList();
suitesTest.run(new String[]{"tester", "--list-tests", mSuite});
LinearLayout layout = ((LinearLayout)findViewById(R.id.tests_list));
layout.removeAllViews();
addButton(layout, "All", null);
for(String str: suitesTest.getList()) {
str = str.trim();
addButton(layout, str, str);
}
}
}
}
private void addButton(LinearLayout layout, String text, String data) {
Button button = new Button(this);
button.setText(text);
button.setTag(data);
button.setGravity(Gravity.CENTER);
button.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Button button = (Button) v;
String data = (String)button.getTag();
if(mSuite != null) {
if(data == null) {
Intent intent = new Intent(getBaseContext(), LogsActivity.class);
intent.putExtra("args", new String[]{"--suite", mSuite});
startActivity(intent);
} else {
Intent intent = new Intent(getBaseContext(), LogsActivity.class);
intent.putExtra("args", new String[]{"--suite", mSuite, "--test", data});
startActivity(intent);
}
}
}
});
layout.addView(button);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_suites, menu);
return true;
}
}

View file

@ -0,0 +1,47 @@
package org.linphone.tester;
import junit.framework.TestSuite;
import android.os.Bundle;
import android.test.InstrumentationTestRunner;
public class TestRunner extends InstrumentationTestRunner {
String mSuite = null;
String mTest = null;
@Override
public void onCreate(Bundle arguments) {
mSuite = arguments.getString("suite");
mTest = arguments.getString("test");
super.onCreate(arguments);
}
@Override
public TestSuite getAllTests () {
TestSuite suite = new TestSuite("Tests");
addSuites(suite, mSuite, mTest);
return suite;
}
public static void addSuites(TestSuite suite, String suiteCheck, String testCheck) {
TesterList testerList = new TesterList();
testerList.run(new String[]{"tester", "--list-suites"});
for(String str: testerList.getList()) {
str = str.trim();
if(suiteCheck == null || suiteCheck.equals(str)) {
addSuite(suite, str, testCheck);
}
}
}
public static void addSuite(TestSuite suite, String suiteStr, String testCheck) {
TesterList testerList = new TesterList();
testerList.run(new String[]{"tester", "--list-tests", suiteStr});
for(String str: testerList.getList()) {
str = str.trim();
if(testCheck == null || testCheck.equals(str)) {
suite.addTest(new TestUnit(suiteStr, str));
}
}
}
}

View file

@ -0,0 +1,38 @@
package org.linphone.tester;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import junit.framework.Assert;
import android.test.AndroidTestCase;
public class TestUnit extends AndroidTestCase {
private String mSuite;
private String mTest;
public TestUnit(String suite, String test) {
mSuite = suite;
mTest = test;
setName(suite + "/" + test);
}
@Override
protected void setUp() throws Exception {
super.setUp();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
@Override
protected void runTest() {
String path = getContext().getFilesDir().getAbsolutePath();
Tester tester = new Tester();
List<String> list = new LinkedList<String>(Arrays.asList(new String[]{"tester", "--verbose", "--config", path, "--suite", mSuite, "--test", mTest}));
String[] array = list.toArray(new String[list.size()]);
Assert.assertTrue(tester.run(array) == 0);
}
}

View file

@ -0,0 +1,69 @@
package org.linphone.tester;
import org.linphone.core.LinphoneCoreFactory;
import org.linphone.mediastream.Version;
import org.linphone.mediastream.CpuUtils;
import android.util.Log;
public class Tester {
public static String TAG = "liblinphone-tester";
private static boolean loadOptionalLibrary(String s) {
try {
System.loadLibrary(s);
return true;
} catch (Throwable e) {
Log.w("Unable to load optional library lib", s);
}
return false;
}
public static boolean hasNeonInCpuFeatures()
{
CpuUtils cpu = new CpuUtils();
return cpu.isCpuNeon();
}
public static boolean isArmv7()
{
return System.getProperty("os.arch").contains("armv7");
}
static {
LinphoneCoreFactory.instance();
System.loadLibrary("cunit");
//Main library
if (!hasNeonInCpuFeatures()) {
try {
if (!isArmv7() && !Version.isX86()) {
System.loadLibrary("linphone_testerarmv5");
} else {
System.loadLibrary("linphone_testernoneon");
}
} catch (UnsatisfiedLinkError ule) {
Log.w("linphone", "Failed to load no-neon liblinphone_tester, loading neon liblinphone_tester");
System.loadLibrary("linphone_tester");
}
} else {
System.loadLibrary("linphone_tester");
}
Version.dumpCapabilities();
}
public native int run(String args[]);
public void printLog(final int level, final String message) {
switch(level) {
case 0:
android.util.Log.i(TAG, message);
break;
case 1:
android.util.Log.e(TAG, message);
break;
}
}
}

View file

@ -0,0 +1,16 @@
package org.linphone.tester;
import java.util.LinkedList;
import java.util.List;
public class TesterList extends Tester {
private List<String> list = new LinkedList<String>();
public void printLog(final int level, final String message) {
super.printLog(level, message);
list.add(message);
}
public List<String> getList() {
return list;
}
}

View file

@ -0,0 +1,16 @@
package org.linphone.tester;
public class TesterLogger extends Tester {
private LogsActivity mLogsActivity;
TesterLogger(LogsActivity logsActivity) {
mLogsActivity = logsActivity;
}
public void printLog(final int level, final String message) {
super.printLog(level, message);
mLogsActivity.runOnUiThread(new Runnable() {
public void run() {
mLogsActivity.addLog(level, message);
}
});
}
}

View file

@ -34,7 +34,7 @@
android:src="@drawable/call_answer" /> android:src="@drawable/call_answer" />
<ImageView <ImageView
android:id="@+id/chat" android:id="@+id/start_chat"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="0.2" android:layout_weight="0.2"

View file

@ -1,7 +1,6 @@
[net] [net]
download_bw=380 download_bw=380
upload_bw=380 upload_bw=380
firewall_policy=0
mtu=1300 mtu=1300
[sip] [sip]
@ -26,6 +25,7 @@ video_rtp_port=9078
audio_jitt_comp=60 audio_jitt_comp=60
video_jitt_comp=60 video_jitt_comp=60
nortp_timeout=30 nortp_timeout=30
disable_upnp=1
[sound] [sound]
playback_dev_id= playback_dev_id=

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,7 @@
<!-- The following settings are only usefull if use_android_native_contact_edit_interface = false --> <!-- The following settings are only usefull if use_android_native_contact_edit_interface = false -->
<bool name="hide_phone_numbers_in_editor">false</bool> <bool name="hide_phone_numbers_in_editor">false</bool>
<bool name="hide_sip_addresses_in_editor">false</bool> <bool name="hide_sip_addresses_in_editor">false</bool>
<bool name="forbid_empty_new_contact_in_editor">false</bool> <bool name="forbid_empty_new_contact_in_editor">true</bool>
<bool name="disable_animations">false</bool> <bool name="disable_animations">false</bool>
<bool name="show_statusbar_only_on_dialer">true</bool> <bool name="show_statusbar_only_on_dialer">true</bool>

View file

@ -37,6 +37,7 @@
<bool name="pref_wifi_only_default">false</bool> <bool name="pref_wifi_only_default">false</bool>
<string name="default_stun">stun.linphone.org</string> <string name="default_stun">stun.linphone.org</string>
<bool name="pref_ice_enabled_default">false</bool> <bool name="pref_ice_enabled_default">false</bool>
<bool name="pref_upnp_enabled_default">false</bool>
<bool name="pref_transport_use_random_ports_default">true</bool> <bool name="pref_transport_use_random_ports_default">true</bool>
<string name="pref_sip_port_default">5060</string> <string name="pref_sip_port_default">5060</string>
<string name="pref_transport_default">@string/pref_transport_udp_key</string> <string name="pref_transport_default">@string/pref_transport_udp_key</string>

View file

@ -49,6 +49,7 @@
<string name="pref_domain_key">pref_domain_key</string> <string name="pref_domain_key">pref_domain_key</string>
<string name="pref_passwd_key">pref_passwd_key</string> <string name="pref_passwd_key">pref_passwd_key</string>
<string name="pref_username_key">pref_username_key</string> <string name="pref_username_key">pref_username_key</string>
<string name="pref_auth_userid_key">pref_auth_userid_key</string>
<string name="pref_wizard_key">pref_wizard_key</string> <string name="pref_wizard_key">pref_wizard_key</string>
<string name="pref_activated_key">pref_activated_key</string> <string name="pref_activated_key">pref_activated_key</string>
<string name="pref_debug_key">pref_debug_key</string> <string name="pref_debug_key">pref_debug_key</string>
@ -112,4 +113,5 @@
<string name="pref_rfc2833_dtmf_key">pref_rfc2833_dtmf_key</string> <string name="pref_rfc2833_dtmf_key">pref_rfc2833_dtmf_key</string>
<string name="pref_sipinfo_dtmf_key">pref_sipinfo_dtmf_key</string> <string name="pref_sipinfo_dtmf_key">pref_sipinfo_dtmf_key</string>
<string name="pref_upnp_enable_key">pref_upnp_enable_key</string>
</resources> </resources>

View file

@ -418,5 +418,11 @@
<string name="pref_background_mode">Background mode</string> <string name="pref_background_mode">Background mode</string>
<string name="download_image">Download</string> <string name="download_image">Download</string>
<string name="download_image_failed">Download failed. Check your internet connection or try again later.</string> <string name="download_image_failed">Download failed. Please check your internet access or try again later.</string>
<string name="pref_auth_userid">Auth userid*</string>
<string name="pref_help_auth_userid">Enter authentication userid (optionnal)</string>
<string name="pref_upnp_enable">Enable UPNP</string>
</resources> </resources>

View file

@ -7,6 +7,9 @@
<EditTextPreference <EditTextPreference
android:title="@string/pref_username" android:title="@string/pref_username"
android:dialogMessage="@string/pref_help_username" android:dialogMessage="@string/pref_help_username"
android:persistent="true"/><EditTextPreference
android:title="@string/pref_auth_userid"
android:dialogMessage="@string/pref_help_auth_userid"
android:persistent="true"/> android:persistent="true"/>
<EditTextPreference <EditTextPreference

View file

@ -233,6 +233,11 @@
android:key="@string/pref_ice_enable_key" android:key="@string/pref_ice_enable_key"
android:defaultValue="@bool/pref_ice_enabled_default"/> android:defaultValue="@bool/pref_ice_enabled_default"/>
<CheckBoxPreference
android:title="@string/pref_upnp_enable"
android:key="@string/pref_upnp_enable_key"
android:defaultValue="@bool/pref_upnp_enabled_default"/>
<CheckBoxPreference <CheckBoxPreference
android:key="@string/pref_transport_use_random_ports_key" android:key="@string/pref_transport_use_random_ports_key"
android:title="@string/pref_transport_use_random_ports" android:title="@string/pref_transport_use_random_ports"

View file

@ -71,12 +71,19 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
username.setOnPreferenceChangeListener(preferenceChangedListener); username.setOnPreferenceChangeListener(preferenceChangedListener);
username.setSummary(username.getText()); username.setSummary(username.getText());
EditTextPreference password = (EditTextPreference) account.getPreference(1); EditTextPreference userid = (EditTextPreference) account.getPreference(1);
userid.setText(prefs.getString(getString(R.string.pref_auth_userid_key) + key, ""));
userid.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
userid.setKey(getString(R.string.pref_auth_userid_key) + key);
userid.setOnPreferenceChangeListener(preferenceChangedListener);
userid.setSummary(userid.getText());
EditTextPreference password = (EditTextPreference) account.getPreference(2);
password.setText(prefs.getString(getString(R.string.pref_passwd_key) + key, "")); password.setText(prefs.getString(getString(R.string.pref_passwd_key) + key, ""));
password.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); password.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
password.setKey(getString(R.string.pref_passwd_key) + key); password.setKey(getString(R.string.pref_passwd_key) + key);
EditTextPreference domain = (EditTextPreference) account.getPreference(2); EditTextPreference domain = (EditTextPreference) account.getPreference(3);
domain.setText(prefs.getString(getString(R.string.pref_domain_key) + key, "")); domain.setText(prefs.getString(getString(R.string.pref_domain_key) + key, ""));
domain.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); domain.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
domain.setKey(getString(R.string.pref_domain_key) + key); domain.setKey(getString(R.string.pref_domain_key) + key);
@ -109,6 +116,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
for (int i = n; i < nbAccounts - 1; i++) { for (int i = n; i < nbAccounts - 1; i++) {
editor.putString(getString(R.string.pref_username_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_username_key) + getAccountNumber(i+1), null)); editor.putString(getString(R.string.pref_username_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_username_key) + getAccountNumber(i+1), null));
editor.putString(getString(R.string.pref_auth_userid_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_auth_userid_key) + getAccountNumber(i+1), null));
editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_passwd_key) + getAccountNumber(i+1), null)); editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_passwd_key) + getAccountNumber(i+1), null));
editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_domain_key) + getAccountNumber(i+1), null)); editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_domain_key) + getAccountNumber(i+1), null));
editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_proxy_key) + getAccountNumber(i+1), null)); editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_proxy_key) + getAccountNumber(i+1), null));

View file

@ -27,7 +27,6 @@ public class BandwidthManager {
public static final int LOW_RESOLUTION = 1; public static final int LOW_RESOLUTION = 1;
public static final int LOW_BANDWIDTH = 2; public static final int LOW_BANDWIDTH = 2;
private static final int[][] bandwidthes = {{256,256}, {128,128}, {80,80}};
private static BandwidthManager instance; private static BandwidthManager instance;
private int currentProfile = HIGH_RESOLUTION; private int currentProfile = HIGH_RESOLUTION;
@ -46,34 +45,6 @@ public class BandwidthManager {
// FIXME initially get those values // FIXME initially get those values
} }
private boolean userRestriction;
public boolean isUserRestriction() {return userRestriction;}
public void setUserRestriction(boolean limit) {
userRestriction = limit;
computeNewProfile();
}
private void computeNewProfile() {
int newProfile = userRestriction ? LOW_RESOLUTION : HIGH_RESOLUTION;
if (newProfile != currentProfile) {
currentProfile = newProfile;
onProfileChanged(currentProfile);
}
}
private void onProfileChanged(int newProfile) {
LinphoneCore lc = LinphoneManager.getLc();
lc.setUploadBandwidth(bandwidthes[newProfile][0]);
lc.setDownloadBandwidth(bandwidthes[newProfile][1]);
if (lc.isIncall()) {
CallManager.getInstance().reinvite();
} else {
updateWithProfileSettings(lc, null);
}
}
public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) { public void updateWithProfileSettings(LinphoneCore lc, LinphoneCallParams callParams) {
if (callParams != null) { // in call if (callParams != null) { // in call

View file

@ -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);

View file

@ -115,7 +115,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
v.findViewById(R.id.dial).setVisibility(View.GONE); v.findViewById(R.id.dial).setVisibility(View.GONE);
} }
v.findViewById(R.id.chat).setOnClickListener(chatListener); v.findViewById(R.id.start_chat).setOnClickListener(chatListener);
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig(); LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
if (lpc != null) { if (lpc != null) {
if (!displayednumberOrAddress.startsWith("sip:")) { if (!displayednumberOrAddress.startsWith("sip:")) {
@ -126,9 +126,9 @@ public class ContactFragment extends Fragment implements OnClickListener {
if (!numberOrAddress.contains("@")) { if (!numberOrAddress.contains("@")) {
tag = numberOrAddress + "@" + lpc.getDomain(); tag = numberOrAddress + "@" + lpc.getDomain();
} }
v.findViewById(R.id.chat).setTag(tag); v.findViewById(R.id.start_chat).setTag(tag);
} else { } else {
v.findViewById(R.id.chat).setTag(numberOrAddress); v.findViewById(R.id.start_chat).setTag(numberOrAddress);
} }
final String finalNumberOrAddress = numberOrAddress; final String finalNumberOrAddress = numberOrAddress;
@ -161,7 +161,7 @@ public class ContactFragment extends Fragment implements OnClickListener {
} }
if (getResources().getBoolean(R.bool.disable_chat)) { if (getResources().getBoolean(R.bool.disable_chat)) {
v.findViewById(R.id.chat).setVisibility(View.GONE); v.findViewById(R.id.start_chat).setVisibility(View.GONE);
} }
controls.addView(v); controls.addView(v);

View file

@ -21,6 +21,7 @@ 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 android.annotation.SuppressLint; import android.annotation.SuppressLint;
@ -104,12 +105,17 @@ 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);
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) {
view.findViewById(R.id.addContactRow).setVisibility(View.GONE); view.findViewById(R.id.addContactRow).setVisibility(View.GONE);
} }
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
} }
public void changeDisplayedHistory(String sipUri, String displayName, String pictureUri, String status, String callTime, String callDate) { public void changeDisplayedHistory(String sipUri, String displayName, String pictureUri, String status, String callTime, String callDate) {

View file

@ -1274,10 +1274,17 @@ 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);
callView.setId(index+1);
setContactName(callView, lAddress, sipUri, resources); setContactName(callView, lAddress, sipUri, resources);
displayCallStatusIconAndReturnCallPaused(callView, call); displayCallStatusIconAndReturnCallPaused(callView, call);
setRowBackground(callView, index); setRowBackground(callView, index);

View file

@ -0,0 +1,46 @@
package org.linphone;
/*
KeepAliveHandler.java
Copyright (C) 2013 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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 org.linphone.mediastream.Log;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class KeepAliveHandler extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("Keep alive handler invoked");
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull()!=null) {
//first refresh registers
LinphoneManager.getLc().refreshRegisters();
//make sure iterate will have enough time, device will not sleep until exit from this method
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
Log.e("Cannot sleep for 10s", e);
}
}
}
}

View file

@ -25,7 +25,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
/*
* Purpose of this receiver is to disable keep alives when screen is off
* */
public class KeepAliveReceiver extends BroadcastReceiver { public class KeepAliveReceiver extends BroadcastReceiver {
@Override @Override

View file

@ -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();
@ -1428,6 +1440,7 @@ public class LinphoneActivity extends FragmentActivity implements
return view; return view;
} }
} }
} }
interface ContactPicked { interface ContactPicked {

View file

@ -59,6 +59,7 @@ import org.linphone.core.LinphoneCallParams;
import org.linphone.core.LinphoneCallStats; import org.linphone.core.LinphoneCallStats;
import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatRoom; import org.linphone.core.LinphoneChatRoom;
import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
import org.linphone.core.LinphoneCore.EcCalibratorStatus; import org.linphone.core.LinphoneCore.EcCalibratorStatus;
import org.linphone.core.LinphoneCore.FirewallPolicy; import org.linphone.core.LinphoneCore.FirewallPolicy;
@ -69,9 +70,12 @@ import org.linphone.core.LinphoneCore.Transports;
import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreException;
import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneCoreFactory;
import org.linphone.core.LinphoneCoreListener; import org.linphone.core.LinphoneCoreListener;
import org.linphone.core.LinphoneEvent;
import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneFriend;
import org.linphone.core.LinphoneInfoMessage;
import org.linphone.core.LinphoneProxyConfig; import org.linphone.core.LinphoneProxyConfig;
import org.linphone.core.PayloadType; import org.linphone.core.PayloadType;
import org.linphone.core.SubscriptionState;
import org.linphone.mediastream.Log; import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper; import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
@ -696,10 +700,15 @@ public class LinphoneManager implements LinphoneCoreListener {
private void initAccount(String key, boolean defaultAccount) throws LinphoneCoreException { private void initAccount(String key, boolean defaultAccount) throws LinphoneCoreException {
String username = getPrefString(getString(R.string.pref_username_key) + key, null); String username = getPrefString(getString(R.string.pref_username_key) + key, null);
String userid = getPrefString(getString(R.string.pref_auth_userid_key) + key, null);
String password = getPrefString(getString(R.string.pref_passwd_key) + key, null); String password = getPrefString(getString(R.string.pref_passwd_key) + key, null);
String domain = getPrefString(getString(R.string.pref_domain_key) + key, null); String domain = getPrefString(getString(R.string.pref_domain_key) + key, null);
if (username != null && username.length() > 0 && password != null) { if (username != null && username.length() > 0 && password != null) {
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null); LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username
, userid
, password
, null
,null);
mLc.addAuthInfo(lAuthInfo); mLc.addAuthInfo(lAuthInfo);
if (domain != null && domain.length() > 0) { if (domain != null && domain.length() > 0) {
@ -866,11 +875,16 @@ public class LinphoneManager implements LinphoneCoreListener {
//stun server //stun server
String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun)); String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun));
boolean useICE = getPrefBoolean(R.string.pref_ice_enable_key, mR.getBoolean(R.bool.pref_ice_enabled_default)); boolean useICE = getPrefBoolean(R.string.pref_ice_enable_key, mR.getBoolean(R.bool.pref_ice_enabled_default));
//boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default)); boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default));
mLc.setStunServer(lStun); mLc.setStunServer(lStun);
if (lStun!=null && lStun.length()>0) { if (lStun!=null && lStun.length()>0 && useICE) {
mLc.setFirewallPolicy(useICE ? FirewallPolicy.UseIce : FirewallPolicy.UseStun); mLc.setFirewallPolicy(FirewallPolicy.UseIce);
if (useUpnp) Log.e("Cannot have both ice and upnp enabled, disabling upnp");
} else if (useUpnp) {
mLc.setFirewallPolicy(FirewallPolicy.UseUpnp);
} else if (lStun!=null && lStun.length()>0){
mLc.setFirewallPolicy(FirewallPolicy.UseStun);
} else { } else {
mLc.setFirewallPolicy(FirewallPolicy.NoFirewall); mLc.setFirewallPolicy(FirewallPolicy.NoFirewall);
} }
@ -1736,4 +1750,28 @@ public class LinphoneManager implements LinphoneCoreListener {
public void notifyReceived(LinphoneCore lc, LinphoneCall call, public void notifyReceived(LinphoneCore lc, LinphoneCall call,
LinphoneAddress from, byte[] event) { LinphoneAddress from, byte[] event) {
} }
@Override
public void transferState(LinphoneCore lc, LinphoneCall call,
State new_call_state) {
}
@Override
public void infoReceived(LinphoneCore lc, LinphoneCall call, LinphoneInfoMessage info) {
Log.d("Info message received from "+call.getRemoteAddress().asString());
LinphoneContent ct=info.getContent();
if (ct!=null){
Log.d("Info received with body with mime type "+ct.getType()+"/"+ct.getSubtype()+" and data ["+ct.getDataAsString()+"]");
}
}
@Override
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
SubscriptionState state) {
Log.d("Subscription state changed to "+state+" event name is "+ev.getEventName());
}
@Override
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
String eventName, LinphoneContent content) {
Log.d("Notify received for event "+eventName);
if (content!=null) Log.d("with content "+content.getType()+"/"+content.getSubtype()+" data:"+content.getDataAsString());
}
} }

View file

@ -40,6 +40,7 @@ import org.linphone.mediastream.Log;
import org.linphone.mediastream.Version; import org.linphone.mediastream.Version;
import android.app.Activity; import android.app.Activity;
import android.app.AlarmManager;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -58,6 +59,7 @@ import android.net.wifi.WifiManager.WifiLock;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.provider.MediaStore; import android.provider.MediaStore;
@ -112,6 +114,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
private Notification mCustomNotif; private Notification mCustomNotif;
private int mMsgNotifCount; private int mMsgNotifCount;
private PendingIntent mNotifContentIntent; private PendingIntent mNotifContentIntent;
private PendingIntent mkeepAlivePendingIntent;
private String mNotificationTitle; private String mNotificationTitle;
@ -198,6 +201,13 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
} }
LinphoneManager.getLc().setPresenceInfo(0, "", OnlineStatus.Online); LinphoneManager.getLc().setPresenceInfo(0, "", OnlineStatus.Online);
//make sure the application will at least wakes up every 10 mn
Intent intent = new Intent(this, KeepAliveHandler.class);
mkeepAlivePendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP
, SystemClock.elapsedRealtime()+600000
, 600000
, mkeepAlivePendingIntent);
} }
private enum IncallIconState {INCALL, PAUSE, VIDEO, IDLE} private enum IncallIconState {INCALL, PAUSE, VIDEO, IDLE}
@ -237,7 +247,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
String userName = call.getRemoteAddress().getUserName(); String userName = call.getRemoteAddress().getUserName();
String domain = call.getRemoteAddress().getDomain(); String domain = call.getRemoteAddress().getDomain();
String displayName = call.getRemoteAddress().getDisplayName(); String displayName = call.getRemoteAddress().getDisplayName();
LinphoneAddress address = LinphoneCoreFactoryImpl.instance().createLinphoneAddress("sip:" + userName + "@" + domain); LinphoneAddress address = LinphoneCoreFactoryImpl.instance().createLinphoneAddress(userName,domain,null);
address.setDisplayName(displayName); address.setDisplayName(displayName);
Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver()); Uri pictureUri = LinphoneUtils.findUriPictureOfContactAndSetDisplayName(address, getContentResolver());
@ -313,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);
@ -474,6 +490,7 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
mNM.cancel(INCALL_NOTIF_ID); mNM.cancel(INCALL_NOTIF_ID);
mNM.cancel(MESSAGE_NOTIF_ID); mNM.cancel(MESSAGE_NOTIF_ID);
mWifiLock.release(); mWifiLock.release();
((AlarmManager) this.getSystemService(Context.ALARM_SERVICE)).cancel(mkeepAlivePendingIntent);
super.onDestroy(); super.onDestroy();
} }

View file

@ -36,6 +36,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;
@ -73,7 +74,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) {

View file

@ -236,6 +236,30 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
} }
}); });
final CheckBoxPreference useIce = (CheckBoxPreference) findPreference(R.string.pref_ice_enable_key);
final CheckBoxPreference useUpnp = (CheckBoxPreference) findPreference(R.string.pref_upnp_enable_key);
useIce.setEnabled(!useUpnp.isChecked());
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
useUpnp.setEnabled(lc.upnpAvailable() && !useIce.isChecked());
useIce.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean isChecked = (Boolean) newValue;
useUpnp.setEnabled(!isChecked);
return true;
}
});
useUpnp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
boolean isChecked = (Boolean) newValue;
useIce.setEnabled(!isChecked);
return true;
}
});
if (getResources().getBoolean(R.bool.disable_every_log)) { if (getResources().getBoolean(R.bool.disable_every_log)) {
uncheckDisableAndHideCheckbox(R.string.pref_debug_key); uncheckDisableAndHideCheckbox(R.string.pref_debug_key);
} }

View file

@ -59,8 +59,7 @@ public class WizardFragment extends Fragment {
private TextView errorMessage; private TextView errorMessage;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.setup_wizard, container, false); View view = inflater.inflate(R.layout.setup_wizard, container, false);
username = (EditText) view.findViewById(R.id.setup_username); username = (EditText) view.findViewById(R.id.setup_username);

View file

@ -56,7 +56,7 @@ public class AddressText extends EditText implements AddressType {
} }
public void clearDisplayedName() { public void clearDisplayedName() {
displayedName = ""; displayedName = null;
} }
public String getDisplayedName() { public String getDisplayedName() {

1
submodules/belle-sip Submodule

@ -0,0 +1 @@
Subproject commit 86e813107462b5df4e1eefc09b161bd31c0cd928

1
submodules/externals/antlr3 vendored Submodule

@ -0,0 +1 @@
Subproject commit 9ea1af70be642604d53e0e1f6096b9ca1ddae8a5

View file

@ -0,0 +1,36 @@
LOCAL_PATH:= $(call my-dir)/../../antlr3/runtime/C/src
include $(CLEAR_VARS)
LOCAL_MODULE:= antlr3
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../../../../externals/antlr3 \
$(LOCAL_PATH)/../include
LOCAL_SRC_FILES := \
antlr3baserecognizer.c \
antlr3basetree.c \
antlr3basetreeadaptor.c \
antlr3bitset.c \
antlr3collections.c \
antlr3commontoken.c \
antlr3commontree.c \
antlr3commontreeadaptor.c \
antlr3commontreenodestream.c \
antlr3convertutf.c \
antlr3cyclicdfa.c \
antlr3debughandlers.c \
antlr3encodings.c \
antlr3exception.c \
antlr3filestream.c \
antlr3inputstream.c \
antlr3intstream.c \
antlr3lexer.c \
antlr3parser.c \
antlr3rewritestreams.c \
antlr3string.c \
antlr3tokenstream.c \
antlr3treeparser.c \
include $(BUILD_STATIC_LIBRARY)

View file

@ -0,0 +1,180 @@
/* antlr3config.h. Generated from antlr3config.h.in by configure. */
/* antlr3config.h.in. Generated from configure.ac by autoheader. */
/* Define if ANTLR debugger not required */
/* #undef ANTLR3_NODEBUGGER */
/* Define if 64 bit mode required */
/* #undef ANTLR3_USE_64BIT */
/* Define to 1 if you have the `accept' function. */
/* #undef HAVE_ACCEPT */
/* Define to 1 if you have the <arpa/nameser.h> header file. */
/* #undef HAVE_ARPA_NAMESER_H */
/* Define to 1 if you have the <ctype.h> header file. */
/* #undef HAVE_CTYPE_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if the system has the type `intptr_t'. */
/* #undef HAVE_INTPTR_T */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define to 1 if you have the `memmove' function. */
/* #undef HAVE_MEMMOVE */
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the `memset' function. */
/* #undef HAVE_MEMSET */
/* Define to 1 if you have the <netdb.h> header file. */
/* #undef HAVE_NETDB_H */
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/tcp.h> header file. */
#define HAVE_NETINET_TCP_H 1
/* Define to 1 if you have the <resolv.h> header file. */
/* #undef HAVE_RESOLV_H */
/* Define to 1 if you have the <socket.h> header file. */
/* #undef HAVE_SOCKET_H */
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strdup' function. */
/* #undef HAVE_STRDUP */
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/malloc.h> header file. */
/* #undef HAVE_SYS_MALLOC_H */
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if the system has the type `uintptr_t'. */
/* #undef HAVE_UINTPTR_T */
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Name of package */
#define PACKAGE "libantlr3c"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "jimi@temporal-wave.com"
/* Define to the full name of this package. */
#define PACKAGE_NAME "libantlr3c"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "libantlr3c 3.4-beta3"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "libantlr3c"
/* Define to the version of this package. */
#define PACKAGE_VERSION "3.4-beta3"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "3.4-beta3"
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT32_T */
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT64_T */
/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
/* #undef _UINT8_T */
/* Define to empty if `const' does not conform to ANSI C. */
/* #undef const */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to the type of a signed integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef int16_t */
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef int32_t */
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef int64_t */
/* Define to the type of a signed integer type of width exactly 8 bits if such
a type exists and the standard includes do not define it. */
/* #undef int8_t */
/* Define to the type of a signed integer type wide enough to hold a pointer,
if such a type exists, and if the system does not define it. */
/* #undef intptr_t */
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint16_t */
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint32_t */
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint64_t */
/* Define to the type of an unsigned integer type of width exactly 8 bits if
such a type exists and the standard includes do not define it. */
/* #undef uint8_t */
/* Define to the type of an unsigned integer type wide enough to hold a
pointer, if such a type exists, and if the system does not define it. */
/* #undef uintptr_t */

View file

@ -0,0 +1,29 @@
BUILD_PATH := $(call my-dir)
LOCAL_PATH := $(call my-dir)/../../cunit
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
CUnit/Sources/Framework/CUError.c \
CUnit/Sources/Framework/MyMem.c \
CUnit/Sources/Framework/TestDB.c \
CUnit/Sources/Framework/TestRun.c \
CUnit/Sources/Framework/Util.c \
CUnit/Sources/Basic/Basic.c \
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/CUnit/Headers/ \
LOCAL_CFLAGS := \
-DHAVE_CU_GET_SUITE \
LOCAL_EXPORT_C_INCLUDES := \
$(BUILD_PATH) \
LOCAL_EXPORT_CFLAGS := $(LOCAL_CFLAGS)
LOCAL_MODULE := cunit
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)

View file

@ -1,68 +0,0 @@
LOCAL_PATH:= $(call my-dir)/../../exosip
include $(CLEAR_VARS)
LOCAL_MODULE := libeXosip2
# Don't prelink this library.
LOCAL_PRELINK_MODULE := false
LOCAL_SRC_FILES = \
src/eXosip.c \
src/eXconf.c \
src/eXregister_api.c \
src/eXcall_api.c \
src/eXmessage_api.c \
src/eXtransport.c \
src/jrequest.c \
src/jresponse.c \
src/jcallback.c \
src/jdialog.c \
src/udp.c \
src/jcall.c \
src/jreg.c \
src/eXutils.c \
src/jevents.c \
src/misc.c \
src/jauth.c \
src/eXosip_transport_hook.c
LOCAL_SRC_FILES += \
src/eXtl.c \
src/eXtl_udp.c \
src/eXtl_tcp.c \
src/eXtl_dtls.c \
src/eXtl_tls.c
LOCAL_SRC_FILES += \
src/milenage.c \
src/rijndael.c
# BUILD_MAXSIZE: -UMINISIZE
LOCAL_SRC_FILES += \
src/eXsubscription_api.c \
src/eXoptions_api.c \
src/eXinsubscription_api.c \
src/eXpublish_api.c \
src/jnotify.c \
src/jsubscribe.c \
src/inet_ntop.c \
src/jpipe.c \
src/eXrefer_api.c \
src/jpublish.c \
src/sdp_offans.c
LOCAL_CFLAGS += \
-UHAVE_CONFIG_H \
-include $(LOCAL_PATH)/../build/exosip/libeXosip2_AndroidConfig.h \
-DOSIP_MT \
-DENABLE_TRACE \
-DSOCKET_TIMEOUT=50 \
-include $(LOCAL_PATH)/include/eXosip2/eXosip_transport_hook.h
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/include \
$(LOCAL_PATH)/../osip/include \
$(LOCAL_PATH)/../openssl/include \
include $(BUILD_STATIC_LIBRARY)

View file

@ -1,123 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the `getifaddrs' function. */
/* #undef HAVE_GETIFADDRS */
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <openssl/ssl.h> header file. */
#define HAVE_OPENSSL_SSL_H 1
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
/* Define to 1 if you have the <resolv8_compat.h> header file. */
/* #undef HAVE_RESOLV8_COMPAT_H */
/* Define to 1 if you have the <resolv.h> header file. */
#define HAVE_RESOLV_H 1
/* Define to 1 if you have the <semaphore.h> header file. */
#define HAVE_SEMAPHORE_H 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
/* #undef HAVE_SYS_SEM_H */
/* Define to 1 if you have the <sys/signal.h> header file. */
/* #undef HAVE_SYS_SIGNAL_H */
/* Define to 1 if you have the <sys/soundcard.h> header file. */
/* #undef HAVE_SYS_SOUNDCARD_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <varargs.h> header file. */
/* #undef HAVE_VARARGS_H */
/* Name of package */
#define PACKAGE "libeXosip2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "3.1.0"

View file

@ -56,6 +56,8 @@ common_C_INCLUDES += \
LOCAL_C_INCLUDES += $(common_C_INCLUDES) LOCAL_C_INCLUDES += $(common_C_INCLUDES)
#LOCAL_CFLAGS += -fvisibility=hidden #LOCAL_CFLAGS += -fvisibility=hidden
LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_MODULE:= liblpxml2 LOCAL_MODULE:= liblpxml2
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)

View file

@ -1,92 +0,0 @@
LOCAL_PATH:= $(call my-dir)/../../osip
include $(CLEAR_VARS)
libosip2_SRC_FILES = \
src/osip2/ict_fsm.c \
src/osip2/ist_fsm.c \
src/osip2/nict_fsm.c \
src/osip2/nist_fsm.c \
src/osip2/ict.c \
src/osip2/ist.c \
src/osip2/nict.c \
src/osip2/nist.c \
src/osip2/fsm_misc.c \
src/osip2/osip.c \
src/osip2/osip_transaction.c \
src/osip2/osip_event.c \
src/osip2/port_fifo.c \
src/osip2/osip_dialog.c \
src/osip2/osip_time.c \
src/osip2/port_sema.c \
src/osip2/port_thread.c \
src/osip2/port_condv.c
libosipparser2_SRC_FILES = \
src/osipparser2/osip_proxy_authorization.c \
src/osipparser2/osip_cseq.c \
src/osipparser2/osip_record_route.c \
src/osipparser2/osip_route.c \
src/osipparser2/osip_to.c \
src/osipparser2/osip_from.c \
src/osipparser2/osip_uri.c \
src/osipparser2/osip_authorization.c \
src/osipparser2/osip_header.c \
src/osipparser2/osip_www_authenticate.c \
src/osipparser2/osip_via.c \
src/osipparser2/osip_body.c \
src/osipparser2/osip_md5c.c \
src/osipparser2/osip_message.c \
src/osipparser2/osip_list.c \
src/osipparser2/osip_call_id.c \
src/osipparser2/osip_message_parse.c \
src/osipparser2/osip_contact.c \
src/osipparser2/osip_message_to_str.c \
src/osipparser2/osip_content_length.c \
src/osipparser2/osip_parser_cfg.c \
src/osipparser2/osip_content_type.c \
src/osipparser2/osip_proxy_authenticate.c \
src/osipparser2/osip_mime_version.c \
src/osipparser2/osip_port.c
# BUILD_MAXSIZE: -UMINISIZE
libosipparser2_SRC_FILES += \
src/osipparser2/osip_accept_encoding.c \
src/osipparser2/osip_content_encoding.c \
src/osipparser2/osip_authentication_info.c \
src/osipparser2/osip_proxy_authentication_info.c \
src/osipparser2/osip_accept_language.c \
src/osipparser2/osip_accept.c \
src/osipparser2/osip_alert_info.c \
src/osipparser2/osip_error_info.c \
src/osipparser2/osip_allow.c \
src/osipparser2/osip_content_disposition.c \
src/osipparser2/sdp_accessor.c \
src/osipparser2/sdp_message.c \
src/osipparser2/osip_call_info.c
LOCAL_SRC_FILES := \
$(libosip2_SRC_FILES) \
$(libosipparser2_SRC_FILES)
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/include
LOCAL_MODULE:= libosip2
# global flags
LOCAL_CFLAGS += \
-UHAVE_CONFIG_H \
-include $(LOCAL_PATH)/../build/osip/libosip2_AndroidConfig.h
# specific flags
LOCAL_CFLAGS += \
-DOSIP_MT \
-DHAVE_PTHREAD \
-DENABLE_TRACE \
-DUSE_GPERF
#LOCAL_LDLIBS += -lpthread
include $(BUILD_STATIC_LIBRARY)

View file

@ -1,117 +0,0 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define to 1 if you have <dict/dict.h> header file */
/* #undef HAVE_DICT_DICT_H */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Defined if you have lrand48 */
#define HAVE_LRAND48
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have POSIX threads libraries and header files. */
#define HAVE_PTHREAD 1
/* Define to 1 if you have the <semaphore.h> header file. */
#define HAVE_SEMAPHORE_H 1
/* Define to 1 if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdio.h> header file. */
#define HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if the system has the type `struct timeval'. */
#define HAVE_STRUCT_TIMEVAL 1
/* Define to 1 if you have the <syslog.h> header file. */
#define HAVE_SYSLOG_H 1
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/sem.h> header file. */
/* #undef HAVE_SYS_SEM_H */
/* Define to 1 if you have the <sys/signal.h> header file. */
/* #undef HAVE_SYS_SIGNAL_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/unistd.h> header file. */
/* #undef HAVE_SYS_UNISTD_H */
/* Define to 1 if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if you have the <varargs.h> header file. */
/* #undef HAVE_VARARGS_H */
/* Name of package */
#define PACKAGE "libosip2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to the necessary symbol if this constant uses a non-standard name on
your system. */
/* #undef PTHREAD_CREATE_JOINABLE */
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
#define VERSION "3.1.0"

View file

@ -0,0 +1,60 @@
LOCAL_PATH:= $(call my-dir)/../../polarssl/library
include $(CLEAR_VARS)
LOCAL_MODULE:= libpolarssl
LOCAL_SRC_FILES := \
aes.c \
arc4.c \
asn1parse.c \
asn1write.c \
base64.c \
bignum.c \
blowfish.c \
camellia.c \
certs.c \
cipher.c \
cipher_wrap.c \
ctr_drbg.c \
debug.c \
des.c \
dhm.c \
entropy.c \
entropy_poll.c \
error.c \
gcm.c \
havege.c \
md2.c \
md4.c \
md5.c \
md.c \
md_wrap.c \
net.c \
padlock.c \
pbkdf2.c \
pem.c \
pkcs11.c \
rsa.c \
sha1.c \
sha2.c \
sha4.c \
ssl_cache.c \
ssl_cli.c \
ssl_srv.c \
ssl_tls.c \
timing.c \
version.c \
x509parse.c \
x509write.c \
xtea.c
#LOCAL_CFLAGS += \
LOCAL_C_INCLUDES += \
$(LOCAL_PATH)/../include
include $(BUILD_STATIC_LIBRARY)

1
submodules/externals/cunit vendored Submodule

@ -0,0 +1 @@
Subproject commit dc9283c76517b1f093d132d1ee0aa9671b558e56

@ -1 +0,0 @@
Subproject commit b42d2eb4f137386c35c3226616e0cca213b94629

@ -1 +0,0 @@
Subproject commit 7e98a3379280307811ed4ad67a95fbf73ba5bbb6

1
submodules/externals/polarssl vendored Submodule

@ -0,0 +1 @@
Subproject commit b772d5593c025e6fb945e21ee683b50ba327e211

@ -1 +1 @@
Subproject commit c01a03a478d4c97fa7e2af80844f8d60440af0a6 Subproject commit 14027d37c7574b27bf22e57f508137b4e86b6466

@ -1 +1 @@
Subproject commit 53f7cedf0047ee73d5f0d2c823dfbe1297322cab Subproject commit af0df9b19b40aa1e46d7135c809db4f694218790

@ -1 +1 @@
Subproject commit b3392dc7f07c94a27eb270eafaa861a127189555 Subproject commit 2958b2904de6f58372cda7068db3828308563f7d

View file

@ -1,14 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/>
<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 combineaccessrules="false" kind="src" path="/Linphone-Android-NewUI"/> <classpathentry kind="lib" path="/home/viish/Work/linphone-android/tests/libs/robotium-solo-4.1.jar">
<classpathentry kind="lib" path="libs/robotium-solo-3.6.jar">
<attributes> <attributes>
<attribute name="javadoc_location" value="jar:platform:/resource/Linphone-Android-NewUI-Tests/libs/robotium-solo-3.6-javadoc.jar!/"/> <attribute name="javadoc_location" value="jar:file:/home/viish/Work/linphone-android/tests/libs/robotium-solo-4.1-javadoc.jar!/"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry combineaccessrules="false" kind="src" path="/linphone-android-private"/>
<classpathentry kind="output" path="bin/classes"/> <classpathentry kind="output" path="bin/classes"/>
</classpath> </classpath>

View file

@ -4,16 +4,41 @@
android:versionCode="1" android:versionCode="1"
android:versionName="1.0" > android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16" /> /> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<!-- Needed to allow Linphone to install on tablets, since android.permission.CALL_PHONE implies android.hardware.telephony is required -->
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA" />
<!-- Needed to allow Linphone to install on tablets, since android.permission.CAMERA implies android.hardware.camera and android.hardware.camera.autofocus are required -->
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!-- Needed to store received images if the user wants to -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Needed to use our own Contact editor -->
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
<!-- Needed to route the audio to the bluetooth headset if available -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<instrumentation <instrumentation
android:name="android.test.InstrumentationTestRunner" android:name="android.test.InstrumentationTestRunner"
android:targetPackage="org.linphone" /> android:targetPackage="org.linphone" />
<application <application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" > android:label="@string/app_name" >
<uses-library android:name="android.test.runner" /> <uses-library android:name="android.test.runner" />
</application> </application>
</manifest> </manifest>

18
tests/ant.properties Normal file
View file

@ -0,0 +1,18 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked into Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.
tested.project.dir=../

View file

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target. # Project target.
target=android-16 target=android-17

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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_generic_login">wizard15</string>
<string name="account_generic_pwd">wizard15</string>
<string name="account_generic_domain">test.linphone.org</string>
<string name="account_create_login">wizard42</string>
<string name="account_create_pwd">wizard42</string>
<string name="account_create_email">wizard42@linphone.org</string>
<string name="account_test_calls_login">viish</string>
<string name="account_test_calls_pwd">lucifer</string>
<string name="account_test_calls_domain">sip.linphone.org</string>
<string name="contact_name">Cot</string>
<string name="contact_number">+33952636505</string>
<string name="contact_sip">viish@sip.linphone.org</string>
<string name="chat_test_text_sent">Ping!</string>
<string name="chat_test_text_received">Pong!</string>
<string name="conference_account_login">elviish</string>
<string name="conference_account_password">lucifer</string>
<string name="conference_account_domain">sip.linphone.org</string>
</resources>

View file

@ -0,0 +1,173 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneProxyConfig;
import org.linphone.mediastream.video.capture.hwconf.Hacks;
import org.linphone.setup.SetupActivity;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
/**
* @author Sylvain Berfini
*/
public class AccountAssistant extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAWizardDisplayedAfterInstall() {
solo.waitForActivity("SetupActivity", 3000);
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
}
@SmallTest
@MediumTest
@LargeTest
public void testBLoginWithLinphoneAccount() {
solo.waitForActivity("SetupActivity", 1000);
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));
if (!Hacks.hasBuiltInEchoCanceller())
solo.waitForActivity("LinphoneActivity", 8000);
else
solo.waitForActivity("LinphoneActivity", 2000);
Assert.assertTrue(solo.searchText(iContext.getString(R.string.account_linphone_login) + "@sip.linphone.org"));
solo.sleep(3000); //Wait for registration to be done
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 1);
LinphoneProxyConfig proxyConfig = proxyConfigs[0];
Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
//Check the wizard added sip.linphone.org custom settings
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
String stunServer = prefs.getString(aContext.getString(org.linphone.R.string.pref_stun_server_key), "");
Assert.assertEquals(stunServer, aContext.getString(org.linphone.R.string.default_stun));
String transport = prefs.getString(aContext.getString(org.linphone.R.string.pref_transport_key), aContext.getString(org.linphone.R.string.pref_transport_udp_key));
Assert.assertEquals(transport, aContext.getString(org.linphone.R.string.pref_transport_tls_key));
String proxy = prefs.getString(aContext.getString(org.linphone.R.string.pref_proxy_key), "");
Assert.assertEquals(proxy, aContext.getString(org.linphone.R.string.default_domain) + ":5223");
boolean outboundproxy = prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_enable_outbound_proxy_key), false);
Assert.assertEquals(outboundproxy, true);
boolean ice = prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_ice_enable_key), false);
Assert.assertEquals(ice, true);
}
@LargeTest
public void testCWizardDoesntShowWhenAccountIsConfigured() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@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));
if (!Hacks.hasBuiltInEchoCanceller())
solo.waitForActivity("LinphoneActivity", 8000);
else
solo.waitForActivity("LinphoneActivity", 2000);
Assert.assertTrue(solo.searchText(iContext.getString(R.string.account_generic_login) + "@" + iContext.getString(R.string.account_generic_domain)));
solo.sleep(3000); //Wait for registration to be done
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 2);
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
}
@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);
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));
solo.sleep(sleepingTime*2);
Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_username_unavailable));
Assert.assertFalse(createAccount.isEnabled());
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd).substring(0,2));
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_passwords_unmatched));
Assert.assertFalse(createAccount.isEnabled());
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password));
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd).substring(0,2));
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm), iContext.getString(R.string.account_create_pwd).substring(0,2));
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_password_incorrect));
Assert.assertFalse(createAccount.isEnabled());
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_email), iContext.getString(R.string.account_create_email).substring(0, 12));
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), aContext.getString(org.linphone.R.string.wizard_email_incorrect));
Assert.assertFalse(createAccount.isEnabled());
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_username));
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password));
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm));
solo.clearEditText((EditText) solo.getView(org.linphone.R.id.setup_email));
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_username), iContext.getString(R.string.account_create_login));
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password), iContext.getString(R.string.account_create_pwd));
solo.enterText((EditText) solo.getView(org.linphone.R.id.setup_password_confirm), iContext.getString(R.string.account_create_pwd));
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());
}
@LargeTest
public void testFCancelWizard() {
startWizard();
solo.clickOnView(solo.getView(org.linphone.R.id.setup_cancel));
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
private void startWizard() {
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));
}
}

View file

@ -0,0 +1,91 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.FragmentsAvailable;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCore.RegistrationState;
import org.linphone.core.LinphoneProxyConfig;
import android.test.suitebuilder.annotation.LargeTest;
import android.view.KeyEvent;
/**
* @author Sylvain Berfini
*/
public class AccountManagement extends SampleTest {
@LargeTest
public void testAEditAccount() {
goToSettings();
solo.clickOnText(iContext.getString(R.string.account_generic_login) + "@" + iContext.getString(R.string.account_generic_domain));
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_username));
solo.enterText(0, "new");
//Hack to validate the dialog
solo.sendKey(KeyEvent.KEYCODE_ENTER);
solo.sendKey(KeyEvent.KEYCODE_TAB);
solo.sendKey(KeyEvent.KEYCODE_ENTER);
//End of hack
solo.goBack();
solo.goBack();
solo.waitForFragmentByTag(FragmentsAvailable.DIALER.toString(), 2000);
solo.sleep(2000); //Wait for registration to be done
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 2);
LinphoneProxyConfig proxyConfig = proxyConfigs[1];
Assert.assertEquals(RegistrationState.RegistrationOk, proxyConfig.getState());
Assert.assertTrue(proxyConfig.getIdentity(), proxyConfig.getIdentity().contains("new"));
}
@LargeTest
public void testBDeleteAccount() {
goToSettings();
solo.clickOnText(iContext.getString(R.string.account_generic_login) + "new");
selectItemInListOnUIThread(7);
solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_delete_account));
solo.goBack();
solo.goBack();
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 1);
}
@LargeTest
public void testCDisableAccount() {
goToSettings();
solo.clickOnText(iContext.getString(R.string.account_linphone_login));
selectItemInListOnUIThread(5);
solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_disable_account));
solo.goBack();
solo.goBack();
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 0);
}
@LargeTest
public void testDEnableAccount() {
goToSettings();
solo.clickOnText(iContext.getString(R.string.account_linphone_login));
selectItemInListOnUIThread(5);
solo.clickLongOnText(aContext.getString(org.linphone.R.string.pref_disable_account));
solo.goBack();
solo.goBack();
LinphoneProxyConfig[] proxyConfigs = LinphoneManager.getLc().getProxyConfigList();
Assert.assertEquals(proxyConfigs.length, 1);
}
private void goToSettings() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
}
}

View file

@ -1,226 +0,0 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.LinphoneActivity;
import org.linphone.R;
import org.linphone.mediastream.video.capture.hwconf.Hacks;
import org.linphone.setup.SetupActivity;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.jayway.android.robotium.solo.Solo;
public class AccountsTest extends
ActivityInstrumentationTestCase2<LinphoneActivity> {
private Solo solo;
@SuppressWarnings("deprecation")
public AccountsTest() {
super("org.linphone", LinphoneActivity.class);
}
private void selectItemInListOnUIThread(final int item) {
solo.sleep(500);
getActivity().runOnUiThread(new Runnable() {
public void run() {
ListView list = (ListView) solo.getView(android.R.id.list);
list.setSelection(item);
}
});
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void testAConfigureExistingLinphoneAccount() {
Context context = getActivity();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
solo.waitForActivity("SetupActivity", 2000);
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
Log.testSuccess("Wizard launching at first startup");
solo.clickOnView(solo.getView(R.id.setup_next));
solo.clickOnText(context.getString(R.string.setup_login_linphone));
solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15");
solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15");
solo.clickOnText(context.getString(R.string.setup_apply));
if (!Hacks.hasBuiltInEchoCanceller())
solo.waitForActivity("LinphoneActivity", 8000);
else
solo.waitForActivity("LinphoneActivity", 2000);
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
Log.testSuccess("Configure existing sip.linphone.org account");
String stunServer = prefs.getString(context.getString(R.string.pref_stun_server_key), "");
Assert.assertEquals(stunServer, context.getString(R.string.default_stun));
Log.testSuccess("Default stun server is configured");
String transport = prefs.getString(context.getString(R.string.pref_transport_key), context.getString(R.string.pref_transport_udp_key));
Assert.assertEquals(transport, context.getString(R.string.pref_transport_tls_key));
Log.testSuccess("TLS is set by default");
String proxy = prefs.getString(context.getString(R.string.pref_proxy_key), "");
Assert.assertEquals(proxy, context.getString(R.string.default_domain) + ":5223");
boolean outboundproxy = prefs.getBoolean(context.getString(R.string.pref_enable_outbound_proxy_key), false);
Assert.assertEquals(outboundproxy, true);
Log.testSuccess("Outbound proxy is configured");
boolean ice = prefs.getBoolean(context.getString(R.string.pref_ice_enable_key), false);
Assert.assertEquals(ice, true);
Log.testSuccess("ICE is enabled");
}
public void testBConfigureExternalSIPAccount() {
Context context = getActivity();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
Log.testSuccess("Wizard not launching at startup if account is configured");
solo.clickOnView(solo.getView(R.id.settings));
solo.clickOnText(context.getString(R.string.setup_title));
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
solo.clickOnView(solo.getView(R.id.setup_next));
solo.clickOnText(context.getString(R.string.setup_login_generic));
solo.enterText((EditText) solo.getView(R.id.setup_username), "junit");
solo.enterText((EditText) solo.getView(R.id.setup_password), "junit");
solo.enterText((EditText) solo.getView(R.id.setup_domain), "test.linphone.org");
solo.clickOnText(context.getString(R.string.setup_apply));
solo.waitForActivity("LinphoneActivity", 2000);
Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
Assert.assertEquals(nbAccountsBefore + 1, nbAccountsAfter);
Log.testSuccess("Configure existing generic account");
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
Assert.assertTrue(solo.searchText("junit@test.linphone.org"));
solo.clickOnText("junit@test.linphone.org");
selectItemInListOnUIThread(6);
solo.clickOnText(context.getString(R.string.pref_default_account));
solo.goBack();
int defaultAccount = prefs.getInt(context.getString(R.string.pref_default_account_key), 0);
solo.sleep(1000);
Assert.assertEquals(1, defaultAccount);
Log.testSuccess("Select another account as default");
}
public void testCDeleteConfiguredAccount() {
Context context = getActivity();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());
int nbAccountsBefore = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
Assert.assertTrue(solo.searchText("wizard15@sip.linphone.org"));
solo.clickOnText("wizard15@sip.linphone.org");
selectItemInListOnUIThread(7);
solo.clickOnText(context.getString(R.string.pref_delete_account));
solo.goBack();
int nbAccountsAfter = prefs.getInt(getActivity().getString(R.string.pref_extra_accounts), 0);
Assert.assertEquals(nbAccountsBefore - 1, nbAccountsAfter);
Log.testSuccess("Deleting existing SIP account");
}
public void testDTryCreatingExistingAccount() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
solo.clickOnText(context.getString(R.string.setup_title));
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
solo.clickOnView(solo.getView(R.id.setup_next));
solo.clickOnText(context.getString(R.string.setup_create_account));
TextView error = (TextView) solo.getView(R.id.setup_error);
ImageView createAccount = (ImageView) solo.getView(R.id.setup_create);
int sleepingTime = 1500;
solo.enterText((EditText) solo.getView(R.id.setup_username), "wi");
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_incorrect));
Assert.assertFalse(createAccount.isEnabled());
Log.testSuccess("Username incorrect error message");
solo.clearEditText((EditText) solo.getView(R.id.setup_username));
solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard15");
solo.sleep(sleepingTime*2);
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_username_unavailable));
Assert.assertFalse(createAccount.isEnabled());
Log.testSuccess("Username already in use error message");
solo.enterText((EditText) solo.getView(R.id.setup_password), "wi");
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_password_incorrect));
Assert.assertFalse(createAccount.isEnabled());
Log.testSuccess("Password incorrect error message");
solo.clearEditText((EditText) solo.getView(R.id.setup_password));
solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard15");
solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard14");
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_passwords_unmatched));
Assert.assertFalse(createAccount.isEnabled());
Log.testSuccess("Passwords doesn't match error message");
solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard15@lin");
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), context.getString(R.string.wizard_email_incorrect));
Assert.assertFalse(createAccount.isEnabled());
Log.testSuccess("Email incorrect error message");
solo.clearEditText((EditText) solo.getView(R.id.setup_username));
solo.clearEditText((EditText) solo.getView(R.id.setup_password));
solo.clearEditText((EditText) solo.getView(R.id.setup_password_confirm));
solo.clearEditText((EditText) solo.getView(R.id.setup_email));
solo.enterText((EditText) solo.getView(R.id.setup_username), "wizard42");
solo.enterText((EditText) solo.getView(R.id.setup_password), "wizard42");
solo.enterText((EditText) solo.getView(R.id.setup_password_confirm), "wizard42");
solo.enterText((EditText) solo.getView(R.id.setup_email), "wizard42@linphone.org");
solo.sleep(sleepingTime);
Assert.assertEquals(error.getText(), "");
Assert.assertTrue(createAccount.isEnabled());
Log.testSuccess("All wizard fields correctly filled");
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
}

View file

@ -1,142 +0,0 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.InCallActivity;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.R;
import org.linphone.core.LinphoneCall;
import org.linphone.setup.SetupActivity;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;
import android.widget.ListView;
import com.jayway.android.robotium.solo.Solo;
public class AccountzFreephonieTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
private static final String numberToCallToTestPSTNGateway = "0482532176";
private Solo solo;
@SuppressWarnings("deprecation")
public AccountzFreephonieTest() {
super("org.linphone", LinphoneActivity.class);
}
private void selectItemInListOnUIThread(final int item) {
solo.sleep(500);
getActivity().runOnUiThread(new Runnable() {
public void run() {
ListView list = (ListView) solo.getView(android.R.id.list);
list.setSelection(item);
}
});
}
private void configureFreephonieAccount() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
selectItemInListOnUIThread(6);
solo.clickOnText(context.getString(R.string.pref_network_title));
solo.clickOnText(context.getString(R.string.pref_transport));
solo.clickOnText(context.getString(R.string.pref_transport_udp));
solo.goBack();
selectItemInListOnUIThread(0);
solo.clickOnText(context.getString(R.string.setup_title));
solo.assertCurrentActivity("Expected Setup Activity", SetupActivity.class);
solo.clickOnView(solo.getView(R.id.setup_next));
solo.clickOnText(context.getString(R.string.setup_login_generic));
solo.enterText((EditText) solo.getView(R.id.setup_username), "0953335419");
solo.enterText((EditText) solo.getView(R.id.setup_password), "jodeeeeeer");
solo.enterText((EditText) solo.getView(R.id.setup_domain), "freephonie.net");
solo.clickOnText(context.getString(R.string.setup_apply));
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
solo.clickOnText("0953335419@freephonie.net");
selectItemInListOnUIThread(6);
solo.clickOnText(context.getString(R.string.pref_default_account));
// solo.clickOnText(context.getString(R.string.pref_proxy));
// solo.enterText(0, "sip.linphone.org");
// solo.clickOnText("OK");
// solo.clickOnText(context.getString(R.string.pref_enable_outbound_proxy));
solo.goBack();
solo.goBack();
}
private void deleteFreephonieAccount() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
selectItemInListOnUIThread(0);
solo.clickOnText("junit@test.linphone.org");
selectItemInListOnUIThread(6);
solo.clickOnText(context.getString(R.string.pref_default_account));
solo.goBack();
solo.clickOnText("0953335419@freephonie.net");
selectItemInListOnUIThread(7);
solo.clickOnText(context.getString(R.string.pref_delete_account));
selectItemInListOnUIThread(6);
solo.clickOnText(context.getString(R.string.pref_network_title));
solo.clickOnText(context.getString(R.string.pref_transport));
solo.clickOnText(context.getString(R.string.pref_transport_tls));
solo.goBack();
solo.goBack();
}
private void goToDialerAndOutgoingCall() {
solo.clickOnView(solo.getView(R.id.dialer));
solo.clickOnView(solo.getView(R.id.Adress));
solo.enterText((EditText) solo.getView(R.id.Adress), numberToCallToTestPSTNGateway);
solo.clickOnView(solo.getView(R.id.Call));
solo.waitForActivity("InCallActivity", 2000);
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.sleep(2000);
try {
LinphoneCall.State state = LinphoneManager.getLcIfManagerNotDestroyedOrNull().getCalls()[0].getState();
Assert.assertTrue(state == LinphoneCall.State.OutgoingEarlyMedia || state == LinphoneCall.State.OutgoingRinging || state == LinphoneCall.State.StreamsRunning);
} catch (AssertionError ae) {
} finally {
solo.clickOnView(solo.getView(R.id.hangUp));
}
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void testAOutgoingCallUsingPSTNGatewayAndFreephonieNetwork() {
configureFreephonieAccount();
goToDialerAndOutgoingCall();
deleteFreephonieAccount();
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
}

View file

@ -0,0 +1,26 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.core.LinphoneCore.RegistrationState;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class AinitTestEnv extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInitLinphoneCore() {
LinphoneTestManager.createAndStart(aContext, iContext, 1);
solo.sleep(2000);
Assert.assertEquals(RegistrationState.RegistrationOk, LinphoneTestManager.getLc().getProxyConfigList()[0].getState());
}
}

View file

@ -1,385 +0,0 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.InCallActivity;
import org.linphone.LinphoneActivity;
import org.linphone.R;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.test.ActivityInstrumentationTestCase2;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import com.jayway.android.robotium.solo.Solo;
public class AudioAndVideoCodecsTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
private static final String sipAdressToCall = "cotcot@sip.linphone.org";
private Solo solo;
@SuppressWarnings("deprecation")
public AudioAndVideoCodecsTest() {
super("org.linphone", LinphoneActivity.class);
}
private void selectItemInListOnUIThread(final int item) {
solo.sleep(500);
getActivity().runOnUiThread(new Runnable() {
public void run() {
ListView list = (ListView) solo.getView(android.R.id.list);
list.setSelection(item);
}
});
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
private boolean getBoolean(int key) {
return getActivity().getResources().getBoolean(key);
}
private void goToAudioCodecsSettings() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
selectItemInListOnUIThread(4);
solo.clickOnText(context.getString(R.string.pref_audio));
solo.sleep(500);
}
private void goToVideoCodecsSettings() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
selectItemInListOnUIThread(6);
if (solo.searchText(context.getString(R.string.pref_video), 2)) // Needed in case pref_video_enable_title contains pref_video
solo.clickOnText(context.getString(R.string.pref_video), 2);
else
solo.clickOnText(context.getString(R.string.pref_video));
solo.sleep(500);
}
private void disableAllEnabledAudioCodecs() {
Context context = getActivity();
goToAudioCodecsSettings();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context.getString(R.string.pref_codec_speex16_key), getBoolean(R.bool.pref_codec_speex16_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_speex16));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_speex8_key), getBoolean(R.bool.pref_codec_speex8_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_speex8));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_ilbc_key), getBoolean(R.bool.pref_codec_ilbc_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_ilbc));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_amr_key), getBoolean(R.bool.pref_codec_amr_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_amr));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_amrwb_key), getBoolean(R.bool.pref_codec_amrwb_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_amrwb));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_g729_key), getBoolean(R.bool.pref_codec_g729_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_g729));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_gsm_key), getBoolean(R.bool.pref_codec_gsm_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_gsm));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_g722_key), getBoolean(R.bool.pref_codec_g722_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_g722));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_silk24_key), getBoolean(R.bool.pref_codec_silk24_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_silk24));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_silk16_key), getBoolean(R.bool.pref_codec_silk16_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_silk16));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_pcmu_key), getBoolean(R.bool.pref_codec_pcmu_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_pcmu));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_codec_pcma_key), getBoolean(R.bool.pref_codec_pcma_default))) {
solo.clickOnText(context.getString(R.string.pref_codec_pcma));
solo.sleep(500);
}
}
private void disableAllEnabledVideoCodecs() {
Context context = getActivity();
goToVideoCodecsSettings();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context.getString(R.string.pref_video_codec_vp8_key), getBoolean(R.bool.pref_video_codec_vp8_default))) {
solo.clickOnText(context.getString(R.string.pref_video_codec_vp8_title));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_video_codec_h264_key), getBoolean(R.bool.pref_video_codec_h264_default))) {
solo.clickOnText(context.getString(R.string.pref_video_codec_h264_title));
solo.sleep(500);
}
if (prefs.getBoolean(context.getString(R.string.pref_video_codec_mpeg4_key), getBoolean(R.bool.pref_video_codec_mpeg4_default))) {
solo.clickOnText(context.getString(R.string.pref_video_codec_mpeg4_title));
solo.sleep(500);
}
}
private void goToDialerAndOutgoingCall(String codecTextToAssert) {
Context context = getActivity();
solo.clickOnView(solo.getView(R.id.dialer));
solo.clickOnView(solo.getView(R.id.Adress));
solo.enterText((EditText) solo.getView(R.id.Adress), sipAdressToCall);
solo.clickOnView(solo.getView(R.id.Call));
boolean incompatibleMediaParams = solo.waitForText(context.getString(R.string.error_incompatible_media), 1, 1500);
if (!incompatibleMediaParams) { // There is a possiblity the callee doesn't support the codec, in which case we don't have to wait for the incall view
solo.waitForActivity("InCallActivity", 1000);
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.clickOnView(solo.getView(R.id.status));
solo.waitForText(codecTextToAssert, 1, 6000);
Assert.assertTrue(solo.searchText(codecTextToAssert, 1));
View hangUp = solo.getView(R.id.hangUp);
if (hangUp.getVisibility() == View.VISIBLE)
solo.clickOnView(hangUp);
else { // While on video, menu can hide. Click the first time to display it back, then click again to really hang up
solo.clickOnView(hangUp);
solo.sleep(1000);
solo.clickOnView(hangUp);
}
} else {
Log.testFailure("Incompatible media parameters for codec " + codecTextToAssert);
}
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
public void testADisableVideo() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
selectItemInListOnUIThread(4);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (prefs.getBoolean(context.getString(R.string.pref_video_enable_key), getBoolean(R.bool.pref_video_enable_default))) {
solo.clickOnText(context.getString(R.string.pref_video_enable_title));
solo.sleep(500);
}
}
public void testBOutgoingAudioCallPCMA() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_pcma));
solo.goBack();
goToDialerAndOutgoingCall("PCMA");
solo.sleep(1000);
}
public void testCOutgoingAudioCallPCMU() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_pcmu));
solo.goBack();
goToDialerAndOutgoingCall("PCMU");
solo.sleep(1000);
}
public void testDOutgoingAudioCallSilk16() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_silk16));
solo.goBack();
goToDialerAndOutgoingCall("SILK");
solo.sleep(1000);
}
public void testEOutgoingAudioCallSilk24() {
// Silk24 no longer available
// Context context = getActivity();
// disableAllEnabledAudioCodecs();
// solo.clickOnText(context.getString(R.string.pref_codec_silk24));
// solo.goBack();
//
// goToDialerAndOutgoingCall("SILK");
// solo.sleep(1000);
}
public void testFOutgoingAudioCallG722() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_g722));
solo.goBack();
goToDialerAndOutgoingCall("G722");
solo.sleep(1000);
}
public void testGOutgoingAudioCallGSM() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_gsm));
solo.goBack();
goToDialerAndOutgoingCall("GSM");
solo.sleep(1000);
}
public void testHOutgoingAudioCallAMR() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_amr));
solo.goBack();
goToDialerAndOutgoingCall("AMR");
solo.sleep(1000);
}
public void testIOutgoingAudioCallAMRWB() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_amrwb));
solo.goBack();
goToDialerAndOutgoingCall("AMRWB");
solo.sleep(1000);
}
public void testJOutgoingAudioCallG729() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_g729));
solo.goBack();
goToDialerAndOutgoingCall("G729");
solo.sleep(1000);
}
public void testKOutgoingAudioCallILBC() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_ilbc));
solo.goBack();
goToDialerAndOutgoingCall("iLBC");
solo.sleep(1000);
}
public void testLOutgoingAudioCallSpeex8() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_speex8));
solo.goBack();
goToDialerAndOutgoingCall("speex");
solo.sleep(1000);
}
public void testMOutgoingAudioCallSpeex16() {
Context context = getActivity();
disableAllEnabledAudioCodecs();
solo.clickOnText(context.getString(R.string.pref_codec_speex16));
solo.goBack();
goToDialerAndOutgoingCall("speex");
solo.sleep(1000);
}
public void testNEnableVideo() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.settings));
solo.sleep(500);
selectItemInListOnUIThread(4);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
if (!prefs.getBoolean(context.getString(R.string.pref_video_enable_key), getBoolean(R.bool.pref_video_enable_default))) {
solo.clickOnText(context.getString(R.string.pref_video_enable_title));
solo.sleep(500);
}
}
public void testOOutgoingVideoCallVP8() {
Context context = getActivity();
disableAllEnabledVideoCodecs();
solo.clickOnText(context.getString(R.string.pref_video_codec_vp8_title));
solo.goBack();
goToDialerAndOutgoingCall("VP8");
solo.sleep(1000);
}
public void testPOutgoingVideoCallH264() {
Context context = getActivity();
disableAllEnabledVideoCodecs();
solo.clickOnText(context.getString(R.string.pref_video_codec_h264_title));
solo.goBack();
goToDialerAndOutgoingCall("H264");
solo.sleep(1000);
}
public void testQOutgoingVideoCallMPG4() {
Context context = getActivity();
disableAllEnabledVideoCodecs();
solo.clickOnText(context.getString(R.string.pref_video_codec_mpeg4_title));
solo.goBack();
goToDialerAndOutgoingCall("MP4V-ES");
solo.sleep(1000);
}
@Override
public void tearDown() throws Exception {
if (solo.getCurrentActivity().getClass() == InCallActivity.class) {
solo.clickOnView(solo.getView(R.id.hangUp));
}
solo.finishOpenedActivities();
}
}

View file

@ -0,0 +1,457 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.InCallActivity;
import org.linphone.IncomingCallActivity;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCoreException;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
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;
/**
* @author Sylvain Berfini
*/
public class CallsAudio extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInit() {
//Disable video
goToSettings();
selectItemInListOnUIThread(3);
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_enable_title));
solo.sleep(500);
solo.goBack();
solo.sleep(1000);
Assert.assertFalse(LinphoneManager.getLc().isVideoEnabled());
}
@SmallTest
@MediumTest
@LargeTest
public void testBOutgoingCallWithDefaultConfig() {
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testCDTMFRFC2833InPCMUCall() {
disableAllEnabledAudioCodecs();
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
goBackToDialerAfterCodecChanges();
solo.sleep(1000);
LinphoneManager.getLc().setUseRfc2833ForDtmfs(true);
LinphoneManager.getLc().setUseSipInfoForDtmfs(false);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
//To enable when issue http://git.linphone.org/mantis/view.php?id=750 will be fixed
//Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
LinphoneTestManager.getInstance().isDTMFReceived = false;
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testDDTMFSIPINFO() {
LinphoneManager.getLc().setUseRfc2833ForDtmfs(false);
LinphoneManager.getLc().setUseSipInfoForDtmfs(true);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
//To enable when issue http://git.linphone.org/mantis/view.php?id=751 will be fixed
//Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
LinphoneTestManager.getInstance().isDTMFReceived = false;
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testEOutgoingCallToAudioClient() {
LinphoneTestManager.getLc().enableVideo(false, false);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testFOutgoingCallToVideoClient() {
LinphoneTestManager.getLc().enableVideo(true, true);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testGOutgoingCallCancelled() {
LinphoneTestManager.getInstance().autoAnswer = false;
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.sleep(2000);
Assert.assertEquals(LinphoneCall.State.OutgoingRinging, LinphoneManager.getLc().getCalls()[0].getState());
LinphoneTestManager.getInstance().autoAnswer = true;
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testHOutgoingCallDeclined() {
LinphoneTestManager.getInstance().autoAnswer = true; // Just in case
LinphoneTestManager.getInstance().declineCall = true;
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.sleep(500);
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.error_call_declined)));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
LinphoneTestManager.getInstance().declineCall = false;
}
@SmallTest
@MediumTest
@LargeTest
public void testIIncomingAudioCall() {
LinphoneTestManager.getInstance().declineCall = false; // Just in case
LinphoneTestManager.getLc().enableVideo(false, false);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
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);
assertCallIsCorrectlyRunning();
}
@LargeTest
public void testJIncomingVideoCall() {
LinphoneTestManager.getLc().enableVideo(true, true);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
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);
assertCallIsCorrectlyRunning();
}
@MediumTest
@LargeTest
public void testKSelfPauseResumeCall() {
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.pause));
LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
solo.sleep(1000);
Assert.assertTrue(LinphoneCall.State.Paused == state || LinphoneCall.State.Pausing == state);
solo.clickOnView(solo.getView(org.linphone.R.id.pause));
solo.sleep(1000);
state = LinphoneManager.getLc().getCalls()[0].getState();
Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testLRemotePauseResumeCall() {
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));
assertCallIsCorrectlyRunning();
LinphoneTestManager.getLc().pauseAllCalls();
solo.sleep(1000);
Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneManager.getLc().getCalls()[0].getState());
LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]);
solo.sleep(1000);
LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
solo.clickLongOnScreen(200, 200); //To ensure controls are shown
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@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));
solo.clickOnView(solo.getView(org.linphone.R.id.Call));
assertCallIsCorrectlyRunning();
Assert.assertFalse(solo.getView(org.linphone.R.id.video).isEnabled());
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@LargeTest
public void testNDeclineIncomingCall() {
LinphoneTestManager.getInstance().declineCall = false; // Just in case
LinphoneTestManager.getLc().enableVideo(false, false);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
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(topLayout.getMeasuredWidth() - 10, 10, slidersTop, slidersTop, 10);
}
@MediumTest
@LargeTest
public void testOCancelledIncomingCall() {
LinphoneTestManager.getInstance().declineCall = false; // Just in case
LinphoneTestManager.getLc().enableVideo(false, false);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
LinphoneTestManager.getLc().terminateAllCalls();
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testPDisplayMissedCallsNumber() {
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
Assert.assertTrue(solo.searchText("1"));
}
//TODO: Test each audio codec
private void assertCallIsCorrectlyRunning() {
solo.waitForActivity("InCallActivity", 5000);
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.sleep(2000);
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
if (call.getState() == LinphoneCall.State.OutgoingProgress) {
solo.sleep(3000);
}
Assert.assertEquals(LinphoneCall.State.StreamsRunning, call.getState());
}
private void goToSettings() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
}
private void goToAudioCodecsSettings() {
goToSettings();
selectItemInListOnUIThread(4);
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_audio));
solo.sleep(500);
}
private void disableAllEnabledAudioCodecs() {
goToAudioCodecsSettings();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex16_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex16));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex8_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex8));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_ilbc_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_ilbc_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_ilbc));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amr_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amr_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amr));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amrwb_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amrwb_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amrwb));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g729_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g729_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g729));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_gsm_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_gsm_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_gsm));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g722_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g722_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g722));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk24_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk24_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk24));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk16_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk16));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcmu_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcmu_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcma_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcma_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcma));
solo.sleep(500);
}
}
private void goBackToDialerAfterCodecChanges() {
solo.goBack();
solo.goBack();
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
}

View file

@ -0,0 +1,435 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.InCallActivity;
import org.linphone.IncomingCallActivity;
import org.linphone.LinphoneActivity;
import org.linphone.LinphoneManager;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCoreException;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
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;
/**
* @author Sylvain Berfini
*/
public class CallsVideo extends SampleTest {
@SmallTest
@MediumTest
@LargeTest
public void testAInit() {
//Disable video
goToSettings();
selectItemInListOnUIThread(3);
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_enable_title));
solo.sleep(500);
solo.goBack();
solo.sleep(1000);
Assert.assertTrue(LinphoneManager.getLc().isVideoEnabled());
}
@SmallTest
@MediumTest
@LargeTest
public void testBOutgoingCallWithDefaultConfig() {
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testCDTMFRFC2833InPCMUCall() {
disableAllEnabledAudioCodecs();
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
goBackToDialerAfterCodecChanges();
solo.sleep(1000);
LinphoneManager.getLc().setUseRfc2833ForDtmfs(true);
LinphoneManager.getLc().setUseSipInfoForDtmfs(false);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
//To enable when issue http://git.linphone.org/mantis/view.php?id=750 will be fixed
//Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
LinphoneTestManager.getInstance().isDTMFReceived = false;
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testDDTMFSIPINFO() {
LinphoneManager.getLc().setUseRfc2833ForDtmfs(false);
LinphoneManager.getLc().setUseSipInfoForDtmfs(true);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.clickOnView(solo.getView(org.linphone.R.id.Digit3));
solo.clickOnView(solo.getView(org.linphone.R.id.dialer));
solo.sleep(1000);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
//To enable when issue http://git.linphone.org/mantis/view.php?id=751 will be fixed
//Assert.assertTrue(LinphoneTestManager.getInstance().isDTMFReceived);
LinphoneTestManager.getInstance().isDTMFReceived = false;
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testEOutgoingCallToAudioClient() {
LinphoneTestManager.getLc().enableVideo(false, false);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testFOutgoingCallToVideoClient() {
LinphoneTestManager.getLc().enableVideo(true, true);
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testGOutgoingCallCancelled() {
LinphoneTestManager.getInstance().autoAnswer = false;
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.sleep(2000);
Assert.assertEquals(LinphoneCall.State.OutgoingRinging, LinphoneManager.getLc().getCalls()[0].getState());
LinphoneTestManager.getInstance().autoAnswer = true;
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testHOutgoingCallDeclined() {
LinphoneTestManager.getInstance().autoAnswer = true; // Just in case
LinphoneTestManager.getInstance().declineCall = true;
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.sleep(500);
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.error_call_declined)));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
LinphoneTestManager.getInstance().declineCall = false;
}
@LargeTest
public void testIIncomingAudioCall() {
LinphoneTestManager.getInstance().declineCall = false; // Just in case
LinphoneTestManager.getLc().enableVideo(false, false);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
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);
assertCallIsCorrectlyRunning();
}
@MediumTest
@LargeTest
public void testJIncomingVideoCall() {
LinphoneTestManager.getLc().enableVideo(true, true);
solo.sleep(2000);
try {
LinphoneTestManager.getLc().invite("sip:" + iContext.getString(org.linphone.test.R.string.account_linphone_login) + "@" + iContext.getString(org.linphone.test.R.string.account_linphone_domain));
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
solo.waitForActivity("IncomingCallActivity", 5000);
solo.assertCurrentActivity("Expected Incoming Call Activity", IncomingCallActivity.class);
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);
assertCallIsCorrectlyRunning();
}
//TODO: Test each video codec
@MediumTest
@LargeTest
public void testKSelfPauseResumeCall() {
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));
assertCallIsCorrectlyRunning();
solo.clickOnView(solo.getView(org.linphone.R.id.pause));
LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
solo.sleep(1000);
Assert.assertTrue(LinphoneCall.State.Paused == state || LinphoneCall.State.Pausing == state);
solo.clickOnView(solo.getView(org.linphone.R.id.pause));
solo.sleep(1000);
state = LinphoneManager.getLc().getCalls()[0].getState();
Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testLRemotePauseResumeCall() {
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));
assertCallIsCorrectlyRunning();
LinphoneTestManager.getLc().pauseAllCalls();
solo.sleep(1000);
Assert.assertEquals(LinphoneCall.State.PausedByRemote, LinphoneManager.getLc().getCalls()[0].getState());
LinphoneTestManager.getLc().resumeCall(LinphoneTestManager.getLc().getCalls()[0]);
solo.sleep(1000);
LinphoneCall.State state = LinphoneManager.getLc().getCalls()[0].getState();
Assert.assertTrue(LinphoneCall.State.Resuming == state || LinphoneCall.State.StreamsRunning == state);
solo.clickLongOnScreen(200, 200); //To ensure controls are shown
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
@MediumTest
@LargeTest
public void testMSwitchOffVideoInCall() {
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));
assertCallIsCorrectlyRunning();
Assert.assertTrue(solo.getView(org.linphone.R.id.video).isEnabled());
solo.clickOnView(solo.getView(org.linphone.R.id.video));
Assert.assertFalse(LinphoneManager.getLc().getCurrentCall().cameraEnabled());
solo.clickOnView(solo.getView(org.linphone.R.id.hangUp));
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
private void assertCallIsCorrectlyRunning() {
solo.waitForActivity("InCallActivity", 5000);
solo.assertCurrentActivity("Expected InCall Activity", InCallActivity.class);
solo.sleep(2000);
LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
if (call.getState() == LinphoneCall.State.OutgoingProgress) {
solo.sleep(3000);
}
Assert.assertEquals(LinphoneCall.State.StreamsRunning, call.getState());
}
private void goToSettings() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(org.linphone.R.id.settings));
}
private void goToAudioCodecsSettings() {
goToSettings();
selectItemInListOnUIThread(4);
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_audio));
solo.sleep(500);
}
private void goToVideoCodecsSettings() {
goToSettings();
selectItemInListOnUIThread(6);
if (solo.searchText(aContext.getString(org.linphone.R.string.pref_video), 2)) // Needed in case pref_video_enable_title contains pref_video
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video), 2);
else
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video));
solo.sleep(500);
}
private void disableAllEnabledAudioCodecs() {
goToAudioCodecsSettings();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex16_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex16));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_speex8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_speex8_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_speex8));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_ilbc_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_ilbc_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_ilbc));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amr_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amr_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amr));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_amrwb_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_amrwb_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_amrwb));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g729_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g729_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g729));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_gsm_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_gsm_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_gsm));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_g722_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_g722_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_g722));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk24_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk24_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk24));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_silk16_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_silk16_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_silk16));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcmu_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcmu_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcmu));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_codec_pcma_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_codec_pcma_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_codec_pcma));
solo.sleep(500);
}
}
private void disableAllEnabledVideoCodecs() {
goToVideoCodecsSettings();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(aContext);
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_vp8_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_vp8_title));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_h264_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_h264_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_h264_title));
solo.sleep(500);
}
if (prefs.getBoolean(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_key), aContext.getResources().getBoolean(org.linphone.R.bool.pref_video_codec_mpeg4_default))) {
solo.clickOnText(aContext.getString(org.linphone.R.string.pref_video_codec_mpeg4_title));
solo.sleep(500);
}
}
private void goBackToDialerAfterCodecChanges()
{
solo.goBack();
solo.goBack();
solo.waitForActivity("LinphoneActivity", 5000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
}
}

View file

@ -0,0 +1,105 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.LinphoneActivity;
import org.linphone.core.LinphoneChatMessage;
import org.linphone.core.LinphoneChatMessage.State;
import org.linphone.core.LinphoneChatRoom;
import org.linphone.mediastream.Log;
import android.test.suitebuilder.annotation.LargeTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.test.suitebuilder.annotation.SmallTest;
/**
* @author Sylvain Berfini
*/
public class Chat extends SampleTest {
@LargeTest
public void testBEmptyChatHistory() {
goToChat();
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
}
@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.clickOnView(solo.getView(org.linphone.R.id.newDiscussion));
solo.enterText(0, iContext.getString(R.string.chat_test_text_sent));
solo.clickOnView(solo.getView(org.linphone.R.id.sendMessage));
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);
}
@LargeTest
public void testDNotEmptyChatHistory() {
goToChat();
Assert.assertTrue(solo.searchText(iContext.getString(org.linphone.test.R.string.account_test_calls_login)));
}
@SmallTest
@MediumTest
@LargeTest
public void testEReceiveTextMessage() {
goToChat();
solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
LinphoneChatRoom chatRoom = LinphoneTestManager.getLc().createChatRoom("sip:" + iContext.getString(R.string.account_linphone_login) + "@" + iContext.getString(R.string.account_linphone_domain));
LinphoneChatMessage msg = chatRoom.createLinphoneChatMessage(iContext.getString(R.string.chat_test_text_received));
chatRoom.sendMessage(msg, new LinphoneChatMessage.StateListener() {
@Override
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg,
State state) {
Log.e("Chat message state = " + state.toString());
}
});
solo.sleep(1000);
Assert.assertTrue(solo.searchText(iContext.getString(R.string.chat_test_text_received)));
}
@MediumTest
@LargeTest
public void testFDeleteMessage() {
goToChat();
solo.clickOnText(iContext.getString(org.linphone.test.R.string.account_test_calls_login));
solo.clickLongOnText(iContext.getString(R.string.chat_test_text_received));
solo.clickOnText(aContext.getString(org.linphone.R.string.delete));
solo.sleep(1000);
Assert.assertFalse(solo.searchText(iContext.getString(R.string.chat_test_text_received)));
}
@MediumTest
@LargeTest
public void testGDeleteConversation() {
goToChat();
solo.clickOnText(aContext.getString(org.linphone.R.string.button_edit));
solo.clickOnView(solo.getView(org.linphone.R.id.delete));
solo.clickOnText(aContext.getString(org.linphone.R.string.button_ok));
solo.sleep(1000);
Assert.assertTrue(solo.searchText(aContext.getString(org.linphone.R.string.no_chat_history)));
}
private void goToChat() {
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(org.linphone.R.id.chat));
}
}

View file

@ -1,138 +0,0 @@
package org.linphone.test;
import junit.framework.Assert;
import org.linphone.LinphoneActivity;
import org.linphone.R;
import android.content.Context;
import android.test.ActivityInstrumentationTestCase2;
import android.widget.EditText;
import com.jayway.android.robotium.solo.Solo;
public class ChatTest extends ActivityInstrumentationTestCase2<LinphoneActivity> {
private static final String testTextMessage = "Test";
private Solo solo;
@SuppressWarnings("deprecation")
public ChatTest() {
super("org.linphone", LinphoneActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
solo = new Solo(getInstrumentation(), getActivity());
}
public void testADisplayEmptyChatList() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.chat));
Assert.assertTrue(solo.searchText(context.getString(R.string.no_chat_history)));
Log.testSuccess("Empty chat list displayed");
}
public void testBStartConversationAndSaveItAsDraft() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.chat));
solo.enterText((EditText) solo.getView(R.id.newFastChat), "cotcot@sip.linphone.org");
solo.clickOnText(context.getString(R.string.button_new_chat));
solo.sleep(1000);
solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
solo.goBack();
solo.sleep(1000);
Assert.assertTrue(solo.searchText(context.getString(R.string.draft)));
Log.testSuccess("Conversation created and message saved as draft");
}
public void testCUseSavedDraftMessageAndSentIt() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.chat));
solo.clickOnText(context.getString(R.string.draft));
Assert.assertTrue(solo.searchText(testTextMessage));
Log.testSuccess("Draft successfully restored");
solo.clickOnText(context.getString(R.string.button_send_message));
solo.sleep(1000);
Assert.assertTrue(solo.searchText(testTextMessage));
Log.testSuccess("Chat message sent");
solo.goBack();
solo.sleep(1000);
Assert.assertTrue(solo.searchText("cotcot"));
Assert.assertFalse(solo.searchText(context.getString(R.string.draft), true));
Log.testSuccess("Conversation created but no more saved as draft");
}
public void testDDeleteMessage() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.chat));
solo.clickOnText("cotcot");
Assert.assertTrue(solo.searchText(testTextMessage));
solo.clickLongOnText(testTextMessage);
solo.sleep(1000);
solo.clickOnText(context.getString(R.string.delete));
solo.sleep(1000);
Assert.assertFalse(solo.searchText(testTextMessage));
Log.testSuccess("Chat message successfully deleted");
}
public void testEIncomingMessageAndDeleteConversation() {
Context context = getActivity();
solo.waitForActivity("LinphoneActivity", 2000);
solo.assertCurrentActivity("Expected Linphone Activity", LinphoneActivity.class);
solo.clickOnView(solo.getView(R.id.chat));
solo.enterText((EditText) solo.getView(R.id.newFastChat), "junit");
solo.clickOnText(context.getString(R.string.button_new_chat));
solo.sleep(1000);
solo.enterText((EditText) solo.getView(R.id.message), testTextMessage);
solo.clickOnText(context.getString(R.string.button_send_message));
solo.sleep(1000);
Assert.assertTrue(solo.searchText(testTextMessage, 2));
Log.testSuccess("Chat message successfully received");
solo.goBack();
Assert.assertTrue(solo.searchText("junit", 2));
solo.clickOnView(solo.getView(R.id.clearFastChatField));
EditText fastChat = (EditText) solo.getView(R.id.newFastChat);
Assert.assertEquals(fastChat.getText().toString(), "");
Log.testSuccess("Fast new chat cleaned");
solo.clickOnText(context.getString(R.string.button_edit));
solo.clickOnText("junit");
solo.clickOnText(context.getString(R.string.button_ok));
solo.sleep(1000);
Assert.assertTrue(solo.searchText(context.getString(R.string.no_chat_history)));
Log.testSuccess("Conversation successfully deleted");
}
@Override
public void tearDown() throws Exception {
solo.finishOpenedActivities();
}
}

Some files were not shown because too many files have changed in this diff Show more