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

Issue 760730 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-09-18
OS: Linux
Pri: 2
Type: Bug
Team-Accessibility



Sign in to add a comment

darkenScreen API shouldn't use SetBacklightsForcedOff

Project Member Reported by derat@chromium.org, Aug 30 2017

Issue description

I just noticed that https://codereview.chromium.org/2768703002 added a private darkenScreen a11y API for  issue 625741 . The implementation calls powerd's SetBacklightsForcedOff D-Bus method, which was unexpected to me -- that method was added to implement tablet-style power buttons ( issue 651669 ), and it wasn't designed to be called from multiple places (e.g. there's no counter to let off/on calls stack). As such, I'm worried that a Chromebook can get into a bad state if the power button is pressed while this API is active.

David, can you look into finding another way to turn the display off for darkenScreen? For example, ash/wm/screen_dimmer.h is already used to dim the screen on inactive Chromeboxes. It could probably also be used to completely darken the screen. Alternately, chromeos::PowerManagerClient::SetScreenBrightnessPercent could be called to set the screen brightness to 0, or Chrome's regular display configuration code could even be used to turn all displays off.

Basically, please use anything other than SetBacklightsForcedOff, because I'm concerned that using it will cause problems. :-) I'll add a comment to it documenting that it shouldn't be used from anywhere outside of the power button code (or maybe even rename the Chrome method to make its intended use clear).
 

Comment 1 by dtseng@chromium.org, Sep 18 2017

NextAction: 2017-09-18
Owner: ----
Status: available (was: Assigned)

Comment 2 by derat@chromium.org, Sep 18 2017

Hi David, I don't understand #1. Who owns this code now?
Hi, #1 indicates the issue is available for anyone to fix. The advantage of doing this way was it actually turns off the display entirely including touch.

Is there some way we could address your concerns regarding using the call?

Comment 4 by derat@chromium.org, Oct 6 2017

Labels: -M-62 M-63
Can you add more details about the requirements for darkenScreen so I can provide suggestions for better ways to do this? Alternately, is the accessibilityPrivate API documented anywhere?
chrome/common/extensions/api/accessibility_private.json doesn't have many details.

It sounds from #3 like you want to turn the display off and also disable the touchscreen. Should the touchpad be disabled too?

How long should this persist? If Chrome crashes and is restarted, should the display stay off or turn back on? (If it stays off, does Chrome have any way to know the state the display is in?)

If the user signs out, should the display stay off or turn on?

What about if the system reboots?
Would you like to code review the original change, since you object to the change in general and we can re-do the pieces you don't think work?

As for how the feature should work, that's in the change:
- keys are bound from an accessibility extension, ChromeVox to darken the screen (perhaps a better name is to disable the screen), but we're following naming conventions from other screen readers. I'm fine to rename the private api to disable screen. A separate keystroke re-enables the screen (undarken screen)
- if invoked, the screen should be turned off (or back on)
- if ChromeVox is toggled off, the screen should come back on
- on reboot, the screen is back on

Also, do you have a reproducable bug that I can fix here? I'm a little confused as to what you are asking for or the specific concerns.

Comment 6 by derat@chromium.org, Oct 9 2017

Thanks for the details!

I'm traveling and don't have a system to test this on right now, but I'm pretty sure that something like the following will cause problems on a convertible Chromebook:

1. Use the ChromeVox hotkey to turn the screen off.
2. Tap the power button on the side of the device.
3. Tap the power button on the side of the device again.

At this point, I think the screen will be turned back on, since the tablet power button code doesn't expect anything else to be calling SetBacklightsForcedOff. Will this be unexpected for users?

Alternately, this sequence will probably also interact poorly:

1. Tap the power button.
2. Use ChromeVox to turn the screen off.
3. Tap the power button again.

Again, I think that the screen will be turned on now. If the user hits the ChromeVox hotkey at this point, I suspect that ChromeVox will try to turn the screen *on* (even though it's already on), since ChromeVox doesn't know that the power button code has already turned it on.

My concern isn't about how any of this is named; it's that the darkenScreen API and ash::PowerButtonDisplayController are each tracking the last state that they requested but unaware that the actual state might've been changed by each other in the meantime.

Let me know if that explanation makes sense. I'll think some more about possible ways to fix this.
I see. Thanks for explaining.

Currently, the darken screen api holds no state. 
    Review-Url: https://codereview.chromium.org/2768703002

Therefore, in ChromeVox, we had to bind two shortcuts (one to enable, one to disable), rather than a toggle.

You are right about the power button turning on the screen back on being unexpected for users. 

Comment 8 by derat@chromium.org, Dec 7 2017

Owner: derat@chromium.org
Status: Started (was: Available)

Comment 9 by derat@chromium.org, Dec 7 2017

Uploaded https://crrev.com/c/815762.
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 13 2017

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

commit 477c56da2daf91ce8cb1f8abacad62e70f73bde7
Author: Daniel Erat <derat@chromium.org>
Date: Wed Dec 13 21:42:54 2017

chromeos: Make darkenScreen a11y API work with other callers

Update the chrome.accessibilityPrivate.darkenScreen API to
use ash::BacklightsForcedOffSetter to force backlights off
rather than calling powerd's SetBacklightsForcedOff D-Bus
method directly.

Otherwise, the backlights can get into an unexpected state
due to ChromeVox and ash's power button code both calling
the D-Bus method, which was only designed for a single
caller.

      Search+Shift+F7 darkens the screen and Search+F7
      undarkens it

Bug:  760730 ,  793112 
Test: enabled ChromeVox with Ctrl+Alt+Z and checked that
Change-Id: I6e5d2f11746ce7ae2e34987a413f2655747e9532
Reviewed-on: https://chromium-review.googlesource.com/815762
Reviewed-by: David Tseng <dtseng@chromium.org>
Commit-Queue: Dan Erat <derat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523890}
[modify] https://crrev.com/477c56da2daf91ce8cb1f8abacad62e70f73bde7/ash/shell.h
[modify] https://crrev.com/477c56da2daf91ce8cb1f8abacad62e70f73bde7/chrome/browser/accessibility/accessibility_extension_api.cc
[modify] https://crrev.com/477c56da2daf91ce8cb1f8abacad62e70f73bde7/chrome/browser/chromeos/accessibility/accessibility_manager.cc
[modify] https://crrev.com/477c56da2daf91ce8cb1f8abacad62e70f73bde7/chrome/browser/chromeos/accessibility/accessibility_manager.h

Comment 11 by derat@chromium.org, Dec 13 2017

Status: Verified (was: Started)
Project Member

Comment 12 by bugdroid1@chromium.org, Dec 13 2017

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

commit 7542fc382f738ee412dccf862d25a3bfa53e6495
Author: Daniel Erat <derat@chromium.org>
Date: Wed Dec 13 23:56:36 2017

chromeos: Warn against calling SetBacklightsForcedOff.

Document that chromeos::PowerManagerClient's
SetBacklightsForcedOff method doesn't support multiple
callers, and that ash::BacklightsForcedOffSetter should be
used instead.

Bug:  760730 
Change-Id: Id083f9e1b3d1b252fa259ae519cf12c07135fa5f
Reviewed-on: https://chromium-review.googlesource.com/825948
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Commit-Queue: Dan Erat <derat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523934}
[modify] https://crrev.com/7542fc382f738ee412dccf862d25a3bfa53e6495/chromeos/dbus/power_manager_client.h

Sign in to add a comment