Move unsetOpenLinksInAPrivateTabIfNecessary() to worker thread to gain some time on start up
Why/User Benefit/User Problem
unsetOpenLinksInAPrivateTabIfNecessary() seems to be called on start of Fenix most of the time. It can take from 50ms to 150ms, although not too sure why, it varies with my starts.
*There is a comment in the method that says :
// Toggle off the open_link_in_private_tab pref if we are no longer set as the default browser
// We do this on a separate thread to alleviate performance issues
However we do lifeCycleScope.launch {...} without calling any other dispatchers to start the Job, which means it runs on the UI thread.
Impact
This is a low hanging fruit with a quick fix. It just has to be changed to a different dispatcher
Acceptance Criteria (how do I know when I’m done?)
unsetOpenLinksInAPrivateTabIfNecessary no longer runs on the Main thread when starting Fenix
┆Issue is synchronized with this Jira Task
QA testing: -Navigate to settings --> Default Browser -If unset as default browser, notice that "Open links in a private tab" should not be clickable
-Alternatively, set the default browser directly from within android's settings -navigate back to the app -click on settings and notice that "open links in a private tab" should not be clickable
Hi, verified as fixed on the latest Nightly Build #20030608 from 1/3 using the following devices: • Google Pixel 3a (Android 9) • Samsung Galaxy S9 (Android 8.0.0) • Samsung Galaxy S7 (Android 7) • OnePlus A3 (Android 6.0.1) • LG Nexus 4 (Android 5.1.1) (checked as per this comment )
✔️ Fenix Settings => "Set as default browser" If Fenix is not set as the default browser the "Open links in private tab" check box is not clickable.
✔️ Set Other browsers as default browser from Android's settings If you re-open Fenix, Settings=>"Set as default browser" the "Open links in private tab" check box is not clickable.
✔️ If you set Fenix as the default browser by enabling it from "Settings" (Android versions >= 7) or from the Android's settings the "Open links in private tab" check box is clickable.
► Video from Google Pixel 3a
