Change BT device volume during call if connected and used
This commit is contained in:
parent
dab574000d
commit
745c532461
2 changed files with 16 additions and 5 deletions
|
@ -23,6 +23,7 @@ Group changes to describe their impact on the project, as follows:
|
||||||
- Android 10 compatibility
|
- Android 10 compatibility
|
||||||
- New plugin loader to be compatible with app bundle distribution mode
|
- New plugin loader to be compatible with app bundle distribution mode
|
||||||
- Restart service if foreground service setting is on when app is updated
|
- Restart service if foreground service setting is on when app is updated
|
||||||
|
- Change bluetooth volume while in call if BT device connected and used
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
- Improved performances to reduce startup time
|
- Improved performances to reduce startup time
|
||||||
|
|
|
@ -54,8 +54,6 @@ import org.linphone.receivers.HeadsetReceiver;
|
||||||
import org.linphone.settings.LinphonePreferences;
|
import org.linphone.settings.LinphonePreferences;
|
||||||
|
|
||||||
public class AndroidAudioManager {
|
public class AndroidAudioManager {
|
||||||
private static final int LINPHONE_VOLUME_STREAM = STREAM_VOICE_CALL;
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private AudioManager mAudioManager;
|
private AudioManager mAudioManager;
|
||||||
private Call mRingingCall;
|
private Call mRingingCall;
|
||||||
|
@ -415,10 +413,22 @@ public class AndroidAudioManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustVolume(int i) {
|
private void adjustVolume(int i) {
|
||||||
// starting from ICS, volume must be adjusted by the application, at least for
|
if (mAudioManager.isVolumeFixed()) {
|
||||||
// STREAM_VOICE_CALL volume stream
|
Log.e("[Audio Manager] Can't adjust volume, device has it fixed...");
|
||||||
|
// Keep going just in case...
|
||||||
|
}
|
||||||
|
|
||||||
|
int stream = STREAM_VOICE_CALL;
|
||||||
|
if (mIsBluetoothHeadsetScoConnected) {
|
||||||
|
Log.i(
|
||||||
|
"[Audio Manager] Bluetooth is connected, try to change the volume on STREAM_BLUETOOTH_SCO");
|
||||||
|
stream = 6; // STREAM_BLUETOOTH_SCO, it's hidden...
|
||||||
|
}
|
||||||
|
|
||||||
|
// starting from ICS, volume must be adjusted by the application,
|
||||||
|
// at least for STREAM_VOICE_CALL volume stream
|
||||||
mAudioManager.adjustStreamVolume(
|
mAudioManager.adjustStreamVolume(
|
||||||
LINPHONE_VOLUME_STREAM,
|
stream,
|
||||||
i < 0 ? AudioManager.ADJUST_LOWER : AudioManager.ADJUST_RAISE,
|
i < 0 ? AudioManager.ADJUST_LOWER : AudioManager.ADJUST_RAISE,
|
||||||
AudioManager.FLAG_SHOW_UI);
|
AudioManager.FLAG_SHOW_UI);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue