From b0e9798e52db931aa49d01acbebb97b897ebf606 Mon Sep 17 00:00:00 2001 From: Tim Volodine Date: Wed, 27 Apr 2016 14:14:09 +0100 Subject: [PATCH] [WebView] Add documentation regarding geolocation api on secure origins. Update to javadoc comments saying that for apps targeting N and up the geolocation api is only supported on secure origins. On non-secure origins requests to geolocation api are automatically denied without calling the corresponding WebChromeClient#onGeolocationPermissionsShowPrompt method. BUG: 28080869 Change-Id: I57726f7f3b3d38db0535f742b1f74c40c1f1ce8b --- core/java/android/webkit/WebChromeClient.java | 7 +++++++ core/java/android/webkit/WebView.java | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java index 4737e9be3f998..2d3b6abbd08a0 100644 --- a/core/java/android/webkit/WebChromeClient.java +++ b/core/java/android/webkit/WebChromeClient.java @@ -284,6 +284,13 @@ public class WebChromeClient { * currently set for that origin. The host application should invoke the * specified callback with the desired permission state. See * {@link GeolocationPermissions} for details. + * + *

Note that for applications targeting Android N and later SDKs + * (API level > {@link android.os.Build.VERSION_CODES#M}) + * this method is only called for requests originating from secure + * origins such as https. On non-secure origins geolocation requests + * are automatically denied.

+ * * @param origin The origin of the web content attempting to use the * Geolocation API. * @param callback The callback to use to set the permission state for the diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index ada77318f2971..f54edf14bbe18 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -255,6 +255,16 @@ import java.util.Map; * is loading. *

* + *

HTML5 Geolocation API support

+ * + *

For applications targeting Android N and later releases + * (API level > {@link android.os.Build.VERSION_CODES#M}) the geolocation api is only supported on + * secure origins such as https. For such applications requests to geolocation api on non-secure + * origins are automatically denied without invoking the corresponding + * {@link WebChromeClient#onGeolocationPermissionsShowPrompt(String, GeolocationPermissions.Callback)} + * method. + *

+ * *

Layout size

*

* It is recommended to set the WebView layout height to a fixed value or to