Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2239)

Unified Diff: ash/common/system/chromeos/audio/audio_detailed_view.cc

Issue 2721733003: Handle the dual microphones and dual cameras cases. Activate the proper microphone when user activa… (Closed)
Patch Set: Nit: log only the invalid camera facing mode value. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/audio/audio_detailed_view.cc
diff --git a/ash/common/system/chromeos/audio/audio_detailed_view.cc b/ash/common/system/chromeos/audio/audio_detailed_view.cc
index a8a7d7bd6b305188c493d73f1aba7658b6a9263c..72a7c0088baae2c6da757f80903a210fd4efca2b 100644
--- a/ash/common/system/chromeos/audio/audio_detailed_view.cc
+++ b/ash/common/system/chromeos/audio/audio_detailed_view.cc
@@ -167,16 +167,40 @@ void AudioDetailedView::UpdateAudioDevices() {
output_devices_.clear();
input_devices_.clear();
chromeos::AudioDeviceList devices;
- CrasAudioHandler::Get()->GetAudioDevices(&devices);
+ CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
+ audio_handler->GetAudioDevices(&devices);
+ bool has_dual_internal_mic = audio_handler->HasDualInternalMic();
+ bool is_front_or_rear_mic_active = false;
for (size_t i = 0; i < devices.size(); ++i) {
// Don't display keyboard mic or aokr type.
if (!devices[i].is_for_simple_usage())
continue;
- if (devices[i].is_input)
+ if (devices[i].is_input) {
+ // Do not expose the internal front and rear mic to UI.
+ if (has_dual_internal_mic &&
+ audio_handler->IsFrontOrRearMic(devices[i])) {
+ if (devices[i].active)
+ is_front_or_rear_mic_active = true;
+ continue;
+ }
input_devices_.push_back(devices[i]);
- else
+ } else {
output_devices_.push_back(devices[i]);
+ }
+ }
+
+ // Expose the dual internal mics as one device (internal mic) to user.
+ if (has_dual_internal_mic) {
+ // Create stub internal mic entry for UI rendering, which representing
+ // both internal front and rear mics.
+ chromeos::AudioDevice internal_mic;
+ internal_mic.is_input = true;
+ internal_mic.stable_device_id_version = 2;
+ internal_mic.type = chromeos::AUDIO_TYPE_INTERNAL_MIC;
+ internal_mic.active = is_front_or_rear_mic_active;
+ input_devices_.push_back(internal_mic);
}
+
UpdateScrollableList();
}
@@ -225,8 +249,14 @@ void AudioDetailedView::HandleViewClicked(views::View* view) {
if (iter == device_map_.end())
return;
chromeos::AudioDevice device = iter->second;
- CrasAudioHandler::Get()->SwitchToDevice(device, true,
- CrasAudioHandler::ACTIVATE_BY_USER);
+ CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
+ if (device.type == chromeos::AUDIO_TYPE_INTERNAL_MIC &&
+ audio_handler->HasDualInternalMic()) {
+ audio_handler->SwitchToFrontOrRearMic();
+ } else {
+ audio_handler->SwitchToDevice(device, true,
+ CrasAudioHandler::ACTIVATE_BY_USER);
+ }
}
} // namespace tray
« no previous file with comments | « no previous file | chromeos/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698