Add new tests ui
This commit is contained in:
parent
674331ef4c
commit
48a3df183e
5 changed files with 291 additions and 532 deletions
20
build.gradle
20
build.gradle
|
@ -131,7 +131,7 @@ android {
|
|||
release.setRoot('build-types/release')
|
||||
}
|
||||
|
||||
/*sourceSets {
|
||||
sourceSets {
|
||||
androidTest {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
def srcDirs = submoduleDir
|
||||
|
@ -154,7 +154,23 @@ android {
|
|||
|
||||
debug.setRoot('build-types/debug')
|
||||
release.setRoot('build-types/release')
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
// Grant permissions
|
||||
android.applicationVariants.all { variant ->
|
||||
def applicationId = getPackageName()
|
||||
def adb = android.getAdbExe().toString()
|
||||
def variantName = variant.name.capitalize()
|
||||
def grantPermissionTask = tasks.create("grant${variantName}Permissions") << {
|
||||
"${adb} devices".execute().text.eachLine {
|
||||
"${adb} shell pm grant ${applicationId} android.permission.RECORD_AUDIO".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.CAMERA".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.READ_PHONE_STATE".execute()
|
||||
"${adb} shell pm grant ${applicationId} android.permission.READ_CONTACTS".execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task runApplication() {
|
||||
|
|
|
@ -373,7 +373,8 @@ run-liblinphone-tests:
|
|||
\t@cd liblinphone_tester && \\
|
||||
\tmake run-all-tests
|
||||
|
||||
run-all-tests: clean
|
||||
run-all-tests: clean install
|
||||
\t./gradlew grantDebugPermissions
|
||||
\t./gradlew connectedAndroidTest
|
||||
|
||||
pull-transifex:
|
||||
|
|
|
@ -0,0 +1,271 @@
|
|||
package org.linphone;
|
||||
|
||||
import android.support.test.espresso.ViewInteraction;
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
import org.hamcrest.Description;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.hamcrest.TypeSafeMatcher;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static android.support.test.espresso.Espresso.onData;
|
||||
import static android.support.test.espresso.Espresso.onView;
|
||||
import static android.support.test.espresso.Espresso.pressBack;
|
||||
import static android.support.test.espresso.action.ViewActions.click;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withParent;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withTagKey;
|
||||
import static android.support.test.espresso.matcher.ViewMatchers.withText;
|
||||
import static org.hamcrest.core.AllOf.allOf;
|
||||
|
||||
@LargeTest
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class LinphoneLauncherActivityTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<LinphoneLauncherActivity> mActivityTestRule = new ActivityTestRule<>(LinphoneLauncherActivity.class);
|
||||
|
||||
private void waitUi(long time) {
|
||||
try {
|
||||
Thread.sleep(time);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void launchActivity() {
|
||||
waitUi(2000);
|
||||
if (!LinphoneActivity.isInstanciated())
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuAudio() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
4),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuVideo() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
5),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuCall() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
6),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuChat() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
7),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuNetwork() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
8),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuAdvanced() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.menu_settings)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
1),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
childAtPosition(
|
||||
Matchers.allOf(
|
||||
withId(android.R.id.list),
|
||||
withParent(withId(R.id.topLayout))),
|
||||
9),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuAbout() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.about)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
2),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void MenuAssitant() {
|
||||
waitUi(2000);
|
||||
|
||||
LinphoneActivity.instance().displayDialer();
|
||||
|
||||
onView(withId(R.id.side_menu_button)).perform(click());
|
||||
|
||||
onView(Matchers.allOf(
|
||||
withId(R.id.item_name),
|
||||
withText(LinphoneActivity.instance().getString(R.string.assistant)),
|
||||
childAtPosition(
|
||||
withId(R.id.item_list),
|
||||
0),
|
||||
isDisplayed())).perform(click());
|
||||
|
||||
pressBack();
|
||||
}
|
||||
|
||||
private static Matcher<View> childAtPosition(
|
||||
final Matcher<View> parentMatcher, final int position) {
|
||||
|
||||
return new TypeSafeMatcher<View>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("Child at position " + position + " in parent ");
|
||||
parentMatcher.describeTo(description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchesSafely(View view) {
|
||||
ViewParent parent = view.getParent();
|
||||
return parent instanceof ViewGroup && parentMatcher.matches(parent)
|
||||
&& view.equals(((ViewGroup) parent).getChildAt(position));
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package org.linphone.ui.tester;
|
||||
|
||||
import org.linphone.LinphoneLauncherActivity;
|
||||
|
||||
/**
|
||||
* Created by ecroze on 27/04/17.
|
||||
*/
|
||||
|
||||
public class LinphoneDialerTester {
|
||||
/*@Rule
|
||||
public ActivityTestRule<LinphoneLauncherActivity> activityTestRule =
|
||||
new ActivityTestRule<>(MainActivity.class);
|
||||
|
||||
@Test
|
||||
public void validateEditText() {
|
||||
onView(withId(R.id.etInput)).perform(typeText("Hello")).check(matches(withText("Hello")));
|
||||
}*/
|
||||
}
|
|
@ -1,511 +0,0 @@
|
|||
package org.linphone.ui.tester;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import org.linphone.LinphoneException;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneManager.LinphoneConfigException;
|
||||
import org.linphone.LinphoneService;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAddress.TransportType;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
import org.linphone.core.LinphoneCall;
|
||||
import org.linphone.core.LinphoneCall.State;
|
||||
import org.linphone.core.LinphoneCallStats;
|
||||
import org.linphone.core.LinphoneChatMessage;
|
||||
import org.linphone.core.LinphoneChatRoom;
|
||||
import org.linphone.core.LinphoneContent;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCore.AuthMethod;
|
||||
import org.linphone.core.LinphoneCore.EcCalibratorStatus;
|
||||
import org.linphone.core.LinphoneCore.GlobalState;
|
||||
import org.linphone.core.LinphoneCore.MediaEncryption;
|
||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||
import org.linphone.core.LinphoneCore.RemoteProvisioningState;
|
||||
import org.linphone.core.LinphoneCore.Transports;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneCoreListener;
|
||||
import org.linphone.core.LinphoneCoreListenerBase;
|
||||
import org.linphone.core.LinphoneEvent;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneFriendList;
|
||||
import org.linphone.core.LinphoneInfoMessage;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.PublishState;
|
||||
import org.linphone.core.SubscriptionState;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration.AndroidCamera;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
public class LinphoneTestManager implements LinphoneCoreListener{
|
||||
|
||||
private static LinphoneTestManager instance;
|
||||
private Context mIContext;
|
||||
private LinphoneCore mLc1, mLc2;
|
||||
|
||||
public String lastMessageReceived;
|
||||
public boolean isDTMFReceived = false;
|
||||
public boolean autoAnswer = true;
|
||||
public boolean declineCall = false;
|
||||
|
||||
private final String linphoneRootCaFile;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
|
||||
private Timer mTimer1 = new Timer("Linphone scheduler 1");
|
||||
private Timer mTimer2 = new Timer("Linphone scheduler 2");
|
||||
|
||||
private LinphoneTestManager(Context ac, Context ic) {
|
||||
mIContext = ic;
|
||||
linphoneRootCaFile = ac.getFilesDir().getAbsolutePath() + "/rootca.pem";
|
||||
}
|
||||
|
||||
public static LinphoneTestManager createAndStart(Context ac, Context ic, int id) {
|
||||
if (instance == null)
|
||||
instance = new LinphoneTestManager(ac, ic);
|
||||
|
||||
instance.startLibLinphone(ic, id);
|
||||
TelephonyManager tm = (TelephonyManager) ac.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
|
||||
setGsmIdle(gsmIdle, id);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
private synchronized void startLibLinphone(Context c, int id) {
|
||||
try {
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester");
|
||||
|
||||
final LinphoneCore mLc = LinphoneCoreFactory.instance().createLinphoneCore(this, c);
|
||||
if (id == 2) {
|
||||
mLc2 = mLc;
|
||||
} else {
|
||||
mLc1 = mLc;
|
||||
}
|
||||
|
||||
mLc.setContext(c);
|
||||
try {
|
||||
String versionName = c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionName;
|
||||
if (versionName == null) {
|
||||
versionName = String.valueOf(c.getPackageManager().getPackageInfo(c.getPackageName(), 0).versionCode);
|
||||
}
|
||||
mLc.setUserAgent("LinphoneAndroid", versionName);
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(e, "cannot get version name");
|
||||
}
|
||||
|
||||
mLc.enableIpv6(false);
|
||||
mLc.setRing(null);
|
||||
mLc.setRootCA(linphoneRootCaFile);
|
||||
|
||||
int availableCores = Runtime.getRuntime().availableProcessors();
|
||||
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
|
||||
mLc.setCpuCount(availableCores);
|
||||
|
||||
Transports t = mLc.getSignalingTransportPorts();
|
||||
t.udp = -1;
|
||||
t.tcp = -1;
|
||||
mLc.setSignalingTransportPorts(t);
|
||||
|
||||
try {
|
||||
initFromConf(mLc);
|
||||
} catch (LinphoneException e) {
|
||||
Log.w("no config ready yet");
|
||||
}
|
||||
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mLc.iterate();
|
||||
}
|
||||
};
|
||||
|
||||
if (id == 2) {
|
||||
mTimer2.scheduleAtFixedRate(lTask, 0, 20);
|
||||
} else {
|
||||
mTimer1.scheduleAtFixedRate(lTask, 0, 20);
|
||||
}
|
||||
|
||||
resetCameraFromPreferences();
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.e(e, "Cannot start linphone");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetCameraFromPreferences() {
|
||||
boolean useFrontCam = true;
|
||||
int camId = 0;
|
||||
AndroidCamera[] cameras = AndroidCameraConfiguration.retrieveCameras();
|
||||
for (AndroidCamera androidCamera : cameras) {
|
||||
if (androidCamera.frontFacing == useFrontCam)
|
||||
camId = androidCamera.id;
|
||||
}
|
||||
LinphoneManager.getLc().setVideoDevice(camId);
|
||||
}
|
||||
|
||||
public void initFromConf(LinphoneCore mLc) throws LinphoneConfigException, LinphoneCoreException {
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, "LinphoneTester");
|
||||
|
||||
initAccounts(mLc);
|
||||
|
||||
mLc.setVideoPolicy(true, true);
|
||||
mLc.enableVideo(true, true);
|
||||
|
||||
mLc.setUseRfc2833ForDtmfs(false);
|
||||
mLc.setUseSipInfoForDtmfs(true);
|
||||
|
||||
mLc.setNetworkReachable(true);
|
||||
}
|
||||
|
||||
public boolean detectVideoCodec(String mime, LinphoneCore mLc) {
|
||||
for (PayloadType videoCodec : mLc.getVideoCodecs()) {
|
||||
if (mime.equals(videoCodec.getMime())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean detectAudioCodec(String mime, LinphoneCore mLc){
|
||||
for (PayloadType audioCodec : mLc.getAudioCodecs()) {
|
||||
if (mime.equals(audioCodec.getMime())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void initMediaEncryption(LinphoneCore mLc){
|
||||
MediaEncryption me = MediaEncryption.None;
|
||||
mLc.setMediaEncryption(me);
|
||||
}
|
||||
|
||||
private void initAccounts(LinphoneCore mLc) throws LinphoneCoreException {
|
||||
mLc.clearAuthInfos();
|
||||
mLc.clearProxyConfigs();
|
||||
|
||||
String username, password, domain;
|
||||
if (mLc.equals(mLc1)) {
|
||||
username = mIContext.getString(org.linphone.R.string.account_test_calls_login);
|
||||
password = mIContext.getString(org.linphone.R.string.account_test_calls_pwd);
|
||||
domain = mIContext.getString(org.linphone.R.string.account_test_calls_domain);
|
||||
} else {
|
||||
username = mIContext.getString(org.linphone.R.string.conference_account_login);
|
||||
password = mIContext.getString(org.linphone.R.string.conference_account_password);
|
||||
domain = mIContext.getString(org.linphone.R.string.conference_account_domain);
|
||||
}
|
||||
|
||||
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null, domain);
|
||||
mLc.addAuthInfo(lAuthInfo);
|
||||
String identity = "sip:" + username +"@" + domain;
|
||||
String proxy = "sip:" + domain;
|
||||
LinphoneAddress proxyAddr = LinphoneCoreFactory.instance().createLinphoneAddress(proxy);
|
||||
proxyAddr.setTransport(TransportType.LinphoneTransportTls);
|
||||
LinphoneProxyConfig proxycon = mLc.createProxyConfig(identity, proxyAddr.asStringUriOnly(), proxyAddr.asStringUriOnly(), true);
|
||||
mLc.addProxyConfig(proxycon);
|
||||
mLc.setDefaultProxyConfig(proxycon);
|
||||
|
||||
LinphoneProxyConfig lDefaultProxyConfig = mLc.getDefaultProxyConfig();
|
||||
if (lDefaultProxyConfig != null) {
|
||||
//escape +
|
||||
lDefaultProxyConfig.setDialEscapePlus(false);
|
||||
} else if (LinphoneService.isReady()) {
|
||||
getLc().addListener(this);
|
||||
this.registrationState(mLc, lDefaultProxyConfig, RegistrationState.RegistrationNone, null);
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized final LinphoneTestManager getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static synchronized final LinphoneCore getLc(int i) {
|
||||
if (i == 2)
|
||||
return getInstance().mLc2;
|
||||
return getInstance().mLc1;
|
||||
}
|
||||
|
||||
public static synchronized final LinphoneCore getLc() {
|
||||
return getLc(1);
|
||||
}
|
||||
|
||||
private int savedMaxCallWhileGsmIncall;
|
||||
private synchronized void preventSIPCalls(LinphoneCore mLc) {
|
||||
if (savedMaxCallWhileGsmIncall != 0) {
|
||||
Log.w("SIP calls are already blocked due to GSM call running");
|
||||
return;
|
||||
}
|
||||
savedMaxCallWhileGsmIncall = mLc.getMaxCalls();
|
||||
mLc.setMaxCalls(0);
|
||||
}
|
||||
private synchronized void allowSIPCalls(LinphoneCore mLc) {
|
||||
if (savedMaxCallWhileGsmIncall == 0) {
|
||||
Log.w("SIP calls are already allowed as no GSM call knowned to be running");
|
||||
return;
|
||||
}
|
||||
mLc.setMaxCalls(savedMaxCallWhileGsmIncall);
|
||||
savedMaxCallWhileGsmIncall = 0;
|
||||
}
|
||||
public static void setGsmIdle(boolean gsmIdle, int id) {
|
||||
LinphoneTestManager mThis = instance;
|
||||
if (mThis == null) return;
|
||||
if (gsmIdle) {
|
||||
mThis.allowSIPCalls(LinphoneTestManager.getLc(id));
|
||||
} else {
|
||||
mThis.preventSIPCalls(LinphoneTestManager.getLc(id));
|
||||
}
|
||||
}
|
||||
|
||||
private void doDestroy() {
|
||||
try {
|
||||
mTimer1.cancel();
|
||||
mTimer2.cancel();
|
||||
mLc1.destroy();
|
||||
mLc2.destroy();
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally {
|
||||
mLc1 = null;
|
||||
mLc2 = null;
|
||||
instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static synchronized void destroy() {
|
||||
if (instance == null) return;
|
||||
instance.doDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void globalState(LinphoneCore lc, GlobalState state, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callState(LinphoneCore lc, LinphoneCall call, State cstate,
|
||||
String message) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.e("Call state = " + cstate.toString());
|
||||
if (cstate == LinphoneCall.State.IncomingReceived) {
|
||||
if (declineCall) {
|
||||
lc.terminateCall(call);
|
||||
} else if (autoAnswer) {
|
||||
try {
|
||||
lc.acceptCall(call);
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callStatsUpdated(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneCallStats stats) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callEncryptionChanged(LinphoneCore lc, LinphoneCall call,
|
||||
boolean encrypted, String authenticationToken) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registrationState(LinphoneCore lc, LinphoneProxyConfig cfg,
|
||||
RegistrationState cstate, String smessage) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.e("Registration state = " + cstate.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newSubscriptionRequest(LinphoneCore lc, LinphoneFriend lf,
|
||||
String url) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr,
|
||||
LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.e("Message received = " + message.getText());
|
||||
lastMessageReceived = message.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dtmfReceived(LinphoneCore lc, LinphoneCall call, int dtmf) {
|
||||
// TODO Auto-generated method stub
|
||||
Log.e("DTMF received = " + dtmf);
|
||||
isDTMFReceived = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneAddress from, byte[] event) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(LinphoneCore lc) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayStatus(LinphoneCore lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayMessage(LinphoneCore lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayWarning(LinphoneCore lc, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferState(LinphoneCore lc, LinphoneCall call,
|
||||
State new_call_state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void infoReceived(LinphoneCore lc, LinphoneCall call,
|
||||
LinphoneInfoMessage info) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void subscriptionStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
SubscriptionState state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyReceived(LinphoneCore lc, LinphoneEvent ev,
|
||||
String eventName, LinphoneContent content) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void publishStateChanged(LinphoneCore lc, LinphoneEvent ev,
|
||||
PublishState state) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void isComposingReceived(LinphoneCore lc, LinphoneChatRoom cr) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configuringStatus(LinphoneCore lc,
|
||||
RemoteProvisioningState state, String message) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authInfoRequested(LinphoneCore lc, String realm,
|
||||
String username, String domain) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void authenticationRequested(LinphoneCore lc,
|
||||
LinphoneAuthInfo authInfo, AuthMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferProgressIndication(LinphoneCore lc,
|
||||
LinphoneChatMessage message, LinphoneContent content, int progress) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fileTransferRecv(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, byte[] buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fileTransferSend(LinphoneCore lc, LinphoneChatMessage message,
|
||||
LinphoneContent content, ByteBuffer buffer, int size) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadProgressIndication(LinphoneCore lc, int offset, int total) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void uploadStateChanged(LinphoneCore lc, LinphoneCore.LogCollectionUploadState state,
|
||||
String info) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ecCalibrationStatus(LinphoneCore lc, EcCalibratorStatus status,
|
||||
int delay_ms, Object data) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void friendListCreated(LinphoneCore lc, LinphoneFriendList list) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void friendListRemoved(LinphoneCore lc, LinphoneFriendList list) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void networkReachableChanged(LinphoneCore lc, boolean enable) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr,
|
||||
LinphoneChatMessage message) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue