Replace deprecated APIs in audio switcher.

- Remove isWiredHeadsetOn() and isBluetoothA2dpOn()
in MediaOutputPreferenceController.

- Remove isWiredHeadsetOn() and isBluetoothScoOn()
in HandsFreeProfileOutputPreferenceController.

- Replace with AudioManager.getDevicesForStream().

- Update test cases.

Bug: 78141441
Test: make RunSettingsRoboTests ROBOTEST_FILTER="MediaOutputPreferenceControllerTest" -j40
Test: make RunSettingsRoboTests ROBOTEST_FILTER="HandsFreeProfileOutputPreferenceControllerTest" -j40
Test: make RunSettingsRoboTests ROBOTEST_FILTER="AudioOutputSwitchPreferenceControllerTest" -j40
Change-Id: Ic57c40badf0fd5633f1b7412d63a0b5417d0f47a
This commit is contained in:
ryanywlin
2018-04-17 16:48:30 +08:00
committed by caxtonchan
parent f99a4a3e06
commit dca308e56d
6 changed files with 54 additions and 9 deletions

View File

@@ -193,8 +193,12 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont
public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
}
protected boolean isStreamFromOutputDevice(int streamType, int device) {
return mAudioManager.getDevicesForStream(streamType) == device;
}
protected boolean isOngoingCallStatus() {
int audioMode = mAudioManager.getMode();
final int audioMode = mAudioManager.getMode();
return audioMode == AudioManager.MODE_RINGTONE
|| audioMode == AudioManager.MODE_IN_CALL
|| audioMode == AudioManager.MODE_IN_COMMUNICATION;