New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733857 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 4
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Feature

Blocking:
issue 678288



Sign in to add a comment

Create a Service to query Finch server on WebView's behalf

Project Member Reported by paulmiller@chromium.org, Jun 15 2017

Issue description

Ideally, we'd like to:
- Maximize freshness of Finch seeds used by all WebViews
- Minimize battery/data impact of queries
- Minimize writes to flash storage

The current idea is: the Service should come with WebView/Monochrome and run outside of any other app. The Service should query the Finch server, cache the seed locally, and serve it out to WebViews on request. The Service should get new seeds from the server (delta-compressed) when the seed is too old. WebViews will then cache the seed themselves for use on their next run. (We probably don't want to delta-compress the WebView/Service communication because then the Service would have to remember all past seeds.)

An unresolved question is: how stale should we allow seeds to get before fetching new ones?

Another unresolved question is: when a WebView connects to the Service, and the Service's cached seed is old, should the WebView get the old seed immediately, or should it wait for the new seed from the server, or both? If we wait for the server, the WebView is more likely to die while waiting, and never get the seed. However, if we take both the old and the new seed, that's twice as many flash writes.

See Android Service docs: https://developer.android.com/guide/components/services.html
In particular, the Service should "start" itself so it remains alive for the server's response.

yiyuny@ will own this (crbug doesn't allow non-chromium owners).
 
Status: Available (was: Untriaged)
Moving this out of the bugcop queue

Comment 2 by sgu...@chromium.org, Jun 16 2017

> If we wait for the server, the WebView is more likely to die while waiting

obviously not acceptable.

what do you mean by taking the old and the new seeds: we cannot use both anyway.
What is not acceptable?

If we take both the old and new seeds, then we get the best behavior whether or not WebView survives long enough to get the new seed. If WebView dies before the new seed arrives, it will still have written the old seed to flash, and can use the old seed next time. If WebView survives to get the new seed, then the new seed will overwrite the old seed, and WebView will use the new seed next time. The drawback is twice as many flash writes.

Comment 4 by sgu...@chromium.org, Jun 16 2017

> What is not acceptable?

Webview waiting for something and dying is not acceptable. are you talking about an ANR or sth?

Yes. WebView could crash, or the app containing the WebView could crash, or the system could kill it to free up memory. ♪ It's the ciiircle of liiife... ♪ :) We're just trying to design this in light of the fact that processes die all the time.

Comment 6 by sgu...@chromium.org, Jun 16 2017

I see. Ok I think we are talking about different things. You wrote (or at least I understood) it as if webview was waiting for the service and dying which sounded like dying as a result of waiting, which would not be acceptable - we don't want anything to be blocked in this path.


Project Member

Comment 7 by bugdroid1@chromium.org, Jul 21 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f7857086902db2e23fa374fce4b8ee8378f48e9d

commit f7857086902db2e23fa374fce4b8ee8378f48e9d
Author: yiyuny <yiyuny@google.com>
Date: Fri Jul 21 18:42:36 2017

Add AwVariationsSeedFetchService and refactory VariationsSeedFetcher

The CL add the AwVariationsSeedFetchService which is a JobService to fetch Finch
seed data from the Finch Server. It reuse some of the code from the
VariationsSeedFetcher, so I refactory the class to expose some reusable
function. The download is triggered by AwVariationsConfigurationService which is
a bound Service to managing the Finch seed data system-wide. The fetched seed
data is going to store in the local directory belongs to the Android WebView.
This is just a prototype of the Variations Seed Fetch Service which is one part
of the work of adding Finch to Android WebView, so there will be another CL
related to the AwVariationsConfigurationService.

BUG= 733857 

Review-Url: https://codereview.chromium.org/2975693002
Cr-Commit-Position: refs/heads/master@{#488719}

[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/BUILD.gn
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/java/DEPS
[add] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/java/src/org/chromium/android_webview/AwVariationsSeedFetchService.java
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/javatests/DEPS
[add] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetchServiceTest.java
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/android_webview/test/BUILD.gn
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedFetcher.java
[modify] https://crrev.com/f7857086902db2e23fa374fce4b8ee8378f48e9d/components/variations/android/junit/src/org/chromium/components/variations/firstrun/VariationsSeedFetcherTest.java

Project Member

Comment 8 by bugdroid1@chromium.org, Aug 17 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b627581e27709cefb6b5c49e5b576d43767eb1ee

commit b627581e27709cefb6b5c49e5b576d43767eb1ee
Author: Kyle Milka <kmilka@google.com>
Date: Thu Aug 17 01:03:41 2017

Change asserts in FileUtils.java

Use ThreadUtils.assertOnBackgroundThread() instead of asserting
!ThreadUtils.runningOnUiThread(). This allows these functions to be
called on the UI thread for testing by invoking
ThreadUtils.setThreadAssertsDisabledForTesting(true).

Bug:  733857 
Change-Id: Iad3f75f558b7ec3d4f4f46d7af3ffb3404319200
Reviewed-on: https://chromium-review.googlesource.com/617746
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Commit-Queue: Kyle Milka <kmilka@google.com>
Cr-Commit-Position: refs/heads/master@{#495026}
[modify] https://crrev.com/b627581e27709cefb6b5c49e5b576d43767eb1ee/base/android/java/src/org/chromium/base/FileUtils.java

Project Member

Comment 10 by bugdroid1@chromium.org, Aug 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/48cabf586057327436191edba09869ec0393a8e8

commit 48cabf586057327436191edba09869ec0393a8e8
Author: Kyle Milka <kmilka@google.com>
Date: Tue Aug 22 21:32:35 2017

Add AwVariationsConfigurationService and WebView logic to interact with it

This CL adds the AwVariationsConfigurationService(VCS) which is a bound
service that schedules the seed fetch job, keeps the Finch seed 
updated and shares it with all the WebViews on the system. WebViews will
bind to this service and ask for the Finch seed. When the seed request comes, 
it will first check if the current seed is in the WebView package data 
directory and return it directly if not expired. If the service seed is 
expired and there are no pending or running jobs, the service will schedule 
a seed fetch job to the AwVariationsSeedFetchService. When the new seed is 
fetched, the JobService will bind to the VCS and the new seed will be passed 
via IPC. The VCS stores the seed, passed via IPC, in the WebView package data directory.
The VCS and JobService are run in a separate process, attributed to the WebView package 
process. Because the functionality is just a prototype, the code will 
be landed behind a flag 'enable-webview-variations'.

Bug:  733857 
Change-Id: Ie348030c0a143dfa6bb41d8050b42b687d02fd86
Reviewed-on: https://chromium-review.googlesource.com/614111
Commit-Queue: Kyle Milka <kmilka@google.com>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Gustav Sennton <gsennton@chromium.org>
Reviewed-by: Alexei Svitkine (very slow) <asvitkine@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496449}
[modify] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/BUILD.gn
[modify] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
[modify] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/java/src/org/chromium/android_webview/AwSwitches.java
[delete] https://crrev.com/7efb57195ddce3d625535a477604cb64a6b71893/android_webview/java/src/org/chromium/android_webview/AwVariationsSeedFetchService.java
[add] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsConfigurationService.java
[add] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsSeedFetchService.java
[add] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsSeedHandler.java
[add] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/java/src/org/chromium/android_webview/variations/AwVariationsUtils.java
[delete] https://crrev.com/7efb57195ddce3d625535a477604cb64a6b71893/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetchServiceTest.java
[add] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/javatests/src/org/chromium/android_webview/test/variations/AwVariationsConfigurationServiceTest.java
[modify] https://crrev.com/48cabf586057327436191edba09869ec0393a8e8/android_webview/test/BUILD.gn

Comment 11 by kmilka@google.com, Aug 22 2017

Owner: paulmiller@chromium.org
Cc: -sgu...@chromium.org
Project Member

Comment 13 by bugdroid1@chromium.org, Feb 28 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be

commit 0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be
Author: Paul Miller <paulmiller@google.com>
Date: Wed Feb 28 19:43:39 2018

Combine WebView's services

Combine the crash_receiver_service and variations_service processes into
a single webview_service process. This will save memory when crash and
variations services are used simultaneously.

Combine the crash/ and variations/ Java code into a single services/
directory.

Create ServiceInit.java for common initialization code and to ensure
ContextUtils.initApplicationContext() is called only once per service
process lifetime.

BUG= 733857 

Change-Id: I2588344d3d08d64f37cdd61d70d916438e32bcc4
Reviewed-on: https://chromium-review.googlesource.com/935902
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Reviewed-by: Gustav Sennton <gsennton@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539931}
[modify] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/BUILD.gn
[modify] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumAwInit.java
[modify] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploadJobService.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwMinidumpUploaderDelegate.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwVariationsConfigurationService.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetchService.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedHandler.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/AwVariationsUtils.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/CrashReceiverService.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/ICrashReceiverService.aidl
[add] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/OWNERS
[add] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/README
[add] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/java/src/org/chromium/android_webview/services/ServiceInit.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/javatests/src/org/chromium/android_webview/test/services/AwVariationsConfigurationServiceTest.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/javatests/src/org/chromium/android_webview/test/services/CrashReceiverServiceTest.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/javatests/src/org/chromium/android_webview/test/services/MinidumpUploaderTest.java
[rename] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/javatests/src/org/chromium/android_webview/test/services/VisualStateCallbackTest.java
[modify] https://crrev.com/0a4dae2a1ae3c0bc5fe506f6069d9da8fac1e7be/android_webview/test/BUILD.gn

Project Member

Comment 14 by bugdroid1@chromium.org, Mar 1 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b66db7c43366e0dec86670ab698a7d116ae73075

commit b66db7c43366e0dec86670ab698a7d116ae73075
Author: Paul Miller <paulmiller@google.com>
Date: Thu Mar 01 02:52:39 2018

Unify Android version and channel info

Android has 2 mechanisms for getting the channel: in Java, there's
ChromeVersionConstants, which is generated at build-time using
chrome/VERSION and the $android_channel GN variable. In native, there's
channel_android.cc, which determines channel at run-time from the
package name. Replace the native side with a JNI call to get the Java
constant, to avoid requiring the package name.

WebView needs channel and version info as well as Chrome, so move that
info from ChromeVersionConstants into a new VersionConstants base class
in version_info/. WebView currently adds channel info to UMA data, and
plans to use channel and major version for downloading Finch seeds.

Move Android-specific parts of version_info/ into version_info/android/.

Remove remnants of the "work" channel, which were missed by commit
0d9dc4f2c7aa6c2d41354ddc9650ebada1ca6a83.

BUG= 733857 

Change-Id: I61c952862e907ae666f910f4d386e712f6a52f2e
Reviewed-on: https://chromium-review.googlesource.com/927212
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540003}
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/android_webview/BUILD.gn
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/android_webview/browser/aw_metrics_service_client.cc
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/android_webview/browser/aw_metrics_service_client.h
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/android_webview/java/src/org/chromium/android_webview/AwMetricsServiceClient.java
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/chrome/android/BUILD.gn
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/chrome/android/java/ChromeVersionConstants.java.version
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/chrome/android/java/src/org/chromium/chrome/browser/ChromeVersionInfo.java
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/chrome/common/BUILD.gn
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/chrome/common/channel_info_android.cc
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/BUILD.gn
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/DEPS
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/BUILD.gn
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/OWNERS
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/channel_getter.cc
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/channel_getter.h
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/java/VersionConstants.java.version
[add] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/android/java/src/org/chromium/components/version_info/VersionConstantsBridge.java
[modify] https://crrev.com/b66db7c43366e0dec86670ab698a7d116ae73075/components/version_info/channel.h
[delete] https://crrev.com/d7b61d89e336180d4dcc1779e7959fe14b5710f9/components/version_info/channel_android.cc
[delete] https://crrev.com/d7b61d89e336180d4dcc1779e7959fe14b5710f9/components/version_info/channel_android.h

Project Member

Comment 15 by bugdroid1@chromium.org, Mar 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0b856bd670a186658af622ba5ce696ca1f2d57e6

commit 0b856bd670a186658af622ba5ce696ca1f2d57e6
Author: Paul Miller <paulmiller@google.com>
Date: Tue Mar 13 18:06:30 2018

WebView: Remove prototype Finch services

These are being rewritten according to the "Finch Seed Dissemination in
WebView" design doc.

BUG= 733857 

Change-Id: Ie573c6aeebe7b37450c3a40c57f746f9fad96367
Reviewed-on: https://chromium-review.googlesource.com/959620
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542852}
[modify] https://crrev.com/0b856bd670a186658af622ba5ce696ca1f2d57e6/android_webview/BUILD.gn
[modify] https://crrev.com/0b856bd670a186658af622ba5ce696ca1f2d57e6/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/0b856bd670a186658af622ba5ce696ca1f2d57e6/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumAwInit.java
[delete] https://crrev.com/fc31255b4e94adbbfc11df33a9c95d8b4942f925/android_webview/java/src/org/chromium/android_webview/services/AwVariationsConfigurationService.java
[delete] https://crrev.com/fc31255b4e94adbbfc11df33a9c95d8b4942f925/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetchService.java
[delete] https://crrev.com/fc31255b4e94adbbfc11df33a9c95d8b4942f925/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedHandler.java
[delete] https://crrev.com/fc31255b4e94adbbfc11df33a9c95d8b4942f925/android_webview/java/src/org/chromium/android_webview/services/AwVariationsUtils.java
[delete] https://crrev.com/fc31255b4e94adbbfc11df33a9c95d8b4942f925/android_webview/javatests/src/org/chromium/android_webview/test/services/AwVariationsConfigurationServiceTest.java
[modify] https://crrev.com/0b856bd670a186658af622ba5ce696ca1f2d57e6/android_webview/test/BUILD.gn

Project Member

Comment 16 by bugdroid1@chromium.org, Mar 27 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b4cd3defdb97596c54124ad673ec40b8b582a42f

commit b4cd3defdb97596c54124ad673ec40b8b582a42f
Author: Paul Miller <paulmiller@google.com>
Date: Tue Mar 27 19:34:23 2018

WebView: Serve and load dummy variations seeds

Implement VariationsSeedService in the WebView services process to serve
variations seeds to apps. Implement VariationsSeedLoader to load seeds stored
in the app, and periodically request new seeds from the service, on
WebView startup.

VariationsSeedService replaces AwVariationsConfigurationService. The
remaining AwVariations* functionality (downloading seeds from the remote
variations server into the local WebView service, and serializing the seeds
to and from flash) will be replaced in a separate commit.

Downloading and serializing variations seeds is not yet implemented for
WebView, so use dummy seeds for now (3 KB of zeros, simulating the size
of an actual WebView variations seed).

Enable the new code via either the existing "enable-webview-variations"
flag or the "finch-exp" file. This is an empty file created by AGSA to
indicate we are in the variations experiment.

Run the new tests like so:
$ out/*/bin/run_webview_instrumentation_test_apk -f org.chromium.android_webview.\*.Variations\*

Design document:
https://docs.google.com/document/d/1vLLDfaJb6DQz1RQFthse4i8N_r1wLiVOcLE05i_9KAI/edit?usp=sharing

BUG= 733857 

Change-Id: I1171f7b82276c32ac53ebc1b2d4bec9ed1cfb31d
Reviewed-on: https://chromium-review.googlesource.com/954058
Reviewed-by: Mustafa Emre Acer <meacer@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546205}
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/BUILD.gn
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumAwInit.java
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/VariationsSeedLoader.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/VariationsUtils.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/services/IVariationsSeedServer.aidl
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/services/ServiceInit.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/javatests/src/org/chromium/android_webview/test/services/MockVariationsSeedServer.java
[add] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/javatests/src/org/chromium/android_webview/test/services/VariationsSeedServerTest.java
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/test/BUILD.gn
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/android_webview/test/shell/AndroidManifest.xml
[modify] https://crrev.com/b4cd3defdb97596c54124ad673ec40b8b582a42f/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedFetcher.java

Project Member

Comment 17 by bugdroid1@chromium.org, May 2 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5204eb18ab845ca715a8c256adea21463166c7f5

commit 5204eb18ab845ca715a8c256adea21463166c7f5
Author: Paul Miller <paulmiller@google.com>
Date: Wed May 02 01:44:43 2018

WebView: Read and write variations seeds

Chrome stores the seed in preferences, but WebView doesn't persist preferences.
WebView must save save seeds separately. Serialize with protos, and add
aw_variations_seed.proto to mirror the fields in VariationsSeedFetcher.SeedInfo.
Since writing might not complete successfully, the file format must make
truncation unambiguous. The proto wire format is such that truncation in the
middle of a field will be detected, but truncation between fields is permitted.
But by requiring in code that all SeedInfo fields are present, any truncated
seed file will fail to load.

BUG= 733857 

Change-Id: I7f8d787afed83019c2d891aef419cdf7d593b71c
Reviewed-on: https://chromium-review.googlesource.com/1033823
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555281}
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/BUILD.gn
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/java/src/org/chromium/android_webview/VariationsUtils.java
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedLoaderTest.java
[add] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/javatests/src/org/chromium/android_webview/test/VariationsUtilsTest.java
[add] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java
[add] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/proto/BUILD.gn
[add] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/proto/aw_variations_seed.proto
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/android_webview/test/BUILD.gn
[modify] https://crrev.com/5204eb18ab845ca715a8c256adea21463166c7f5/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedFetcher.java

Project Member

Comment 18 by bugdroid1@chromium.org, May 7 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b

commit eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b
Author: Paul Miller <paulmiller@google.com>
Date: Mon May 07 23:06:19 2018

WebView: Fetch variations seeds

As in each app, the service keeps two seed files: "variations_seed" and
"variations_seed_new", and uses them the same way. New seeds are written
to "variations_seed_new" and then "variations_seed_new" is renamed to
"variations_seed". The service uses the "variations_stamp_file"
similarly as well; while apps use it to rate-limit their requests to the
service, the service uses its own stamp file to rate-limit requests to
the variations seed server.

AwVariationsSeedFetcher (named to avoid confusion with the existing
VariationsSeedFetcher) is a JobService which downloads the seed on
behalf of the service. The job is scheduled whenever an app requests the
seed, and the last job ran at least one day ago. Since WebView is used
frequently, the job will be effectively periodic (with a period of one
day) as long as the device is in use and has network access.

VariationsSeedHolder managers the WebView service's copy of the seed.
Work on the seed is done by posting Runnables (SeedWriter and
SeedUpdater) to a certain background thread, to ensure mutual exclusion.
A SeedWriter job is posted whenever an app requests the seed from the
service; the SeedWriter writes the service's seed to the provided file
descriptor. A SeedUpdater job is posted to update the seed with a newly
downloaded one.

BUG= 733857 

Change-Id: I40763a2cdbb2d70889a8547349c1f550488d5ff5
Reviewed-on: https://chromium-review.googlesource.com/1036852
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Filip Gorski <fgorski@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556599}
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/BUILD.gn
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/apk/java/AndroidManifest.xml
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/java/src/org/chromium/android_webview/VariationsUtils.java
[add] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java
[add] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedHolder.java
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/java/src/org/chromium/android_webview/services/VariationsSeedServer.java
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/javatests/DEPS
[add] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java
[add] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/javatests/src/org/chromium/android_webview/test/VariationsSeedHolderTest.java
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/javatests/src/org/chromium/android_webview/test/util/VariationsTestUtils.java
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/android_webview/test/BUILD.gn
[modify] https://crrev.com/eb4c0e77e61ee2a08c43f297e0bb81bbb7bd8d7b/components/variations/android/java/src/org/chromium/components/variations/firstrun/VariationsSeedFetcher.java

Project Member

Comment 19 by bugdroid1@chromium.org, May 20 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/76b8923965b4bd4ca9c1cabec61f5f83db36fdf3

commit 76b8923965b4bd4ca9c1cabec61f5f83db36fdf3
Author: Paul Miller <paulmiller@google.com>
Date: Sun May 20 23:43:29 2018

WebView: Require charging for variations seed download

This follows the advice of go/power-analysis (internal document). The
download frequency is capped at 1/day anyway, so this shouldn't have
much effect on seed freshness.

BUG= 733857 

Change-Id: Ifceecf6877542af317ea08128af9bdeb5c6fb991
Reviewed-on: https://chromium-review.googlesource.com/1066801
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Commit-Queue: Paul Miller <paulmiller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560209}
[modify] https://crrev.com/76b8923965b4bd4ca9c1cabec61f5f83db36fdf3/android_webview/java/src/org/chromium/android_webview/services/AwVariationsSeedFetcher.java
[modify] https://crrev.com/76b8923965b4bd4ca9c1cabec61f5f83db36fdf3/android_webview/javatests/src/org/chromium/android_webview/test/AwVariationsSeedFetcherTest.java

Comment 20 by aluo@chromium.org, May 21 2018

The M cts bot is red now:

v------>  base::debug::(anonymous namespace)::DebugBreak()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ../../base/debug/debugger_posix.cc:228:5
  00fe9ec7  base::debug::BreakDebugger()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ../../base/debug/debugger_posix.cc:258:0
  00f999c3  logging::LogMessage::~LogMessage()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ../../base/logging.cc:855:7
  01123d2f  PrefRegistry::RegisterPreference(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::unique_ptr<base::Value, std::__ndk1::default_delete<base::Value> >, unsigned int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ../../components/prefs/pref_registry.cc:68:3
  011240a9  PrefRegistrySimple::RegisterStringPref(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, unsigned int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ../../components/prefs/pref_registry_simple.cc:44:3
  02c55565  variations::VariationsSeedStore::RegisterPrefs(PrefRegistrySimple*)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ../../components/variations/variations_seed_store.cc:369:13
  03e43913  variations::VariationsService::RegisterPrefs(PrefRegistrySimple*)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ../../components/variations/service/variations_service.cc:376:3
  00f4fe89  android_webview::AwFieldTrialCreator::CreateLocalState()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ../../android_webview/browser/aw_field_trial_creator.cc:80:3
  00f4ffaf  android_webview::AwFieldTrialCreator::SetUpFieldTrials()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ../../android_webview/browser/aw_field_trial_creator.cc:99:46
  00f412ab  android_webview::AwBrowserMainParts::PreCreateThreads()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ../../android_webview/browser/aw_browser_main_parts.cc:130:29
  01e22a85  content::BrowserMainLoop::PreCreateThreads()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ../../content/browser/browser_main_loop.cc:760:28
  00f4467b  safe_browsing::UrlCheckerDelegate* base::internal::Invoker<base::internal::BindState<safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::*)(), base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> >, safe_browsing::UrlCheckerDelegate* ()>::RunImpl<safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::* const&)(), std::__ndk1::tuple<base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> > const&, 0u>(safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::* const&&&)(), std::__ndk1::tuple<base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> > const&&&, std::__ndk1::integer_sequence<unsigned int, 0u>)  ../../base/bind_internal.h:621:12
  0202469f  content::StartupTaskRunner::RunAllTasksNow()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ../../content/browser/startup_task_runner.cc:44:18
  v------>  content::JNI_BrowserStartupController_FlushStartupTasks(_JNIEnv*, base::android::JavaParamRef<_jclass*> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ../../content/browser/android/browser_startup_controller.cc:65:35
  01ddacbb  Java_org_chromium_content_browser_BrowserStartupController_nativeFlushStartupTasks  

https://logs.chromium.org/v/?s=chromium%2Fbuildbucket%2Fcr-buildbucket.appspot.com%2F8945960539990336016%2F%2B%2Fsteps%2Fstack_tool_with_logcat_dump%2F0%2Fstdout


Latest logs:
[FATAL:pref_registry.cc(68)] Check failed: !defaults_->GetValue(path, nullptr). Trying to register a previously registered pref: variations_compressed_seed
Stack Trace:
  RELADDR   FUNCTION                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            FILE:LINE
  00f9a7ad  logging::LogMessage::~LogMessage()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ../../base/logging.cc:592:29
  01124d31  PrefRegistry::RegisterPreference(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::unique_ptr<base::Value, std::__ndk1::default_delete<base::Value> >, unsigned int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ../../components/prefs/pref_registry.cc:68:3
  011250ab  PrefRegistrySimple::RegisterStringPref(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, unsigned int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ../../components/prefs/pref_registry_simple.cc:44:3
  02c58875  variations::VariationsSeedStore::RegisterPrefs(PrefRegistrySimple*)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ../../components/variations/variations_seed_store.cc:369:13
  03e46d6b  variations::VariationsService::RegisterPrefs(PrefRegistrySimple*)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ../../components/variations/service/variations_service.cc:376:3
  00f50e89  android_webview::AwFieldTrialCreator::CreateLocalState()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ../../android_webview/browser/aw_field_trial_creator.cc:80:3
  00f50fb1  android_webview::AwFieldTrialCreator::SetUpFieldTrials()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ../../android_webview/browser/aw_field_trial_creator.cc:99:46
  00f422ad  android_webview::AwBrowserMainParts::PreCreateThreads()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ../../android_webview/browser/aw_browser_main_parts.cc:130:29
  01e25c6d  content::BrowserMainLoop::PreCreateThreads()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ../../content/browser/browser_main_loop.cc:760:28
  00f4567d  safe_browsing::UrlCheckerDelegate* base::internal::Invoker<base::internal::BindState<safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::*)(), base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> >, safe_browsing::UrlCheckerDelegate* ()>::RunImpl<safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::* const&)(), std::__ndk1::tuple<base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> > const&, 0u>(safe_browsing::UrlCheckerDelegate* (android_webview::AwContentBrowserClient::* const&&&)(), std::__ndk1::tuple<base::internal::UnretainedWrapper<android_webview::AwContentBrowserClient> > const&&&, std::__ndk1::integer_sequence<unsigned int, 0u>)  ../../base/bind_internal.h:621:12
  02027849  content::StartupTaskRunner::RunAllTasksNow()                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ../../content/browser/startup_task_runner.cc:44:18
  v------>  content::JNI_BrowserStartupController_FlushStartupTasks(_JNIEnv*, base::android::JavaParamRef<_jclass*> const&)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ../../content/browser/android/browser_startup_controller.cc:65:35
  01dddea5  Java_org_chromium_content_browser_BrowserStartupController_nativeFlushStartupTasks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  gen/content/public/android/content_jni_headers/content/jni/BrowserStartupController_jni.h:81:0
Stack Data:

latest build link:
https://luci-milo.appspot.com/p/chromium/builders/luci.chromium.ci/Android%20WebView%20M%20%28dbg%29/558
working on that ^ on https://crbug.com/842934
Cc: -kmilka@google.com
Status: Assigned (was: Available)
Status: Fixed (was: Assigned)
Please add the manual verification steps if any .

Sign in to add a comment