Incall view.

Hack for Audio with Galaxy S
This commit is contained in:
Guillaume Beraudo 2011-02-28 11:55:52 +01:00
parent 5ffaf9c434
commit 2b84ac3ee4
4 changed files with 87 additions and 4 deletions

75
Hacks.java Normal file
View file

@ -0,0 +1,75 @@
/*
Hacks.java
Copyright (C) 2010 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.
*/
package org.linphone.core;
import android.media.AudioManager;
import android.os.Build;
import android.util.Log;
public class Hacks {
private Hacks() {}
public static boolean isGalaxyS() {
return Build.DEVICE.startsWith("GT-I9000") || Build.DEVICE.startsWith("GT-P1000");
}
/* private static final boolean log(final String msg) {
Log.d("Linphone", msg);
return true;
}*/
/* Not working as now
* Calling from Galaxy S to PC is "usable" even with no hack; other side is not even with this one*/
public static void galaxySSwitchToCallStreamUnMuteLowerVolume(AudioManager am) {
// Switch to call audio channel (Galaxy S)
am.setSpeakerphoneOn(false);
sleep(200);
// Lower volume
am.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 1, 0);
// Another way to select call channel
am.setMode(AudioManager.MODE_NORMAL);
sleep(200);
// Mic is muted if not doing this
am.setMicrophoneMute(true);
sleep(200);
am.setMicrophoneMute(false);
sleep(200);
}
private static final void sleep(int time) {
try {
Thread.sleep(time);
} catch(InterruptedException ie){}
}
public static void dumpDeviceInformation() {
StringBuilder sb = new StringBuilder(" ==== Phone information dump ====\n");
sb.append("DEVICE=").append(Build.DEVICE).append("\n");
sb.append("MODEL=").append(Build.MODEL).append("\n");
//MANUFACTURER doesn't exist in android 1.5.
//sb.append("MANUFACTURER=").append(Build.MANUFACTURER).append("\n");
sb.append("SDK=").append(Build.VERSION.SDK);
Log.d("Linphone", sb.toString());
}
}

View file

@ -36,6 +36,7 @@ class LinphoneCallImpl implements LinphoneCall {
private native void enableEchoLimiter(long nativePtr,boolean enable);
private native boolean isEchoLimiterEnabled(long nativePtr);
private native long getReplacedCall(long nativePtr);
private native int getDuration(long nativePtr);
protected LinphoneCallImpl(long aNativePtr) {
nativePtr = aNativePtr;
@ -96,5 +97,9 @@ class LinphoneCallImpl implements LinphoneCall {
}
return null;
}
public int getDuration() {
return getDuration(nativePtr);
}
}

View file

@ -64,7 +64,7 @@ class LinphoneCoreImpl implements LinphoneCore {
private native void enableEchoCancellation(long nativePtr,boolean enable);
private native boolean isEchoCancellationEnabled(long nativePtr);
private native long getCurrentCall(long nativePtr) ;
private native void playDtmf(long nativePtr,char dtmf,int duration, boolean speaker);
private native void playDtmf(long nativePtr,char dtmf,int duration);
private native void stopDtmf(long nativePtr);
private native void setVideoWindowId(long nativePtr, Object wid);
private native void setPreviewWindowId(long nativePtr, Object wid);
@ -298,8 +298,8 @@ class LinphoneCoreImpl implements LinphoneCore {
// TODO Auto-generated method stub
return false;
}
public void playDtmf(char number, int duration, boolean speaker) {
playDtmf(nativePtr,number, duration, speaker);
public void playDtmf(char number, int duration) {
playDtmf(nativePtr,number, duration);
}
public void stopDtmf() {
@ -439,4 +439,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public void startEchoCalibration(Object data) throws LinphoneCoreException {
startEchoCalibration(nativePtr, data);
}
public Transport getSignalingTransport() {
throw new RuntimeException("Not implemented");
}
}

View file

@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core.video;
import org.linphone.Hacks;
import org.linphone.core.Hacks;
import android.util.Log;