summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/webkit/WebSettings.java57
1 files changed, 56 insertions, 1 deletions
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index 280e7dfeac9a..40b38c0d0c6a 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -1554,7 +1554,7 @@ public abstract class WebSettings {
* @see #getForceDark
* @deprecated The "force dark" model previously implemented by WebView was complex
* and didn't interoperate well with current Web standards for
- * prefers-color-scheme and color-scheme. In apps with
+ * {@code prefers-color-scheme} and {@code color-scheme}. In apps with
* {@code targetSdkVersion} ≥ {@link android.os.Build.VERSION_CODES#TIRAMISU}
* this API is a no-op and WebView will always use the dark style defined by web content
* authors if the app's theme is dark. To customize the behavior, refer to
@@ -1602,6 +1602,61 @@ public abstract class WebSettings {
* If Android is applying Force Dark to WebView then WebView will ignore the value of
* this setting and behave as if it were set to true.
*
+ * <p>
+ * The deprecated {@link #setForceDark} and related API are no-ops in apps with
+ * {@code targetSdkVersion} &ge; {@link android.os.Build.VERSION_CODES#TIRAMISU},
+ * but they still apply to apps with
+ * {@code targetSdkVersion} &lt; {@link android.os.Build.VERSION_CODES#TIRAMISU}.
+ *
+ * <p>
+ * The below table summarizes how APIs work with different apps.
+ *
+ * <table border="2" width="85%" align="center" cellpadding="5">
+ * <thead>
+ * <tr>
+ * <th>App</th>
+ * <th>Web content which uses {@code prefers-color-scheme}</th>
+ * <th>Web content which does not use {@code prefers-color-scheme}</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>App with {@code isLightTheme} True or not set</td>
+ * <td>Renders with the light theme defined by the content author.</td>
+ * <td>Renders with the default styling defined by the content author.</td>
+ * </tr>
+ * <tr>
+ * <td>App with Android forceDark in effect</td>
+ * <td>Renders with the dark theme defined by the content author.</td>
+ * <td>Renders with the styling modified to dark colors by an algorithm
+ * if allowed by the content author.</td>
+ * </tr>
+ * <tr>
+ * <td>App with {@code isLightTheme} False,
+ * {@code targetSdkVersion} &lt; {@link android.os.Build.VERSION_CODES#TIRAMISU},
+ * and has {@code FORCE_DARK_AUTO}</td>
+ * <td>Renders with the dark theme defined by the content author.</td>
+ * <td>Renders with the default styling defined by the content author.</td>
+ * </tr>
+ * <tr>
+ * <td>App with {@code isLightTheme} False,
+ * {@code targetSdkVersion} &ge; {@link android.os.Build.VERSION_CODES#TIRAMISU},
+ * and {@code setAlgorithmicDarkening(false)}</td>
+ * <td>Renders with the dark theme defined by the content author.</td>
+ * <td>Renders with the default styling defined by the content author.</td>
+ * </tr>
+ * <tr>
+ * <td>App with {@code isLightTheme} False,
+ * {@code targetSdkVersion} &ge; {@link android.os.Build.VERSION_CODES#TIRAMISU},
+ * and {@code setAlgorithmicDarkening(true)}</td>
+ * <td>Renders with the dark theme defined by the content author.</td>
+ * <td>Renders with the styling modified to dark colors by an algorithm if allowed
+ * by the content author.</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * </p>
+ *
* @param allow allow algorithmic darkening or not.
*/
public void setAlgorithmicDarkeningAllowed(boolean allow) {