summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt5
-rw-r--r--core/java/android/webkit/WebSettings.java53
2 files changed, 58 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index e65220bb46c1..f7060f341ace 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -53234,6 +53234,7 @@ package android.webkit {
method public abstract boolean getDomStorageEnabled();
method public abstract java.lang.String getFantasyFontFamily();
method public abstract java.lang.String getFixedFontFamily();
+ method public abstract int getForceDarkMode();
method public abstract boolean getJavaScriptCanOpenWindowsAutomatically();
method public abstract boolean getJavaScriptEnabled();
method public abstract android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
@@ -53280,6 +53281,7 @@ package android.webkit {
method public abstract deprecated void setEnableSmoothTransition(boolean);
method public abstract void setFantasyFontFamily(java.lang.String);
method public abstract void setFixedFontFamily(java.lang.String);
+ method public abstract void setForceDarkMode(int);
method public abstract deprecated void setGeolocationDatabasePath(java.lang.String);
method public abstract void setGeolocationEnabled(boolean);
method public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean);
@@ -53310,6 +53312,9 @@ package android.webkit {
method public abstract void setUserAgentString(java.lang.String);
method public abstract boolean supportMultipleWindows();
method public abstract boolean supportZoom();
+ field public static final int FORCE_DARK_AUTO = 0; // 0x0
+ field public static final int FORCE_DARK_OFF = -1; // 0xffffffff
+ field public static final int FORCE_DARK_ON = 1; // 0x1
field public static final int LOAD_CACHE_ELSE_NETWORK = 1; // 0x1
field public static final int LOAD_CACHE_ONLY = 3; // 0x3
field public static final int LOAD_DEFAULT = -1; // 0xffffffff
diff --git a/core/java/android/webkit/WebSettings.java b/core/java/android/webkit/WebSettings.java
index c30edd30361f..8b9846955c17 100644
--- a/core/java/android/webkit/WebSettings.java
+++ b/core/java/android/webkit/WebSettings.java
@@ -224,6 +224,42 @@ public abstract class WebSettings {
*/
public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2;
+ /** @hide */
+ @IntDef(prefix = { "FORCE_DARK_" }, value = {
+ FORCE_DARK_OFF,
+ FORCE_DARK_AUTO,
+ FORCE_DARK_ON
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface ForceDarkMode {}
+
+ /**
+ * Used with {@link #setForceDarkMode}
+ *
+ * Disable force dark, irrespective of the force dark mode of the WebView parent. In this mode,
+ * WebView content will always be rendered as-is, regardless of whether native views are being
+ * automatically darkened.
+ */
+ public static final int FORCE_DARK_OFF = -1;
+
+ /**
+ * Used with {@link #setForceDarkMode}
+ *
+ * Enable force dark, dependent on the state of the WebView parent. If the WebView parent view
+ * is being automatically rendered in dark mode, then WebView content will be rendered so as to
+ * emulate a dark theme. WebViews that are not attached to the view hierarchy will not be
+ * inverted.
+ */
+ public static final int FORCE_DARK_AUTO = 0;
+
+ /**
+ * Used with {@link #setForceDarkMode}
+ *
+ * Unconditionally enable force dark. In this mode WebView content will always be rendered so
+ * as to emulate a dark theme.
+ */
+ public static final int FORCE_DARK_ON = +1;
+
/**
* Enables dumping the pages navigation cache to a text file. The default
* is {@code false}.
@@ -1429,6 +1465,23 @@ public abstract class WebSettings {
/**
+ * Set the force dark mode for this WebView.
+ */
+ public void setForceDarkMode(@ForceDarkMode int forceDarkMode) {
+ // Stub implementation to satisfy Roboelectrc shadows that don't override this yet.
+ }
+
+ /**
+ * Get the force dark mode for this WebView.
+ *
+ * @return the currently set force dark mode.
+ */
+ public @ForceDarkMode int getForceDarkMode() {
+ // Stub implementation to satisfy Roboelectrc shadows that don't override this yet.
+ return FORCE_DARK_AUTO;
+ }
+
+ /**
* @hide
*/
@IntDef(flag = true, prefix = { "MENU_ITEM_" }, value = {