Change the title when in call/media state
* Change the title when in call/media state.
Example: call state show "Available call devices"
media state show "Available media devices"
* Use isAudioModeOngoingCall() utility function for checking if it is in call status
* Add register test to verify when in onStart() and onStop()
the BluetoothCallback can be register and unregister.
* Add title string test to verify when in call or media state,
the title can be changed to corresponding string
Bug: 78150641
Test: make -j40 RunSettingsRoboTests
Change-Id: I6be72cf0cae75525084ac3c5be8524c709f51f7d
Merged-In: I6be72cf0cae75525084ac3c5be8524c709f51f7d
This commit is contained in:
@@ -198,13 +198,6 @@ public abstract class AudioSwitchPreferenceController extends BasePreferenceCont
|
||||
return mAudioManager.getDevicesForStream(streamType) == device;
|
||||
}
|
||||
|
||||
protected boolean isOngoingCallStatus() {
|
||||
final int audioMode = mAudioManager.getMode();
|
||||
return audioMode == AudioManager.MODE_RINGTONE
|
||||
|| audioMode == AudioManager.MODE_IN_CALL
|
||||
|| audioMode == AudioManager.MODE_IN_COMMUNICATION;
|
||||
}
|
||||
|
||||
int getDefaultDeviceIndex() {
|
||||
// Default device is after all connected devices.
|
||||
return ArrayUtils.size(mConnectedDevices);
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.android.settings.sound;
|
||||
import static android.media.AudioManager.STREAM_VOICE_CALL;
|
||||
import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.support.v7.preference.Preference;
|
||||
@@ -45,7 +47,7 @@ public class HandsFreeProfileOutputPreferenceController extends
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isOngoingCallStatus()) {
|
||||
if (!Utils.isAudioModeOngoingCall(mContext)) {
|
||||
// Without phone call, disable the switch entry.
|
||||
mPreference.setVisible(false);
|
||||
preference.setSummary(mContext.getText(R.string.media_output_default_summary));
|
||||
@@ -90,7 +92,7 @@ public class HandsFreeProfileOutputPreferenceController extends
|
||||
|
||||
@Override
|
||||
public void setActiveBluetoothDevice(BluetoothDevice device) {
|
||||
if (isOngoingCallStatus()) {
|
||||
if (Utils.isAudioModeOngoingCall(mContext)) {
|
||||
mProfileManager.getHeadsetProfile().setActiveDevice(device);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ import static android.media.AudioManager.STREAM_MUSIC;
|
||||
import static android.media.AudioSystem.DEVICE_OUT_REMOTE_SUBMIX;
|
||||
import static android.media.AudioSystem.DEVICE_OUT_USB_HEADSET;
|
||||
|
||||
import com.android.settingslib.Utils;
|
||||
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
@@ -57,7 +59,7 @@ public class MediaOutputPreferenceController extends AudioSwitchPreferenceContro
|
||||
return;
|
||||
}
|
||||
|
||||
if (isOngoingCallStatus()) {
|
||||
if (Utils.isAudioModeOngoingCall(mContext)) {
|
||||
// Ongoing call status, switch entry for media will be disabled.
|
||||
mPreference.setVisible(false);
|
||||
preference.setSummary(
|
||||
|
||||
Reference in New Issue
Block a user