Revert "Bluetooth headset support thanks to Doğancan Kefeli"
(breaks speaker mode on 2.x phones)
This reverts commit 0cee0e357b
.
Conflicts:
src/org/linphone/compatibility/Compatibility.java
This commit is contained in:
parent
cdbd2b4d65
commit
463ef84f1e
10 changed files with 23 additions and 67 deletions
|
@ -19,9 +19,6 @@
|
|||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.READ_LOGS" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<!-- Needed to use bluetooth headset -->
|
||||
<uses-permission android:name="android.permission.BLUETOOTH"/>
|
||||
<uses-permission android:name="android.permission.BROADCAST_STICKY"/>
|
||||
|
||||
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true"/>
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
<string name="first_launch_suceeded_once_key">first_launch_suceeded_once_key</string>
|
||||
|
||||
<string name="pref_wifi_only_key">pref_wifi_only_key</string>
|
||||
<string name="pref_use_bluetooth_if_available_key">pref_use_bluetooth_if_available_key</string>
|
||||
|
||||
<string name="pref_video_use_front_camera_key">pref_video_use_front_camera_key</string>
|
||||
<string name="pref_video_codec_h263_key">pref_video_codec_h263_key</string>
|
||||
|
|
|
@ -237,8 +237,6 @@
|
|||
|
||||
<string name="pref_sipaccounts">SIP Accounts</string>
|
||||
<string name="pref_wifi_only">Use wifi only</string>
|
||||
<string name="pref_use_bluetooth_if_available">Use bluetooth headset</string>
|
||||
<string name="pref_use_bluetooth_if_available_summary">Route incoming audio to bluetooth headset if available.</string>
|
||||
|
||||
<string name="wizard_failed">An error occurred, try again later.</string>
|
||||
<string name="wizard_server_unavailable">Server unreachable, verify your internet connection.</string>
|
||||
|
|
|
@ -58,14 +58,6 @@
|
|||
<PreferenceCategory
|
||||
android:title="@string/pref_audio">
|
||||
|
||||
<SwitchPreference
|
||||
android:key="@string/pref_use_bluetooth_if_available_key"
|
||||
android:defaultValue="true"
|
||||
android:switchTextOn="@string/yes"
|
||||
android:switchTextOff="@string/no"
|
||||
android:title="@string/pref_use_bluetooth_if_available"
|
||||
android:summary="@string/pref_use_bluetooth_if_available_summary"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_echo_limiter_key"
|
||||
android:title="@string/pref_echo_limiter"
|
||||
|
|
|
@ -40,10 +40,6 @@
|
|||
|
||||
|
||||
<PreferenceCategory android:title="@string/pref_audio">
|
||||
<CheckBoxPreference android:key="@string/pref_use_bluetooth_if_available_key"
|
||||
android:defaultValue="true"
|
||||
android:title="@string/pref_use_bluetooth_if_available" android:summary="@string/pref_use_bluetooth_if_available_summary"/>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_echo_limiter_key"
|
||||
android:title="@string/pref_echo_limiter" android:summary="@string/pref_echo_limiter_summary"/>
|
||||
|
||||
|
@ -146,7 +142,7 @@
|
|||
android:title="@string/pref_escape_plus"></CheckBoxPreference>
|
||||
|
||||
<CheckBoxPreference android:key="@string/pref_debug_key"
|
||||
android:title="@string/pref_debug" android:enabled="true"></CheckBoxPreference>
|
||||
android:title="@string/pref_debug" android:defaultValue="false"></CheckBoxPreference>
|
||||
|
||||
|
||||
<PreferenceScreen android:title="@string/pref_network_title">
|
||||
|
|
|
@ -49,7 +49,6 @@ import java.util.TimerTask;
|
|||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneOnAudioChangedListener.AudioState;
|
||||
import org.linphone.LinphoneSimpleListener.LinphoneServiceListener;
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.CallDirection;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneAuthInfo;
|
||||
|
@ -196,20 +195,17 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
private BroadcastReceiver mKeepAliveReceiver = new KeepAliveReceiver();
|
||||
|
||||
private native void hackSpeakerState(boolean speakerOn);
|
||||
private static void sRouteAudioToSpeakerOrBluetoothHelper(boolean speakerOn) {
|
||||
getInstance().routeAudioToSpeakerOrBluetoothHelper(speakerOn);
|
||||
private static void sRouteAudioToSpeakerHelperHelper(boolean speakerOn) {
|
||||
getInstance().routeAudioToSpeakerHelperHelper(speakerOn);
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
private void routeAudioToSpeakerOrBluetoothHelper(boolean speakerOn) {
|
||||
private void routeAudioToSpeakerHelperHelper(boolean speakerOn) {
|
||||
boolean different = isSpeakerOn() ^ speakerOn;
|
||||
if (!different) {
|
||||
Log.d("Skipping change audio route by the same route ",
|
||||
speakerOn ? "speaker" : "earpiece");
|
||||
return;
|
||||
}
|
||||
if (mPref.getBoolean(getString(R.string.pref_use_bluetooth_if_available), true) && Compatibility.enableBluetoothHeadset(mAudioManager)) {
|
||||
return;
|
||||
} else {
|
||||
if (Hacks.needGalaxySAudioHack() || sLPref.useGalaxySHack())
|
||||
setAudioModeIncallForGalaxyS();
|
||||
|
||||
|
@ -228,14 +224,13 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
listener.onAudioStateChanged(speakerOn ? AudioState.SPEAKER : AudioState.EARPIECE);
|
||||
}
|
||||
}
|
||||
}
|
||||
private synchronized void routeAudioToSpeakerHelper(boolean speakerOn) {
|
||||
final LinphoneCall call = mLc.getCurrentCall();
|
||||
if (call != null && call.getState() == State.StreamsRunning && Hacks.needPausingCallForSpeakers()) {
|
||||
Log.d("Hack to have speaker=",speakerOn," while on call");
|
||||
hackSpeakerState(speakerOn);
|
||||
} else {
|
||||
routeAudioToSpeakerOrBluetoothHelper(speakerOn);
|
||||
routeAudioToSpeakerHelperHelper(speakerOn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -642,7 +637,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
public void initFromConf() throws LinphoneConfigException {
|
||||
|
||||
|
||||
LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key,true));
|
||||
initFromConfTunnel();
|
||||
|
||||
if (initialTransports == null)
|
||||
|
|
|
@ -28,7 +28,6 @@ import static org.linphone.R.string.pref_echo_cancellation_key;
|
|||
import static org.linphone.R.string.pref_echo_canceller_calibration_key;
|
||||
import static org.linphone.R.string.pref_echo_limiter_key;
|
||||
import static org.linphone.R.string.pref_media_encryption_key;
|
||||
import static org.linphone.R.string.pref_use_bluetooth_if_available_key;
|
||||
import static org.linphone.R.string.pref_video_enable_key;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -260,10 +259,6 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
|
|||
}
|
||||
findPreference(pref_echo_limiter_key).setEnabled(true);
|
||||
|
||||
if (!Version.sdkAboveOrEqual(8)) {
|
||||
uncheckAndDisableCheckbox(pref_use_bluetooth_if_available_key);
|
||||
}
|
||||
|
||||
initializeMediaEncryptionPreferences();
|
||||
|
||||
detectAudioCodec(pref_codec_amr_key,"AMR", 8000, false);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.linphone.compatibility;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.media.AudioManager;
|
||||
import android.view.Display;
|
||||
|
||||
/*
|
||||
|
@ -31,14 +30,4 @@ public class ApiEightPlus {
|
|||
public static int getRotation(Display display) {
|
||||
return display.getRotation();
|
||||
}
|
||||
|
||||
public static boolean enableBluetoothHeadset(AudioManager mAudioManager) {
|
||||
if (mAudioManager.isBluetoothScoAvailableOffCall()){
|
||||
mAudioManager.setBluetoothScoOn(true);
|
||||
mAudioManager.setMode(AudioManager.MODE_IN_CALL);
|
||||
mAudioManager.startBluetoothSco();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import android.media.AudioManager;
|
|||
import android.net.Uri;
|
||||
import android.preference.Preference;
|
||||
import android.view.Display;
|
||||
import android.view.Window;
|
||||
/**
|
||||
* @author Sylvain Berfini
|
||||
*/
|
||||
|
@ -180,12 +181,6 @@ public class Compatibility {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static boolean enableBluetoothHeadset(AudioManager mAudioManager) {
|
||||
if (Version.sdkAboveOrEqual(8)) {
|
||||
return ApiEightPlus.enableBluetoothHeadset(mAudioManager);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void setPreferenceChecked(Preference preference, boolean checked) {
|
||||
if (Version.sdkAboveOrEqual(14)) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e1c3d22d293f41702dc1e26aaa366a3e607c10a9
|
||||
Subproject commit dc5b821d22ae39eda6a5c448a3f9e35e8b81f008
|
Loading…
Reference in a new issue