Fix for ringtone + improved Makefile for tests
This commit is contained in:
parent
485ae02ee1
commit
61b727d36b
5 changed files with 50 additions and 53 deletions
20
Makefile
20
Makefile
|
@ -338,24 +338,12 @@ run-linphone:
|
||||||
ant run
|
ant run
|
||||||
|
|
||||||
run-basic-tests:
|
run-basic-tests:
|
||||||
ant partial-clean && \
|
ant partial-clean
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
$(MAKE) -C tests
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
|
||||||
@cd $(TOPDIR)/tests/ && \
|
|
||||||
$(SDK_PATH)/android update test-project --path . -m ../ && \
|
|
||||||
ant debug && \
|
|
||||||
ant installd && \
|
|
||||||
adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner
|
|
||||||
|
|
||||||
run-all-tests:
|
run-all-tests:
|
||||||
ant partial-clean && \
|
ant partial-clean
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
$(MAKE) -C tests
|
||||||
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
|
||||||
@cd $(TOPDIR)/tests/ && \
|
|
||||||
$(SDK_PATH)/android update test-project --path . -m ../ && \
|
|
||||||
ant debug && \
|
|
||||||
ant installd && \
|
|
||||||
adb shell am instrument -w -e size large org.linphone.test/android.test.InstrumentationTestRunner
|
|
||||||
|
|
||||||
clean-ndk-build:
|
clean-ndk-build:
|
||||||
$(NDK_PATH)/ndk-build clean $(LIBLINPHONE_OPTIONS)
|
$(NDK_PATH)/ndk-build clean $(LIBLINPHONE_OPTIONS)
|
||||||
|
|
|
@ -26,6 +26,7 @@ import static org.linphone.core.LinphoneCall.State.Error;
|
||||||
import static org.linphone.core.LinphoneCall.State.IncomingReceived;
|
import static org.linphone.core.LinphoneCall.State.IncomingReceived;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -95,6 +96,7 @@ import android.media.AudioManager;
|
||||||
import android.media.MediaPlayer;
|
import android.media.MediaPlayer;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.PowerManager.WakeLock;
|
import android.os.PowerManager.WakeLock;
|
||||||
|
@ -579,7 +581,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
mLc.setZrtpSecretsCache(basePath + "/zrtp_secrets");
|
mLc.setZrtpSecretsCache(basePath + "/zrtp_secrets");
|
||||||
|
|
||||||
mLc.setRing(mPrefs.getRingtone(null));
|
mLc.setRing(null);
|
||||||
mLc.setRootCA(mLinphoneRootCaFile);
|
mLc.setRootCA(mLinphoneRootCaFile);
|
||||||
mLc.setPlayFile(mPauseSoundFile);
|
mLc.setPlayFile(mPauseSoundFile);
|
||||||
mLc.setChatDatabasePath(mChatDatabaseFile);
|
mLc.setChatDatabasePath(mChatDatabaseFile);
|
||||||
|
@ -1031,7 +1033,20 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
requestAudioFocus();
|
requestAudioFocus();
|
||||||
mRingerPlayer = new MediaPlayer();
|
mRingerPlayer = new MediaPlayer();
|
||||||
mRingerPlayer.setAudioStreamType(STREAM_RING);
|
mRingerPlayer.setAudioStreamType(STREAM_RING);
|
||||||
mListenerDispatcher.onRingerPlayerCreated(mRingerPlayer);
|
|
||||||
|
String ringtone = LinphonePreferences.instance().getRingtone(android.provider.Settings.System.DEFAULT_RINGTONE_URI.toString());
|
||||||
|
try {
|
||||||
|
if (ringtone.startsWith("content://")) {
|
||||||
|
mRingerPlayer.setDataSource(mServiceContext, Uri.parse(ringtone));
|
||||||
|
} else {
|
||||||
|
FileInputStream fis = new FileInputStream(ringtone);
|
||||||
|
mRingerPlayer.setDataSource(fis.getFD());
|
||||||
|
fis.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Log.e(e, "Cannot set ringtone");
|
||||||
|
}
|
||||||
|
|
||||||
mRingerPlayer.prepare();
|
mRingerPlayer.prepare();
|
||||||
mRingerPlayer.setLooping(true);
|
mRingerPlayer.setLooping(true);
|
||||||
mRingerPlayer.start();
|
mRingerPlayer.start();
|
||||||
|
@ -1297,10 +1312,6 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRingerPlayerCreated(MediaPlayer mRingerPlayer) {
|
|
||||||
if (serviceListener != null) serviceListener.onRingerPlayerCreated(mRingerPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tryingNewOutgoingCallButAlreadyInCall() {
|
public void tryingNewOutgoingCallButAlreadyInCall() {
|
||||||
if (serviceListener != null) serviceListener.tryingNewOutgoingCallButAlreadyInCall();
|
if (serviceListener != null) serviceListener.tryingNewOutgoingCallButAlreadyInCall();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
@ -51,7 +49,6 @@ import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.net.wifi.WifiManager.WifiLock;
|
import android.net.wifi.WifiManager.WifiLock;
|
||||||
|
@ -611,21 +608,6 @@ public final class LinphoneService extends Service implements LinphoneServiceLis
|
||||||
void onCallStateChanged(LinphoneCall call, State state, String message);
|
void onCallStateChanged(LinphoneCall call, State state, String message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRingerPlayerCreated(MediaPlayer mRingerPlayer) {
|
|
||||||
String uriString = LinphonePreferences.instance().getRingtone(android.provider.Settings.System.DEFAULT_RINGTONE_URI.toString());
|
|
||||||
try {
|
|
||||||
if (uriString.startsWith("content://")) {
|
|
||||||
mRingerPlayer.setDataSource(this, Uri.parse(uriString));
|
|
||||||
} else {
|
|
||||||
FileInputStream fis = new FileInputStream(uriString);
|
|
||||||
mRingerPlayer.setDataSource(fis.getFD());
|
|
||||||
fis.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(e, "Cannot set ringtone");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void tryingNewOutgoingCallButAlreadyInCall() {
|
public void tryingNewOutgoingCallButAlreadyInCall() {
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.linphone.core.LinphoneCore.GlobalState;
|
||||||
import org.linphone.core.LinphoneCore.RegistrationState;
|
import org.linphone.core.LinphoneCore.RegistrationState;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.media.MediaPlayer;
|
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
|
||||||
|
@ -41,7 +40,6 @@ public interface LinphoneSimpleListener {
|
||||||
void tryingNewOutgoingCallButWrongDestinationAddress();
|
void tryingNewOutgoingCallButWrongDestinationAddress();
|
||||||
void tryingNewOutgoingCallButAlreadyInCall();
|
void tryingNewOutgoingCallButAlreadyInCall();
|
||||||
void onRegistrationStateChanged(RegistrationState state, String message);
|
void onRegistrationStateChanged(RegistrationState state, String message);
|
||||||
void onRingerPlayerCreated(MediaPlayer mRingerPlayer);
|
|
||||||
void onDisplayStatus(String message);
|
void onDisplayStatus(String message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
tests/Makefile
Normal file
18
tests/Makefile
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
SDK_PATH=$(shell dirname `which android`)
|
||||||
|
SDK_PLATFORM_TOOLS_PATH=$(shell dirname `which adb`)
|
||||||
|
|
||||||
|
run-basic-tests:
|
||||||
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
||||||
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
||||||
|
$(SDK_PATH)/android update test-project --path . -m ../
|
||||||
|
ant debug
|
||||||
|
ant installd
|
||||||
|
adb shell am instrument -w -e size small org.linphone.test/android.test.InstrumentationTestRunner
|
||||||
|
|
||||||
|
run-all-tests:
|
||||||
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone.test
|
||||||
|
$(SDK_PLATFORM_TOOLS_PATH)/adb uninstall org.linphone
|
||||||
|
$(SDK_PATH)/android update test-project --path . -m ../
|
||||||
|
ant debug
|
||||||
|
ant installd
|
||||||
|
adb shell am instrument -w -e size large org.linphone.test/android.test.InstrumentationTestRunner
|
Loading…
Reference in a new issue