summaryrefslogtreecommitdiff
path: root/core/java/android/webkit/WebView.java
diff options
context:
space:
mode:
authorNate Fischer <ntfschr@google.com>2017-10-26 12:28:01 -0700
committerNate Fischer <ntfschr@google.com>2017-10-26 12:28:01 -0700
commit674561a613b45485d20a6300dbf703a2ccfee43d (patch)
tree5e792ebfb2039240c26b412066293a9705664e8d /core/java/android/webkit/WebView.java
parentc4478d5ba3d50c13f58eaec3b0e6383bc93d64bc (diff)
WebView: document requirement for Activity Context
No change to logic, documentation change only. WebView requires an Activity Context in order to work properly (several features depend on this). This CL documents this in each WebView constructor by specifying "Activity Context" for the Context param. This CL also adds a note in WebView(Context) to explain the importance of an Activity Context. Fixes: 67945912 Test: make -j40 docs (manually verify it looks good) Change-Id: I6f84093f7ce39f6bd924fd6e27737f047348d8a4
Diffstat (limited to 'core/java/android/webkit/WebView.java')
-rw-r--r--core/java/android/webkit/WebView.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 3a4bfd686333..bc161bb2d011 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -535,9 +535,13 @@ public class WebView extends AbsoluteLayout
}
/**
- * Constructs a new WebView with a Context object.
+ * Constructs a new WebView with an Activity Context object.
*
- * @param context a Context object used to access application assets
+ * <p class="note"><b>Note:</b> WebView should always be instantiated with an Activity Context.
+ * If instantiated with an Application Context, WebView will be unable to provide several
+ * features, such as JavaScript dialogs and autofill.
+ *
+ * @param context an Activity Context to access application assets
*/
public WebView(Context context) {
this(context, null);
@@ -546,7 +550,7 @@ public class WebView extends AbsoluteLayout
/**
* Constructs a new WebView with layout parameters.
*
- * @param context a Context object used to access application assets
+ * @param context an Activity Context to access application assets
* @param attrs an AttributeSet passed to our parent
*/
public WebView(Context context, AttributeSet attrs) {
@@ -556,7 +560,7 @@ public class WebView extends AbsoluteLayout
/**
* Constructs a new WebView with layout parameters and a default style.
*
- * @param context a Context object used to access application assets
+ * @param context an Activity Context to access application assets
* @param attrs an AttributeSet passed to our parent
* @param defStyleAttr an attribute in the current theme that contains a
* reference to a style resource that supplies default values for
@@ -569,7 +573,7 @@ public class WebView extends AbsoluteLayout
/**
* Constructs a new WebView with layout parameters and a default style.
*
- * @param context a Context object used to access application assets
+ * @param context an Activity Context to access application assets
* @param attrs an AttributeSet passed to our parent
* @param defStyleAttr an attribute in the current theme that contains a
* reference to a style resource that supplies default values for
@@ -586,7 +590,7 @@ public class WebView extends AbsoluteLayout
/**
* Constructs a new WebView with layout parameters and a default style.
*
- * @param context a Context object used to access application assets
+ * @param context an Activity Context to access application assets
* @param attrs an AttributeSet passed to our parent
* @param defStyleAttr an attribute in the current theme that contains a
* reference to a style resource that supplies default values for
@@ -611,7 +615,7 @@ public class WebView extends AbsoluteLayout
* time. This guarantees that these interfaces will be available when the JS
* context is initialized.
*
- * @param context a Context object used to access application assets
+ * @param context an Activity Context to access application assets
* @param attrs an AttributeSet passed to our parent
* @param defStyleAttr an attribute in the current theme that contains a
* reference to a style resource that supplies default values for