Commit 5192334f authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Add Chrome.Flags.CachedFlag.* KeyPrefix for FeatureUtilities.

It is not currently used, but needs to be there for when a new
feature flag is cached.

Bug: 1022108,1012975

Change-Id: I759940be55dc5ae3bb2d72207a1e376a491324f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1970370
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726146}
parent 3c74037c
......@@ -42,14 +42,13 @@ import java.util.Map;
* startup before native is initialized but are set via native code. The caching is done in
* {@link android.content.SharedPreferences}, which is available in Java immediately.
*
* To add a new cached flag:
* - Create a constant to act as SharedPreferences key in {@link ChromePreferenceKeys}, with the
* value "Chrome.Flags.FooEnabled".
* To cache the flag {@link ChromeFeatureList}.FOO:
* - Call {@link FeatureUtilities#cacheFlag(String, String)} in {@link
* FeatureUtilities#cacheNativeFlags()} passing the new key create above and the {@link
* ChromeFeatureList} flag.
* FeatureUtilities#cacheNativeFlags()} passing
* {@link ChromePreferenceKeys#CACHED_FEATURE_FLAG}.createKey(FOO) and FOO.
* - To query whether the cached flag is enabled in client code, call
* {@link FeatureUtilities#isFlagEnabled(String, boolean)} passing the SharedPreferences key.
* {@link FeatureUtilities#isFlagEnabled(String, boolean)} passing
* {@link ChromePreferenceKeys#CACHED_FEATURE_FLAG}.createKey(FOO).
* Consider this the source of truth for whether the flag is turned on in the current session.
* - When querying whether a cached feature is enabled from native, a @CalledByNative method can be
* exposed in this file to allow feature_utilities.cc to retrieve the cached value.
......
......@@ -343,6 +343,11 @@ public final class ChromePreferenceKeys {
// Keys representing cached feature flags //
////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Cached feature flags generated by FeatureUtilities use this prefix.
*/
public static final KeyPrefix CACHED_FEATURE_FLAG = new KeyPrefix("Chrome.Flags.CachedFlag.*");
/**
* Key for whether DownloadResumptionBackgroundTask should load native in service manager only
* mode.
......@@ -569,6 +574,7 @@ public final class ChromePreferenceKeys {
DATA_REDUCTION_FIRST_ENABLED_TIME,
// Cached feature flags
CACHED_FEATURE_FLAG.pattern(),
SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY,
SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY,
INTEREST_FEED_CONTENT_SUGGESTIONS_KEY,
......
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