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

Issue 686232 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocked on:
issue 706472

Blocking:
issue 683322
issue 686890
issue 688611



Sign in to add a comment

window.onblur() is not fired when android activity loses input focus.

Project Member Reported by mthiesse@chromium.org, Jan 27 2017

Issue description

The context for this bug is I'm implementing a feature that delivers head tracking data for VR through the WebVR API, and we only want to expose this data to the focused frame.

On Android, frames don't lose focus when the application is paused, either by hiding Chrome, or switching to another app in multiwindow mode. This is because on Android we listen for focus changes using onFocusChanged, which doesn't care if the app is paused or hidden and doesn't actually have input focus (it has input focus *for the app*, regardless of whether the app has focus).

I think Chrome on Android should match the behaviour of other platforms and change the focused state when the window (activity) loses input focus regardless of whether the view has focus.
 
Cc: tedc...@chromium.org nasko@chromium.org
cc tedchoc, nasko.

This is pretty easy to fix, and I'd be happy to fix it, but given the broad impact of a change like this, I'd like your opinions.

Also more generally, have we put thought into side-channel attacks related to exposing high-accuracy accelerometer data to pages without input focus? I know ChromeOS tackled this type of problem by only providing low-fidelity accelerometer data while typing in passwords, but as far as I know android doesn't do this.
Components: Security
Components: -Blink>WebVR Internals>PlatformIntegration
Labels: Proj-VR
Cc: twelling...@chromium.org aelias@chromium.org
+aelias@ for general focus
+twellington@ for multiwindow

When Chrome is hidden, we call hide on the webcontents (Tab.java#onActivityHidden is called from onStopWithNative which is when the activity is fully hidden).  I'm surprised that doesn't implicitly result in a blur.

ContentViewCore already has onWindowFocusChanged, if we see that we have focus but the window loses focus, we could potentially send a blur (and refocus later as well).  I don't know all the implications of that and I'll defer to Alex there.


Comment 5 by aelias@chromium.org, Jan 27 2017

Cc: timvolod...@chromium.org changwan@chromium.org
Seems OK to make that change.  I tested with example http://output.jsbin.com/luquqoh that iOS Safari sends a blur event when going to homescreen.  So Clank seems like the outlier.

> Also more generally, have we put thought into side-channel attacks related to exposing high-accuracy accelerometer data to pages without input focus?

Looks like timvolodine@ wrote the accelerometer code, he would know.
Blocking: 686890
aelias@, are you willing to take this on (or find somebody who is)? This is definitely outside of my area of expertise.
Owner: mthiesse@chromium.org
Status: Assigned (was: Available)
Well, I might not have time to get to this in a while -- I'd prefer if you wrote the patch, and I'd be happy to answer questions and code review.  I'm sure you could quickly develop the necessary expertise with a bit of code search on how focus works (same as I'd need to do).  I generally encourage subprojects that are blocked on deeper problems in Chrome to go ahead and fix it themselves -- that scales better than everybody only writing patches in their code silos.
For hardware related apis like sensors we actually disable them when page is invisible. (not sure if this also applies to WebVR but would expect it should). Regarding 'side-channel' considerations I was actually working on this although it's not focus based at the moment.

Labels: -Pri-1 Pri-2
Lowering priority as this only affect multi-window for VR. When the app is backgrounded we already stop sending pose data, so it's not as big of an issue that the page isn't blurred.
Blocking: 688611
Status: Started (was: Assigned)
Blockedon: 706472
Cc: kochi@chromium.org
also cc'ing kochi@ for focus
Status: Fixed (was: Started)
Noting for posterity that this doesn't precisely track input focus to the WebContents, so it's not exactly analogous to other platforms (due to popup views stealing input focus), but it should behave as users would expect.

Sign in to add a comment