Using Web Lock to prevent a Webview from freezing

260 views
Skip to first unread message

Shmuel

unread,
Dec 11, 2022, 2:05:03 PM12/11/22
to Chromium-discuss
I am using a WebView to display my website on an Android device. 

In order to prevent the page being frozen, I have added a weblock to the tab (as detailed here) but even so the tab is still being frozen.

I have found at the top of the page a note that opt-out is not functional on Mobile. There is no date as to when this page has been written, and I'm wondering if it still current. If it is, it would potentially explain why my weblock is not preventing the page from being frozen.

PhistucK

unread,
Dec 11, 2022, 6:19:07 PM12/11/22
to samue...@gmail.com, Chromium-discuss
Only visible (active) documents can acquire the screen wake lock. And visible (active) documents (tabs/web views) are never frozen anyway, I believe, so are you talking about backgrounded/inactive/invisible web views? If so, it sounds like this is by design.

PhistucK


--
--
Chromium Discussion mailing list: chromium...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-discuss

---
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-discu...@chromium.org.

Shmuel Yaakov Winegarten

unread,
Dec 12, 2022, 5:25:33 AM12/12/22
to PhistucK, Chromium-discuss
Hi PhistucK and thanks for responding.

You are correct that tab freezing is by design.

There definitely is though a list of heuristics that browsers use to determine whether a tab can be frozen, one of them being whether the tab is holding a WebLock.

There is a note at the top of the page that indicates that opt-out was not functional on mobile browsers at the time of writing.

I am querying if anyone knows whether that is still current.

Thank you

PhistucK

unread,
Dec 12, 2022, 8:29:53 AM12/12/22
to Shmuel Yaakov Winegarten, Chromium-discuss
I believe this mobile being excluded rule is due to the single(/dual in some devices, I guess) active window nature of mobile operating systems.
When the document becomes inactive, the wake lock is automatically released anyway. This is why I am asking about your use case, in order to reply in the context of your use case, rather than a general reply.

(Reading the warning on the page, it said that none of the ways to opt out were supported on mobile, not specifically wake lock (so your wording was a bit confusing before))

If you prefer to wait for someone from the Chrome team that may or may not answer your question, feel free to do so. :)



PhistucK

Shmuel Yaakov Winegarten

unread,
Dec 12, 2022, 8:44:32 AM12/12/22
to PhistucK, Chromium-discuss
Hi PhistucK and thanks for replying.

I'm a little confused, as I've been asking about WebLock, and you have been responding regarding WakeLock.

Am i missing something?

Thanks

Shmuel

PhistucK

unread,
Dec 12, 2022, 8:56:18 AM12/12/22
to Shmuel Yaakov Winegarten, Chromium-discuss
No, sorry, I was missing something! Sorry for confusing wake locks and web locks. :) Carry on, nothing to see here. ;)

PhistucK

Shmuel Yaakov Winegarten

unread,
Dec 12, 2022, 9:07:19 AM12/12/22
to PhistucK, Chromium-discuss
Thanks PhistucK!
Reply all
Reply to author
Forward
0 new messages