diff options
| -rw-r--r-- | core/api/system-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/webkit/WebSettings.java | 20 | ||||
| -rw-r--r-- | core/java/android/webkit/flags.aconfig | 8 |
3 files changed, 29 insertions, 0 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 8edfc21036ad..7781f881b86f 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -18559,6 +18559,7 @@ package android.webkit { method @Deprecated public abstract void setUserAgent(int); method public abstract void setVideoOverlayForEmbeddedEncryptedVideoEnabled(boolean); field public static final long ENABLE_SIMPLIFIED_DARK_MODE = 214741472L; // 0xcccb1e0L + field @FlaggedApi("android.webkit.user_agent_reduction") public static final long ENABLE_USER_AGENT_REDUCTION = 371034303L; // 0x161d88bfL } public class WebStorage { diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java index 7366b9a443c3..ab5969bb381c 100644 --- a/core/java/android/webkit/WebSettings.java +++ b/core/java/android/webkit/WebSettings.java @@ -16,10 +16,12 @@ package android.webkit; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.Nullable; import android.annotation.SystemApi; import android.compat.annotation.ChangeId; +import android.compat.annotation.EnabledAfter; import android.compat.annotation.EnabledSince; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; @@ -151,6 +153,24 @@ public abstract class WebSettings { public static final long ENABLE_SIMPLIFIED_DARK_MODE = 214741472L; /** + * Enable User-Agent Reduction for webview. + * The OS, CPU, and Build information in the default User-Agent will be + * reduced to the static "Linux; Android 10; K" string. + * Minor/build/patch version information in the default User-Agent is + * reduced to "0.0.0". The rest of the default User-Agent remains unchanged. + * + * See https://developers.google.com/privacy-sandbox/protections/user-agent + * for details related to User-Agent Reduction. + * + * @hide + */ + @ChangeId + @EnabledAfter(targetSdkVersion = android.os.Build.VERSION_CODES.VANILLA_ICE_CREAM) + @FlaggedApi(android.webkit.Flags.FLAG_USER_AGENT_REDUCTION) + @SystemApi + public static final long ENABLE_USER_AGENT_REDUCTION = 371034303L; + + /** * Default cache usage mode. If the navigation type doesn't impose any * specific behavior, use cached resources when they are available * and not expired, otherwise load resources from the network. diff --git a/core/java/android/webkit/flags.aconfig b/core/java/android/webkit/flags.aconfig index b21a490cc506..d1013a92476f 100644 --- a/core/java/android/webkit/flags.aconfig +++ b/core/java/android/webkit/flags.aconfig @@ -18,3 +18,11 @@ flag { bug: "310653407" is_fixed_read_only: true } + +flag { + name: "user_agent_reduction" + is_exported: true + namespace: "webview" + description: "New feature reduce user-agent for webview" + bug: "371034303" +} |