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

Issue 716219 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Context.getSharedPreferences can now cause disk writes as of N

Project Member Reported by torne@chromium.org, Apr 27 2017

Issue description

In Android N and later, Context.getSharedPreferences will cause a disk write if the preferences directory doesn't exist, triggering a strict mode violation. This can cause WebView to fail CTS in some cases. Most real apps probably won't see this issue as they likely already touched their preference directory before invoking WebView, but it's not impossible for this to show up in real usage.

There's no way to avoid this so we'll just need to suppress the strict mode violation around the relevant code in WebViewChromiumFactoryProvider.

We should also check if any non-WebView (i.e. Chrome) uses of getSharedPreferences may be affected, though I don't know how much Chrome cares about strict mode violations that only happen on first run.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 28 2017

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

commit fe20a56ce5c36f7a29880586d67ca5e82aea3756
Author: torne <torne@chromium.org>
Date: Fri Apr 28 17:55:16 2017

Allow disk writes while checking webview version pref.

Since N, the preference directory will be created if it doesn't exist
when getSharedPreferences is called. Enable disk writes to prevent a
strict mode violation; this will only happen the first time an app is
started up.

BUG= 716219 

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

[modify] https://crrev.com/fe20a56ce5c36f7a29880586d67ca5e82aea3756/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java

Comment 2 by torne@chromium.org, Apr 28 2017

Labels: Merge-Request-59
Project Member

Comment 3 by sheriffbot@chromium.org, Apr 28 2017

Labels: -Merge-Request-59 Hotlist-Merge-Approved Merge-Approved-59
Your change meets the bar and is auto-approved for M59. Please go ahead and merge the CL to branch 3071 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), gkihumba@(ChromeOS), Abdul Syed@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Project Member

Comment 4 by bugdroid1@chromium.org, Apr 28 2017

Labels: -merge-approved-59 merge-merged-3071
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c5936af34a8293a610623e93e397e04725d3d51f

commit c5936af34a8293a610623e93e397e04725d3d51f
Author: Torne (Richard Coles) <torne@google.com>
Date: Fri Apr 28 19:27:24 2017

Allow disk writes while checking webview version pref.

Since N, the preference directory will be created if it doesn't exist
when getSharedPreferences is called. Enable disk writes to prevent a
strict mode violation; this will only happen the first time an app is
started up.

BUG= 716219 

Review-Url: https://codereview.chromium.org/2846963005
Cr-Commit-Position: refs/heads/master@{#468052}
(cherry picked from commit fe20a56ce5c36f7a29880586d67ca5e82aea3756)

Review-Url: https://codereview.chromium.org/2851833002 .
Cr-Commit-Position: refs/branch-heads/3071@{#300}
Cr-Branched-From: a106f0abbf69dad349d4aaf4bcc4f5d376dd2377-refs/heads/master@{#464641}

[modify] https://crrev.com/c5936af34a8293a610623e93e397e04725d3d51f/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java

Comment 5 by torne@chromium.org, Apr 28 2017

Labels: Merge-Request-58
Alex, is this too late for M58? See b/37752115 for additional context.

Comment 6 by torne@chromium.org, May 2 2017

Labels: -M-59 ReleaseBlock-Stable M-58

Comment 7 by torne@chromium.org, May 2 2017

Cc: amineer@chromium.org

Comment 8 by amin...@google.com, May 5 2017

Approved for M58 branch 3029, please merge by EOD if possible.
Project Member

Comment 9 by bugdroid1@chromium.org, May 5 2017

Labels: merge-merged-3029
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/33e41155e73f47258881df86fc6ce6ee33626ed3

commit 33e41155e73f47258881df86fc6ce6ee33626ed3
Author: Torne (Richard Coles) <torne@google.com>
Date: Fri May 05 19:37:45 2017

Allow disk writes while checking webview version pref.

Since N, the preference directory will be created if it doesn't exist
when getSharedPreferences is called. Enable disk writes to prevent a
strict mode violation; this will only happen the first time an app is
started up.

BUG= 716219 

Review-Url: https://codereview.chromium.org/2846963005
Cr-Commit-Position: refs/heads/master@{#468052}
(cherry picked from commit fe20a56ce5c36f7a29880586d67ca5e82aea3756)

Review-Url: https://codereview.chromium.org/2865733002 .
Cr-Commit-Position: refs/branch-heads/3029@{#806}
Cr-Branched-From: 939b32ee5ba05c396eef3fd992822fcca9a2e262-refs/heads/master@{#454471}

[modify] https://crrev.com/33e41155e73f47258881df86fc6ce6ee33626ed3/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java

Status: Fixed (was: Assigned)
Labels: -Merge-Request-58

Sign in to add a comment