Commit 0b7c67ab authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

🤝 Protect against StrictModeViolation in TWA Permission Store creation.

Change-Id: Ic6bb6ba4ac4caa6afb55739224d827caa3e72989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1628715Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663063}
parent d2350a59
......@@ -68,8 +68,12 @@ public class TrustedWebActivityPermissionStore {
/** Creates a {@link TrustedWebActivityPermissionStore}. */
public TrustedWebActivityPermissionStore() {
mPreferences = ContextUtils.getApplicationContext().getSharedPreferences(
SHARED_PREFS_FILE, Context.MODE_PRIVATE);
// On some versions of Android, creating the Preferences object involves a disk read (to
// check if the Preferences directory exists, not even to read the actual Preferences).
try (StrictModeContext unused = StrictModeContext.allowDiskReads()) {
mPreferences = ContextUtils.getApplicationContext().getSharedPreferences(
SHARED_PREFS_FILE, Context.MODE_PRIVATE);
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment