Some fixes
This commit is contained in:
parent
4f07e0da05
commit
30d294466b
3 changed files with 21 additions and 10 deletions
|
@ -32,12 +32,11 @@ import android.os.Build;
|
||||||
*/
|
*/
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
public class BluetoothManager extends BroadcastReceiver {
|
public class BluetoothManager extends BroadcastReceiver {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
LinphoneManager lm = LinphoneManager.getInstance();
|
LinphoneManager lm = LinphoneManager.getInstance();
|
||||||
|
|
||||||
String actionScoConnected = AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED;
|
|
||||||
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
|
if (BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)) {
|
||||||
Log.e("Bluetooth Received Event" + " ACTION_ACL_DISCONNECTED" );
|
Log.e("Bluetooth Received Event" + " ACTION_ACL_DISCONNECTED" );
|
||||||
|
|
||||||
|
@ -53,7 +52,7 @@ public class BluetoothManager extends BroadcastReceiver {
|
||||||
lm.scoConnected();
|
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);
|
int state = intent.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
||||||
Log.e("Bluetooth sco state changed : " + state);
|
Log.e("Bluetooth sco state changed : " + state);
|
||||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||||
|
|
|
@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
package org.linphone;
|
package org.linphone;
|
||||||
|
|
||||||
import static android.media.AudioManager.MODE_NORMAL;
|
|
||||||
import static android.media.AudioManager.MODE_RINGTONE;
|
import static android.media.AudioManager.MODE_RINGTONE;
|
||||||
import static android.media.AudioManager.STREAM_RING;
|
import static android.media.AudioManager.STREAM_RING;
|
||||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||||
|
@ -253,6 +252,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void startBluetooth() {
|
public void startBluetooth() {
|
||||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
if (mBluetoothAdapter.isEnabled()) {
|
if (mBluetoothAdapter.isEnabled()) {
|
||||||
|
@ -277,9 +277,11 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
};
|
};
|
||||||
mBluetoothAdapter.getProfileProxy(mServiceContext, mProfileListener, BluetoothProfile.HEADSET);
|
mBluetoothAdapter.getProfileProxy(mServiceContext, mProfileListener, BluetoothProfile.HEADSET);
|
||||||
} else {
|
} else {
|
||||||
@SuppressWarnings("deprecation")
|
try {
|
||||||
String actionScoConnected = AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED;
|
mServiceContext.unregisterReceiver(bluetoothReiceiver);
|
||||||
Intent currentValue = mServiceContext.registerReceiver(bluetoothReiceiver, new IntentFilter(actionScoConnected));
|
} 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);
|
int state = currentValue == null ? 0 : currentValue.getIntExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, 0);
|
||||||
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
if (state == AudioManager.SCO_AUDIO_STATE_CONNECTED) {
|
||||||
isBluetoothScoConnected = true;
|
isBluetoothScoConnected = true;
|
||||||
|
@ -970,6 +972,10 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
chatStorage.close();
|
chatStorage.close();
|
||||||
chatStorage = null;
|
chatStorage = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
mServiceContext.unregisterReceiver(bluetoothReiceiver);
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30))
|
if (Version.sdkAboveOrEqual(Version.API11_HONEYCOMB_30))
|
||||||
|
@ -1226,7 +1232,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
TelephonyManager tm = (TelephonyManager) activity.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) {
|
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 {
|
} else {
|
||||||
Log.i("New call active while incall (CPU only) wake lock already active");
|
Log.i("New call active while incall (CPU only) wake lock already active");
|
||||||
}
|
}
|
||||||
|
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||||
}
|
}
|
||||||
mListenerDispatcher.onCallStateChanged(call, state, message);
|
mListenerDispatcher.onCallStateChanged(call, state, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.Compatibility;
|
||||||
import org.linphone.compatibility.CompatibilityScaleGestureDetector;
|
import org.linphone.compatibility.CompatibilityScaleGestureDetector;
|
||||||
import org.linphone.compatibility.CompatibilityScaleGestureListener;
|
import org.linphone.compatibility.CompatibilityScaleGestureListener;
|
||||||
|
import org.linphone.core.LinphoneCall;
|
||||||
import org.linphone.core.LinphoneCore;
|
import org.linphone.core.LinphoneCore;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
import org.linphone.mediastream.video.AndroidVideoWindowImpl;
|
||||||
|
@ -177,8 +178,12 @@ public class VideoCallFragment extends Fragment implements OnGestureListener, On
|
||||||
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
float landscapeZoomFactor = ((float) mVideoView.getWidth()) / (float) ((3 * mVideoView.getHeight()) / 4);
|
||||||
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));
|
mZoomFactor = Math.max(0.1f, Math.min(mZoomFactor, Math.max(portraitZoomFactor, landscapeZoomFactor)));
|
||||||
|
|
||||||
LinphoneManager.getLc().getCurrentCall().zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
LinphoneCall currentCall = LinphoneManager.getLc().getCurrentCall();
|
||||||
return true;
|
if (currentCall != null) {
|
||||||
|
currentCall.zoomVideo(mZoomFactor, mZoomCenterX, mZoomCenterY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue