[SPEAK-ON-MUTE] Add speak-on-mute notification toast UI.
Pop up a toast when speak-on-mute is detected. UI review: go/vc-ui TEST: manually test on DUT. Bug: b/253283711 Change-Id: I5b2d33d7d93ac34fba950b9e43b3f6cf16e346a6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4151359 Reviewed-by: Andre Le <leandre@chromium.org> Commit-Queue: CJ Huang <chenjih@google.com> Auto-Submit: CJ Huang <chenjih@google.com> Cr-Commit-Position: refs/heads/main@{#1093591}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
ff852cae4c
commit
ddf4455065
ash
@ -1487,6 +1487,9 @@ Style notes:
|
||||
<message name="IDS_ASH_VIDEO_CONFERENCE_BUBBLE_PORTRAIT_RELIGHT_NAME" desc="Text for name of the portrait relight effect in the VC bubble.">
|
||||
Portrait Relighting
|
||||
</message>
|
||||
<message name="IDS_ASH_VIDEO_CONFERENCE_TOAST_SPEAK_ON_MUTE_DETECTED" desc="A toast message that we show when user tries to speak while muted on system-level.">
|
||||
Are you speaking? You are on mute. Learn more
|
||||
</message>
|
||||
|
||||
<!-- Phone Hub tray-->
|
||||
<message name="IDS_ASH_PHONE_HUB_TRAY_ACCESSIBLE_NAME" desc="The accessible name of the Phone Hub tray bubble for screen readers.">
|
||||
|
@ -0,0 +1 @@
|
||||
0f23ba722725e7528fe3f608f9a3dfe6de45d5ea
|
@ -242,7 +242,8 @@ enum class ToastCatalogName {
|
||||
kEcheTrayTabletModeNotSupported = 38,
|
||||
kNotificationCenterTrayNoNotifications = 39,
|
||||
kCopyToClipboardAction = 40,
|
||||
kMaxValue = kCopyToClipboardAction,
|
||||
kVideoConferenceTraySpeakOnMuteDetected = 41,
|
||||
kMaxValue = kVideoConferenceTraySpeakOnMuteDetected,
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
@ -4,8 +4,12 @@
|
||||
|
||||
#include "ash/system/video_conference/video_conference_tray_controller.h"
|
||||
|
||||
#include "ash/constants/notifier_catalogs.h"
|
||||
#include "ash/public/cpp/system/toast_data.h"
|
||||
#include "ash/public/cpp/system/toast_manager.h"
|
||||
#include "ash/root_window_controller.h"
|
||||
#include "ash/shell.h"
|
||||
#include "ash/strings/grit/ash_strings.h"
|
||||
#include "ash/style/icon_button.h"
|
||||
#include "ash/system/status_area_widget.h"
|
||||
#include "ash/system/video_conference/video_conference_media_state.h"
|
||||
@ -14,10 +18,18 @@
|
||||
#include "chromeos/crosapi/mojom/video_conference.mojom.h"
|
||||
#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h"
|
||||
#include "media/capture/video/chromeos/mojom/cros_camera_service.mojom-shared.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
namespace {
|
||||
// The ID for the "Speak-on-mute detected" toast.
|
||||
constexpr char kVideoConferenceTraySpeakOnMuteDetectedId[] =
|
||||
"video_conference_tray_toast_ids.speak_on_mute_detected";
|
||||
|
||||
// The cool down duration for speak-on-mute detection notification in seconds.
|
||||
constexpr int KSpeakOnMuteNotificationCoolDownDuration = 60;
|
||||
|
||||
VideoConferenceTrayController* g_controller_instance = nullptr;
|
||||
} // namespace
|
||||
|
||||
@ -81,6 +93,26 @@ void VideoConferenceTrayController::OnInputMuteChanged(
|
||||
}
|
||||
}
|
||||
|
||||
void VideoConferenceTrayController::OnSpeakOnMuteDetected() {
|
||||
const base::TimeTicks current_time = base::TimeTicks::Now();
|
||||
|
||||
if (!last_speak_on_mute_notification_time_.has_value() ||
|
||||
(current_time - last_speak_on_mute_notification_time_.value())
|
||||
.InSeconds() >= KSpeakOnMuteNotificationCoolDownDuration) {
|
||||
ToastData toast_data(
|
||||
kVideoConferenceTraySpeakOnMuteDetectedId,
|
||||
ToastCatalogName::kVideoConferenceTraySpeakOnMuteDetected,
|
||||
l10n_util::GetStringUTF16(
|
||||
IDS_ASH_VIDEO_CONFERENCE_TOAST_SPEAK_ON_MUTE_DETECTED),
|
||||
ToastData::kDefaultToastDuration,
|
||||
/*visible_on_lock_screen=*/false);
|
||||
toast_data.show_on_all_root_windows = true;
|
||||
ToastManager::Get()->Show(std::move(toast_data));
|
||||
|
||||
last_speak_on_mute_notification_time_.emplace(current_time);
|
||||
}
|
||||
}
|
||||
|
||||
void VideoConferenceTrayController::UpdateWithMediaState(
|
||||
VideoConferenceMediaState state) {
|
||||
auto old_state = state_;
|
||||
@ -128,4 +160,4 @@ void VideoConferenceTrayController::HandleDeviceUsedWhileDisabled(
|
||||
// TODO(b/249828245): Implement logic to handle this.
|
||||
}
|
||||
|
||||
} // namespace ash
|
||||
} // namespace ash
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "ash/system/video_conference/effects/video_conference_tray_effects_manager.h"
|
||||
#include "ash/system/video_conference/video_conference_media_state.h"
|
||||
#include "base/observer_list_types.h"
|
||||
#include "base/time/time.h"
|
||||
#include "chromeos/ash/components/audio/cras_audio_handler.h"
|
||||
#include "chromeos/crosapi/mojom/video_conference.mojom-forward.h"
|
||||
#include "media/capture/video/chromeos/camera_hal_dispatcher_impl.h"
|
||||
@ -93,6 +94,10 @@ class ASH_EXPORT VideoConferenceTrayController
|
||||
bool mute_on,
|
||||
CrasAudioHandler::InputMuteChangeMethod method) override;
|
||||
|
||||
// CrasAudioHandler::AudioObserver:
|
||||
// Pop up a toast when speaking on mute is detected.
|
||||
void OnSpeakOnMuteDetected() override;
|
||||
|
||||
VideoConferenceTrayEffectsManager& effects_manager() {
|
||||
return effects_manager_;
|
||||
}
|
||||
@ -107,8 +112,11 @@ class ASH_EXPORT VideoConferenceTrayController
|
||||
|
||||
// Registered observers.
|
||||
base::ObserverList<Observer> observer_list_;
|
||||
|
||||
// The last time speak-on-mute notification showed.
|
||||
absl::optional<base::TimeTicks> last_speak_on_mute_notification_time_;
|
||||
};
|
||||
|
||||
} // namespace ash
|
||||
|
||||
#endif // ASH_SYSTEM_VIDEO_CONFERENCE_VIDEO_CONFERENCE_TRAY_CONTROLLER_H_
|
||||
#endif // ASH_SYSTEM_VIDEO_CONFERENCE_VIDEO_CONFERENCE_TRAY_CONTROLLER_H_
|
||||
|
Reference in New Issue
Block a user