New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 767514 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Functional keys (F1-F10) are not working in unified desktop mode.

Project Member Reported by sontis@chromium.org, Sep 21 2017

Issue description

Chrome Version: 9765.70.0/ 61.0.3163.101
OS: Chromeos

What steps will reproduce the problem?
(1) Sign in to the device.
(2) Plug any external monitor.
(3) Enable unified desktop mode from chrome://flags
(4) Restart browser.
(5) Try to use Functional keys (F1-F10)

What is the expected result?
Functional keys should work.

What happens instead?
Functional keys are not working.

Note: Rebooting the device fixes this issue.


Please use labels and text to provide additional information.


For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 

Comment 2 by ka...@chromium.org, Sep 21 2017

Cc: keta...@chromium.org osh...@chromium.org afakhry@chromium.org
Labels: -Pri-2 Pri-1
All boards are affected, and it is consistent reproduction. Changing to P1.

Labels: Needs-Feedback
Owner: afakhry@chromium.org
Status: Unconfirmed (was: Untriaged)
I can't repro this. I enabled UD while a tab is open, hit Search+Refresh (== F3), and the page search textbox came up. So F3 is working normally.

Are you using an external keyboard?

Comment 4 by sontis@chromium.org, Sep 21 2017

Able to reproduce this issue with both onboard and USB keyboards.

Project Member

Comment 5 by sheriffbot@chromium.org, Sep 21 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "afakhry@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Is that only on 61? I can't repro on ToT.
Chrome Version: 9765.70.0/ 61.0.3163.101
OS: Chrome OS
Board: Snappy

Following these steps on the above build will show the  issue 100 % of the time
1) Open chrome://flags and enable Unified Desktop
2) Click the restart now button -- Chrome browser restarts
3) Press Ctrl + F4 which is incorrectly closing the current tab
4) None of the function keys will work now -- Cannot toggle Volume, brightness up or down.  Pressing the 'refresh' key (F3) opens the Find tool (normally Ctrl + F), and pressing F5 will refresh the page (should be F3).  After getting into this state, if you open a crosh tab (Ctrl + Alt + T) and press F5 - F11 you will see numbers input on the prompt.  After a reboot, the issue will disappear.  

It is worth noting that after initially enabling Unified Desktop, the text accompanying the "Restart Now" button states that: "The changes will take effect the next time you restart your DEVICE" yet upon clicking "Restart Now" only the Chrome Browser restarts. 
Components: -OS>Kernel>Display UI>Input>KeyboardShortcuts
Status: Started (was: Unconfirmed)
I can repro now. This happens only when you restart after changing the flag.
Cc: jamescook@chromium.org derat@chromium.org sadrul@chromium.org
Components: UI>Shell>MultipleMonitor
+derat, +sadrul, +oshima, +jamescook.

-------------------

I found the root cause. It's a timing/ordering issue. When it happens, the WindowTreeHosts of the mirroring displays are created and initialized **before** the EventRewriters are created! That's why top row keys no longer work (they're not rewritten).

The event rewriters should be created first, so that when the WindowTreeHosts are initialized, the re-writers are added to the hosts' EventSources [1].

-------------------

More Details:
-------------
(A) The mirroring displays WindowTreeHosts are created asynchronously near the end on Shell::Init() [2].
(B) The Event rewriters are created at chromeos::ChromeBrowserMainPartsChromeos::PostBrowserStart() [3].
(C) Since (A) is asynchronous, MirrorWindowController::UpdateWindow() (where the tree host is created 
    and initialized [4]), may be called before or after ChromeBrowserMainPartsChromeos::PostBrowserStart().

Question:
---------
Why do we need the event re-writers creation to happen in PostBrowserStart()? Can we create them in 
an earlier stage to guarantee they will be available when the mirroring hosts are created?

I tried moving re-writers creation to PreBrowserStart() and the bug was fixed, but that still doesn't 
guarantee the ordering.




[1]: https://cs.chromium.org/chromium/src/chrome/browser/chromeos/events/event_rewriter_controller.cc?q=EventRewriterController::OnHostInitialized&sq=package:chromium&l=50

[2]: https://cs.chromium.org/chromium/src/ash/shell.cc?q=ash::Shell::Init&sq=package:chromium&l=1140

[3]: https://cs.chromium.org/chromium/src/chrome/browser/chromeos/chrome_browser_main_chromeos.cc?type=cs&q=chromeos::ChromeBrowserMainPartsChromeos::PostBrowserStart&sq=package:chromium&l=1046-1056

[4]: https://cs.chromium.org/chromium/src/ash/display/mirror_window_controller.cc?type=cs&q=MirrorWindowController::UpdateWindow&l=161-186
Cc: -pgangishetty@chromium.org sky@chromium.org
+sky for display manager/WindowTreeHost question.

Could EventRewriter initialization happen in PreMainMessageLoop start, which should be shortly after aura::Env is initialized? Or do the rewriters themselves has ash dependencies?

https://cs.chromium.org/chromium/src/content/browser/browser_main_runner.cc?sq=package:chromium&l=103

Comment 12 by sky@chromium.org, Sep 22 2017

How about making the constructor iterator over existing WindowTreeHosts?
Project Member

Comment 13 by bugdroid1@chromium.org, Sep 25 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aebefb730e8680f843036b6ed32039a26c64d99a

commit aebefb730e8680f843036b6ed32039a26c64d99a
Author: Ahmed Fakhry <afakhry@google.com>
Date: Mon Sep 25 17:20:18 2017

Fix a race condition resulting in EventRewriters not being registered for mirroring displays hosts

A race condition used to happen where either the event rewriters will be created first
and then the mirroring displays hosts second (in which case everything works properly),
or the mirroring displays hosts are created before the event rewriters, which results
in being unable to use the top row keys or any keys that require event rewriting, since
the rewriters weren't added to the mirroring displays hosts' EventSources.

This CL adds a fix for the second scenario mentioned above.

BUG= 767514 
TEST=manually try to invoke the race consition by following the steps in this
     comment https://bugs.chromium.org/p/chromium/issues/detail?id=767514#c7

Change-Id: Ic6a163e897cfb38d77ed372fef95c0c87040c26b
Reviewed-on: https://chromium-review.googlesource.com/680020
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504085}
[modify] https://crrev.com/aebefb730e8680f843036b6ed32039a26c64d99a/chrome/browser/chromeos/events/event_rewriter_controller.cc

Status: Fixed (was: Started)
Labels: Merge-Request-61 Merge-Request-62
Status: Started (was: Fixed)
Forgot to merge request.
Project Member

Comment 16 by sheriffbot@chromium.org, Sep 26 2017

Labels: -Merge-Request-62 Merge-Review-62 Hotlist-Merge-Review
This bug requires manual review: M62 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), bhthompson@(ChromeOS), abdulsyed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-62 Merge-Approved-62
Merge approved for 62. 

If this is not absolutely critical, we should not be merging into 61 anymore, please provide rationale on why this is needed in 61 for merge review there.
Unified Desktop is important for enterprise and kiosk customers, such a race condition may cause a lot of frustration. That's why I want to merge to M-61.
Project Member

Comment 19 by bugdroid1@chromium.org, Sep 26 2017

Labels: -merge-approved-62 merge-merged-3202
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a3aca466fcde8dc1ec60c7c9131c621a195ce5c2

commit a3aca466fcde8dc1ec60c7c9131c621a195ce5c2
Author: Ahmed Fakhry <afakhry@google.com>
Date: Tue Sep 26 21:19:13 2017

[Merge to M-62] Fix a race condition resulting in EventRewriters not being registered for mirroring displays hosts

A race condition used to happen where either the event rewriters will be created first
and then the mirroring displays hosts second (in which case everything works properly),
or the mirroring displays hosts are created before the event rewriters, which results
in being unable to use the top row keys or any keys that require event rewriting, since
the rewriters weren't added to the mirroring displays hosts' EventSources.

This CL adds a fix for the second scenario mentioned above.

TBR=sky@chromium.org
BUG= 767514 
TEST=manually try to invoke the race consition by following the steps in this
     comment https://bugs.chromium.org/p/chromium/issues/detail?id=767514#c7

(cherry picked from commit aebefb730e8680f843036b6ed32039a26c64d99a)

Change-Id: Ic6a163e897cfb38d77ed372fef95c0c87040c26b
Reviewed-on: https://chromium-review.googlesource.com/680020
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#504085}
Reviewed-on: https://chromium-review.googlesource.com/685557
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/branch-heads/3202@{#456}
Cr-Branched-From: fa6a5d87adff761bc16afc5498c3f5944c1daa68-refs/heads/master@{#499098}
[modify] https://crrev.com/a3aca466fcde8dc1ec60c7c9131c621a195ce5c2/chrome/browser/chromeos/events/event_rewriter_controller.cc

Labels: -Merge-Request-61 Merge-Approved-61
Approving merge to M61. please merge by noon today.
Project Member

Comment 21 by bugdroid1@chromium.org, Sep 29 2017

Labels: -merge-approved-61 merge-merged-3163
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/063c6b72bc456ba1364957f274d542a28c37e8f9

commit 063c6b72bc456ba1364957f274d542a28c37e8f9
Author: Ahmed Fakhry <afakhry@google.com>
Date: Fri Sep 29 19:37:59 2017

[Merge to M61] Fix a race condition resulting in EventRewriters not being registered for mirroring displays hosts

A race condition used to happen where either the event rewriters will be created first
and then the mirroring displays hosts second (in which case everything works properly),
or the mirroring displays hosts are created before the event rewriters, which results
in being unable to use the top row keys or any keys that require event rewriting, since
the rewriters weren't added to the mirroring displays hosts' EventSources.

This CL adds a fix for the second scenario mentioned above.

TBR=sky@chromium.org
BUG= 767514 
TEST=manually try to invoke the race consition by following the steps in this
     comment https://bugs.chromium.org/p/chromium/issues/detail?id=767514#c7

(cherry picked from commit aebefb730e8680f843036b6ed32039a26c64d99a)

Change-Id: Ic6a163e897cfb38d77ed372fef95c0c87040c26b
Reviewed-on: https://chromium-review.googlesource.com/680020
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#504085}
Reviewed-on: https://chromium-review.googlesource.com/692577
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/branch-heads/3163@{#1294}
Cr-Branched-From: ff259bab28b35d242e10186cd63af7ed404fae0d-refs/heads/master@{#488528}
[modify] https://crrev.com/063c6b72bc456ba1364957f274d542a28c37e8f9/chrome/browser/chromeos/events/event_rewriter_controller.cc

Status: Fixed (was: Started)

Comment 23 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Comment 24 by dchan@chromium.org, Jan 23 2018

Status: Fixed (was: Archived)
Status: Verified (was: Fixed)
Verified.

Sign in to add a comment