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

Issue 781246 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Keyboard backlight should not turn on from external keyboard/mouse input

Project Member Reported by juliatut...@chromium.org, Nov 3 2017

Issue description

I use my cave at work with an external monitor and a Bluetooth keyboard and mouse. If I leave the laptop open, using the external keyboard and/or mouse wakes up the internal keyboard backlight (or keeps it on, if it's already on).

I'm not sure if this happens with USB keyboards and mice as well, but I'd expect it does. I'll check my home setup (which has wired input devices) later today.

(Please forgive me if this is the wrong component; I work on the network stack and it's a best guess.)

Google Chrome	61.0.3163.123 (Official Build) (64-bit)
Revision	0
Platform	9765.85.0 (Official Build) stable-channel cave
Firmware Version	Google_Cave.7820.288.0
Customization ID	ASUS-CAVE
ARC	4391409
JavaScript	V8 6.1.534.43
Flash	27.0.0.170 /opt/google/chrome/pepper/libpepflashplayer.so
User Agent	Mozilla/5.0 (X11; CrOS x86_64 9765.85.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.123 Safari/537.36
 
I can confirm this also reproduces on a USB keyboard and mouse.
Cc: tbroch@chromium.org
Components: OS>Kernel>Power
Owner: derat@chromium.org
Status: Assigned (was: Untriaged)
Looks like presently we don't have any means to identify whether user input comes from built-in input devices (keyboard, touchpad) where enabling keyboard backlight is beneficial vs some other external input device (or internal ... touchscreen) where its not.

Dan what are your thoughts on differentiating these different input streams to change KB backlight behavior?



Comment 3 by derat@chromium.org, Jan 5 2018

Labels: OS-Chrome
Hmm, this is a tricky one. Chrome's reporting of user input to powerd is quite primitive: when it sees an input event, it calls powerd's HandleUserActivity D-Bus method. We rate-limit these calls to one every five seconds, IIRC.

There's a "type" enum attached to the method call, but it largely corresponds to particular keys that we want to ignore for the purposes of turning the screen on:

enum UserActivityType {
  USER_ACTIVITY_OTHER = 0,
  USER_ACTIVITY_BRIGHTNESS_UP_KEY_PRESS = 1,
  USER_ACTIVITY_BRIGHTNESS_DOWN_KEY_PRESS = 2,
  USER_ACTIVITY_VOLUME_UP_KEY_PRESS = 3,
  USER_ACTIVITY_VOLUME_DOWN_KEY_PRESS = 4,
  USER_ACTIVITY_VOLUME_MUTE_KEY_PRESS = 5,
};

(Also note that we often don't even report these correctly: issue 599883)

One option might be to introduce another argument that describes the source of the user activity. Within powerd, KeyboardBacklightController::HandleUserActivity could inspect this and avoid treating events from external devices as activity.

The one downside is that if we see and report an event from an external device, and then see an event from the internal keyboard a second later, we won't turn the keyboard backlight on (due to the rate-limiting). As a workaround for this, Chrome could track the most-recently reported type and source and avoid rate-limiting the next event it sees with a different type or source.

Comment 4 by derat@chromium.org, Jan 6 2018

Cc: jamescook@chromium.org sadrul@chromium.org
I implemented most of this before realizing that it'll probably break upon moving to mash. :-(

Specifically, the UserActivityObserver interface defined in ui/public/interfaces/user_activity_monitor.mojom doesn't receive the event that triggered the activity report. aura::UserActivityForwarder calls ui::UserActivityDetector::HandleExternalUserActivity(), which just passes a null Event pointer to its observers. Issue 626899 has more details about the current implementation. I don't know if anyone's thought about passing additional event information from ws (would we need to serialize ui::Event?).
I don't know much about user activity, but we do have the ability to serialize events:
https://cs.chromium.org/chromium/src/ui/events/mojo/event.mojom?q=event.mojom&sq=package:chromium

Who would be receiving the event? If it's a privileged process (e.g. ash) that's probably OK. If it's every process (e.g. some random renderer) it's probably not OK for them to see events targeting other UI, for security reasons.

Cc: napper@chromium.org
Hello, 

We are currently working on improving power management via ML and as part of this, we need to log user activity events via UserActivityObserver. Dan mentioned we would lose data once the sys is moved to mash. Would you have some estimate as to when the sys would be moved to mash? Would it be the upcoming M66? If so, we'd have no time to put in any solution to work around it.

Thanks,
Jia
mash is at least 9 months out

Hello,

Has this mash change gone out? It appears we have stopped receiving user event via UserActivityObserver as event pointer is null. We haven't got a chance to change the implementation as I thought mash would go out any time soon. If this change has indeed gone out, would you please let us know when it happened and if there's any quick fix for us? 

We have a new project that needs code to go into M67 (and we have an existing project that relies on this user event), and so we'll need to make changes in the next couple of days.

Thanks!
Jia



Cc: pdyson@chromium.org

Comment 11 by derat@chromium.org, Apr 10 2018

Cc: sky@chromium.org
Scott, do you know if there's any reason why UserActivityObserver wouldn't be receiving raw events now? Is ws running in a separate process from Chrome now?

Jia, you might want to file a new bug for your issue since this one is tracking  an unrelated feature request.
Thanks Dan! I'll file another bug request.
Jia
Mash has not yet shipped, still > 9 months out.

sky turned on the window server on a background thread (--enable-features=Mus) a few weeks ago, but I don't know if that's related.

Sign in to add a comment