Night Light: Fix guest mode not getting the correct geolocation
In guest mode, Night Light used to be initialized from user prefs before NightLightClient was created, which made it miss getting the initial value of the ScheduleType. Therefore it never triggered a request to get the geoposition to update the correct sunset/sunrise times, and as a result the default 6pm to 6am were used. This made AutoNightLight always turn on for guest mode after 6pm, and since it's ephemeral, it doesn't have any cached geolocations. This CL fixes the order, however, getting the updated geoposition takes a second, so NL might turn on briefly for a second before it turns back off once the correct sunset/sunrise times are set. Hence, this CL also makes sure a stale AutoNightLight notification will be dismissed without affecting whether it should show again in the future. BUG=1106586 TEST=Added a new test. Change-Id: Ifbf0728ef5362bfbe88d50465943dce9fc0444fa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2321719 Commit-Queue: Ahmed Fakhry <afakhry@chromium.org> Reviewed-by:James Cook <jamescook@chromium.org> Cr-Commit-Position: refs/heads/master@{#792400}
Showing
Please register or sign in to comment