summaryrefslogtreecommitdiffstats
path: root/chromeos/audio/audio_device.h
diff options
context:
space:
mode:
authorcychiang <cychiang@chromium.org>2015-07-08 02:59:00 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-08 09:59:39 +0000
commit3c3d910e31448a88e014b31334a57242ba5e8960 (patch)
tree76631613eb6d3f78168026b204d1dc86c266ffe7 /chromeos/audio/audio_device.h
parenta152535799a629264d64d740bafadccaff740805 (diff)
downloadchromium_src-3c3d910e31448a88e014b31334a57242ba5e8960.zip
chromium_src-3c3d910e31448a88e014b31334a57242ba5e8960.tar.gz
chromium_src-3c3d910e31448a88e014b31334a57242ba5e8960.tar.bz2
Implement HasInputDevices in CrasAudioManager
Currently in CrasAudioManager, HasInputDevices always returns True. We need to let HasInputDevices reflect the truth for device without internal microphone like ChromeBox. Let CrasAudioHandler updates the flag in CrasAudioManager whenever CrasAudioHandler gets the audio node info from Cras. Add a property is_for_simple_usage to AudioDeviceType to indicate that a device is for simple usage, not for special usage like loopback, always on keyword mic, or keyboard mic. This property can also replace the logic in audio_detailed_view.cc to filter out the devices that we do not want to display in UI. BUG=490851 TEST=Check audio devices in UI does not contain loopback devices. TEST=Check virtual keyboard does not show microphone for chromebox (Not tested yet). R=dalecurtis@chromium.org, derat@chromium.org, dgreid@chromium.org, jennyz@chromium.org Review URL: https://codereview.chromium.org/1186293003 Cr-Commit-Position: refs/heads/master@{#337791}
Diffstat (limited to 'chromeos/audio/audio_device.h')
-rw-r--r--chromeos/audio/audio_device.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/chromeos/audio/audio_device.h b/chromeos/audio/audio_device.h
index 67dca1c..2ed26b1 100644
--- a/chromeos/audio/audio_device.h
+++ b/chromeos/audio/audio_device.h
@@ -41,6 +41,20 @@ struct CHROMEOS_EXPORT AudioDevice {
static std::string GetTypeString(chromeos::AudioDeviceType type);
static chromeos::AudioDeviceType GetAudioType(const std::string& node_type);
+ // Indicates that an input or output audio device is for simple usage like
+ // playback or recording for user. In contrast, audio device such as
+ // loopback, always on keyword recognition (AOKR), and keyboard mic are
+ // not for simple usage.
+ bool is_for_simple_usage() {
+ return (type == AUDIO_TYPE_HEADPHONE ||
+ type == AUDIO_TYPE_INTERNAL_MIC ||
+ type == AUDIO_TYPE_MIC ||
+ type == AUDIO_TYPE_USB ||
+ type == AUDIO_TYPE_BLUETOOTH ||
+ type == AUDIO_TYPE_HDMI ||
+ type == AUDIO_TYPE_INTERNAL_SPEAKER);
+ }
+
bool is_input;
uint64 id;
std::string display_name;