• Matt Reynolds's avatar
    Move WifiPollingPolicy to a global instance · 29212f31
    Matt Reynolds authored
    The WifiPollingPolicy controls how frequently the network location
    provider will initiate Wi-Fi scans. Previously, the policy was attached
    to the WifiDataProvider, which is destroyed when there are no active
    geolocation API calls. Destruction of the provider causes us to lose track
    of our polling policy.
    
    The policy allows the first scan to be performed immediately and schedules
    subsequent scans at regular intervals. When the provider is destroyed and
    recreated rapidly it considers each scan to be "first", which allows many
    Wi-Fi scans to be performed in a short window.
    
    This change moves the policy state to a global instance so it can be saved
    when the provider is destroyed and recreated. The new policy allows the
    first-ever scan to be performed immediately, and subsequent scans may also
    be performed immediately if enough time has lapsed since the previous scan.
    In all other situations, the configured polling interval is enforced.
    
    BUG=764954
    
    Change-Id: I00649dde2a707127e53e0330511172fef4a43471
    Reviewed-on: https://chromium-review.googlesource.com/834988
    Commit-Queue: Matt Reynolds <mattreynolds@chromium.org>
    Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#526782}
    29212f31
wifi_polling_policy.h 3.29 KB