summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/sound
diff options
context:
space:
mode:
authorhughchen <hughchen@google.com>2018-04-17 16:36:58 +0800
committerhughchen <hughchen@google.com>2018-05-08 17:14:59 +0800
commitf431088f9d9856cc937182c75e61834ca6696e1b (patch)
tree5c57b449f33d074aaa6f75898d8e8401c736b008 /src/com/android/settings/sound
parent1220c364c4e6da3587fc356bb30d3cba99ab7946 (diff)
downloadpackages_apps_Settings-f431088f9d9856cc937182c75e61834ca6696e1b.tar.gz
packages_apps_Settings-f431088f9d9856cc937182c75e61834ca6696e1b.tar.bz2
packages_apps_Settings-f431088f9d9856cc937182c75e61834ca6696e1b.zip
Change the title when in call/media state
* For fix the "Automatic merge failed" in pi-dev, cherry pick the ag/3909960 in master. Change android.support.* to androidx.* * 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
Diffstat (limited to 'src/com/android/settings/sound')
-rw-r--r--src/com/android/settings/sound/AudioSwitchPreferenceController.java7
-rw-r--r--src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java6
-rw-r--r--src/com/android/settings/sound/MediaOutputPreferenceController.java4
3 files changed, 7 insertions, 10 deletions
diff --git a/src/com/android/settings/sound/AudioSwitchPreferenceController.java b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
index cae7b0cbd9..24d23ab875 100644
--- a/src/com/android/settings/sound/AudioSwitchPreferenceController.java
+++ b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
@@ -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);
diff --git a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
index 7e9186541e..732f0efbbb 100644
--- a/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
+++ b/src/com/android/settings/sound/HandsFreeProfileOutputPreferenceController.java
@@ -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 androidx.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);
}
}
diff --git a/src/com/android/settings/sound/MediaOutputPreferenceController.java b/src/com/android/settings/sound/MediaOutputPreferenceController.java
index 5ac0848f1e..89ee412ee8 100644
--- a/src/com/android/settings/sound/MediaOutputPreferenceController.java
+++ b/src/com/android/settings/sound/MediaOutputPreferenceController.java
@@ -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(