Commit 455bfb16 authored by wutao's avatar wutao Committed by Chromium LUCI CQ

ambient: Do not interrupt video wake lock

When ambient mode starts and exits, it will change the video visibility
and update the video wake lock.
For example, when a video is playing in browser, it will request a video
wake lock to prevent screen dim and off. However, when we lock the
screen while playing the video in an active tab, the ambient mode will
start after several seconds. Ambient widget covers the fullscreen and
change the browser visibility to not visible and release the video wake
lock. After some time, screen is turned off and ambient mode exits. The
browser visibility becomes visible again and acquire the video wake lock
again and turn on the screen. The screen on event will start ambient
mode in a few seconds again.

To fix this bug, we set the opacity of the ambient widget to be
translucent, which will not change the browser visibility and therefore
the video wake lock. As long as the video wake lock is held, the ambient
mode will not exit since there is no dim event.

Bug: b/173806284
Test: manual
Change-Id: I0bb7f3c8f6fdeb04d9831a85ffe97eeb769f3b7e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612386
Commit-Queue: Tao Wu <wutao@chromium.org>
Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841137}
parent d1b4f6d1
......@@ -657,6 +657,9 @@ std::unique_ptr<views::Widget> AmbientController::CreateWidget(
params.delegate = widget_delegate;
params.visible_on_all_workspaces = true;
// Do not change the video wake lock.
params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent;
auto widget = std::make_unique<views::Widget>();
widget->Init(std::move(params));
widget->SetContentsView(std::move(container_view));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment