Refactor PowerSaveBlocker to not using AnchorView |
||
Issue descriptionBefore I forget - It was mentioned (though briefly) during the code view https://crrev.com/2103243002 that PowerSaveBlocker may deserve refactoring in the way that it avoids creating an anchor view just to call View.keepScreenOn, since keeping screen on is supposed to work globally, not at the view level. Instead, ViewAndroidDelegate issues on/off request to WindowAndroid where we keep a view on which we call keepScreenOn. Or just maintain a refcount variable to invoke a callback to turn it on or off when refcount goes above or to zero. The actual work can go up further to activity level. May need examining against Chrome and WebView.
,
Jan 17 2017
> did I say that? :p It was sievers@' observation. > so we don't want to switch to using setting flags in the window Hm... then how about use its container view rather than creating/destroying an anchor view? Would become rather a minor change but at least we can save ourselves from creating/destroying views. It's just that it doesn't look like a suitable use case of anchor view for PowerSaveBlocker just to call |keepScreenOn|.
,
Jan 18 2017
> Hm... then how about use its container view rather than creating/destroying an anchor view? I'm ok with that. I guess in theory apps could still modify that state on webview. But then we can just tell apps to stop doing that.
,
Jan 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4 commit 6795958b17b2aacf0ff1053d3df0948a3e4a1ad4 Author: jinsukkim <jinsukkim@chromium.org> Date: Fri Jan 20 05:55:05 2017 Use ContainerView for PowerSaveBlocker to keep screen on PowerSaveBlocker used to add/remove a child view to the container just to invoke |View.keepScreenOn| on it. This CL uses the container view instead so as to avoid repeating view creation/deletion. BUG= 681738 Review-Url: https://codereview.chromium.org/2638973004 Cr-Commit-Position: refs/heads/master@{#444989} [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/device/power_save_blocker/android/java/src/org/chromium/device/power_save_blocker/PowerSaveBlocker.java [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/device/power_save_blocker/power_save_blocker_android.cc [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/ui/android/view_android.cc [modify] https://crrev.com/6795958b17b2aacf0ff1053d3df0948a3e4a1ad4/ui/android/view_android.h
,
Jan 20 2017
,
Jul 18 2017
we found an issue related to this change. containerView will be changed when exitFullScreen is called. refered: https://cs.chromium.org/chromium/src/android_webview/java/src/org/chromium/android_webview/AwContents.java?type=cs&q=setContainerView&sq=package:chromium&l=880 setKeepScreenOn for the previous containerView will be ignored by the android system. The case is playing a video on youtube, click fullscreen playing. the screen will go to sleep after 1 min timeout.
,
Jul 18 2017
Thanks for the report. Could you give me more detailed step, and if possible, a test webview app which the issue can be reproduced with? I just tested this with a simple webview-based app but can't reproduce it. Even in fullscreen mode the power save blocker still holds the on-screen lock to prevent the screen from entering sleep/dimmed mode. It is tested with the accompanying change in AwContentsClientFullScreenTest.java See the tests like testPowerSaveBlockerIsEnabledDuringFullscreenPlayback_*.
,
Aug 25 2017
We also found The issue mentioned by #C6 This can be reproduced with SystemWebviewShell.apk. It Happens for every HTML5 video SampleURL: https://mounirlamouri.github.io/sandbox/fullscreen-orientation.htm [Steps] 1. enter fullscreen 2. pause the video if it's playing 3. play the video 4. exit fullscreen => the handset goes to sleep after screen timeout. The reason is that if user play the video after switching to full screen, FullScreenView (current ContainerView) gains the wakelock. When user leaves full screen, the FullScreenView is detached. The wakelock no longer works. |
||
►
Sign in to add a comment |
||
Comment 1 by boliu@chromium.org
, Jan 17 2017