Some fixes

This commit is contained in:
Sylvain Berfini 2013-05-31 11:28:53 +02:00
parent 4f07e0da05
commit 30d294466b
3 changed files with 21 additions and 10 deletions

View file

@ -37,7 +37,6 @@ public class BluetoothManager extends BroadcastReceiver {
String action = intent.getAction();
LinphoneManager lm = LinphoneManager.getInstance();
String actionScoConnected = AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED;
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
Log.e("Bluetooth Received Event" + " ACTION_ACL_DISCONNECTED" );
@ -53,7 +52,7 @@ public class BluetoothManager extends BroadcastReceiver {
lm.scoConnected();
}
}
else if (actionScoConnected.equals(action)) {
else if (AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED.equals(action)) {
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
Log.e("Bluetooth sco state changed : " + state);
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {

View file

@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone;
import static android.media.AudioManager.MODE_NORMAL;
import static android.media.AudioManager.MODE_RINGTONE;
import static android.media.AudioManager.STREAM_RING;
import static android.media.AudioManager.STREAM_VOICE_CALL;
@ -253,6 +252,7 @@ public class LinphoneManager implements LinphoneCoreListener {
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressWarnings("deprecation")
public void startBluetooth() {
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (mBluetoothAdapter.isEnabled()) {
@ -277,9 +277,11 @@ public class LinphoneManager implements LinphoneCoreListener {
};
mBluetoothAdapter.getProfileProxy(mServiceContext, mProfileListener, BluetoothProfile.HEADSET);
} else {
@SuppressWarnings("deprecation")
String actionScoConnected = AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED;
Intent currentValue = mServiceContext.registerReceiver(bluetoothReiceiver, new IntentFilter(actionScoConnected));
try {
mServiceContext.unregisterReceiver(bluetoothReiceiver);
} catch (Exception e) {}
Intent currentValue = mServiceContext.registerReceiver(bluetoothReiceiver, new IntentFilter(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED));
int state = currentValue == null ? 0 : currentValue.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
isBluetoothScoConnected = true;
@ -971,6 +973,10 @@ public class LinphoneManager implements LinphoneCoreListener {
chatStorage = null;
}
try {
mServiceContext.unregisterReceiver(bluetoothReiceiver);
} catch (Exception e) {}
try {
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30))
mBluetoothAdapter.closeProfileProxy(BluetoothProfile.HEADSET, mBluetoothHeadset);
@ -1226,7 +1232,7 @@ public class LinphoneManager implements LinphoneCoreListener {
if (activity != null) {
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
mAudioManager.setMode(MODE_NORMAL);
mAudioManager.setMode(AudioManager.MODE_NORMAL);
}
}
}
@ -1256,6 +1262,7 @@ public class LinphoneManager implements LinphoneCoreListener {
} else {
Log.i("New call active while incall (CPU only) wake lock already active");
}
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
}
mListenerDispatcher.onCallStateChanged(call, state, message);
}

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import org.linphone.compatibility.Compatibility;
import org.linphone.compatibility.CompatibilityScaleGestureDetector;
import org.linphone.compatibility.CompatibilityScaleGestureListener;
import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCore;
import org.linphone.mediastream.Log;
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
@ -177,9 +178,13 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
if (currentCall != null) {
currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
return true;
}
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {