• Nate Fischer's avatar
    AW: fetch flag overrides via ContentProvider · 34df84d5
    Nate Fischer authored
    This CL completes the basic implementation of the flags UI. During
    startup, the embedded WebView implementation will check if the user has
    enabled developer mode, and if so, fetch the flag overrides from the
    service.
    
    This uses a ContentProvider instead of an aidl method on the service
    interface for the sake of a simple synchronous IPC. Although aidl itself
    supports synchronous IPC, the Android framework only supports binding to
    the service asynchronously. We require fully synchronous IPC so we can
    block startup while we fetch the flags.
    
    Now that we've settled on using a ContentProvider to plumb information
    from the developer UI to embedded WebViews, this changes "developer
    mode" to be defined by the ContentProvider's state rather than the
    Service's state, which has the side benefit of simplifying some of the
    Activity/Service code.
    
    We rely on PackageManager APIs to check if developer mode is enabled.
    The check itself should have very little impact to startup time, since
    PackageManager caches its state in RAM. I benchmarked this check (when
    developer mode is disabled) at 0ms on my Google Pixel 2 device. For
    simplicity, we do not care about performance when developer mode is
    enabled, as this is not the usual user experience.
    
    Bug: 981143
    Test: Manual - toggle debug border flag, start WebView shell, see borders
    Test: Benchmark isDeveloperModeEnabled() with System.currentTimeMillis()
    Test: run_android_webview_junit_tests -f *ServiceNamesTest*
    Change-Id: I7cc67d1bdf8f0f2ce0fce714fb359160899354a7
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1977828
    Commit-Queue: Nate Fischer <ntfschr@chromium.org>
    Reviewed-by: default avatarRichard Coles <torne@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#726993}
    34df84d5
BUILD.gn 31 KB