Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67ac461a authored by Tao Bai's avatar Tao Bai Committed by Android (Google) Code Review
Browse files

Merge "WebView permission change" into lmp-dev

parents 2f75e7d7 2871febb
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -36715,15 +36715,15 @@ package android.webkit {
    method public boolean hasMimeType(java.lang.String);
  }
  public abstract interface PermissionRequest {
  public abstract class PermissionRequest {
    ctor public PermissionRequest();
    method public abstract void deny();
    method public abstract android.net.Uri getOrigin();
    method public abstract long getResources();
    method public abstract void grant(long);
    field public static final long RESOURCE_AUDIO_CAPTURE = 4L; // 0x4L
    field public static final long RESOURCE_GEOLOCATION = 1L; // 0x1L
    field public static final long RESOURCE_PROTECTED_MEDIA_ID = 8L; // 0x8L
    field public static final long RESOURCE_VIDEO_CAPTURE = 2L; // 0x2L
    method public abstract java.lang.String[] getResources();
    method public abstract void grant(java.lang.String[]);
    field public static final java.lang.String RESOURCE_AUDIO_CAPTURE = "android.webkit.resource.AUDIO_CAPTURE";
    field public static final java.lang.String RESOURCE_PROTECTED_MEDIA_ID = "android.webkit.resource.PROTECTED_MEDIA_ID";
    field public static final java.lang.String RESOURCE_VIDEO_CAPTURE = "android.webkit.resource.VIDEO_CAPTURE";
  }
  public abstract interface PluginStub {
@@ -37102,7 +37102,6 @@ package android.webkit {
    method public boolean pageUp(boolean);
    method public void pauseTimers();
    method public void postUrl(java.lang.String, byte[]);
    method public void preauthorizePermission(android.net.Uri, long);
    method public void reload();
    method public void removeJavascriptInterface(java.lang.String);
    method public void requestFocusNodeHref(android.os.Message);
+16 −14
Original line number Diff line number Diff line
@@ -22,39 +22,41 @@ import android.net.Uri;
 * This interface defines a permission request and is used when web content
 * requests access to protected resources.
 *
 * Either {@link #grant(long) grant()} or {@link #deny()} must be called in UI
 * Either {@link #grant(String[]) grant()} or {@link #deny()} must be called in UI
 * thread to respond to the request.
 */
public interface PermissionRequest {
    /**
     * Resource belongs to geolocation service.
     */
    public final static long RESOURCE_GEOLOCATION = 1 << 0;
public abstract class PermissionRequest {
    /**
     * Resource belongs to video capture device, like camera.
     */
    public final static long RESOURCE_VIDEO_CAPTURE = 1 << 1;
    public final static String RESOURCE_VIDEO_CAPTURE = "android.webkit.resource.VIDEO_CAPTURE";
    /**
     * Resource belongs to audio capture device, like microphone.
     */
    public final static long RESOURCE_AUDIO_CAPTURE = 1 << 2;
    public final static String RESOURCE_AUDIO_CAPTURE = "android.webkit.resource.AUDIO_CAPTURE";
    /**
     * Resource belongs to protected media identifier.
     * After the user grants this resource, the origin can use EME APIs to generate the license
     * requests.
     */
    public final static long RESOURCE_PROTECTED_MEDIA_ID = 1 << 3;
    public final static String RESOURCE_PROTECTED_MEDIA_ID =
            "android.webkit.resource.PROTECTED_MEDIA_ID";

    /**
     * Call this method to get the origin of the web page which is trying to access
     * the restricted resources.
     *
     * @return the origin of web content which attempt to access the restricted
     *         resources.
     */
    public Uri getOrigin();
    public abstract Uri getOrigin();

    /**
     * @return a bit mask of resources the web content wants to access.
     * Call this method to get the resources the web page is trying to access.
     *
     * @return the array of resources the web content wants to access.
     */
    public long getResources();
    public abstract String[] getResources();

    /**
     * Call this method to grant origin the permission to access the given resources.
@@ -66,10 +68,10 @@ public interface PermissionRequest {
     *        This parameter is designed to avoid granting permission by accident
     *        especially when new resources are requested by web content.
     */
    public void grant(long resources);
    public abstract void grant(String[] resources);

    /**
     * Call this method to deny the request.
     */
    public void deny();
    public abstract void deny();
}
+1 −1
Original line number Diff line number Diff line
@@ -298,7 +298,7 @@ public class WebChromeClient {
    /**
     * Notify the host application that web content is requesting permission to
     * access the specified resources and the permission currently isn't granted
     * or denied. The host application must invoke {@link PermissionRequest#grant(long)}
     * or denied. The host application must invoke {@link PermissionRequest#grant(String[])}
     * or {@link PermissionRequest#deny()}.
     *
     * If this method isn't overridden, the permission is denied.
+0 −17
Original line number Diff line number Diff line
@@ -1680,23 +1680,6 @@ public class WebView extends AbsoluteLayout
        mProvider.setWebChromeClient(client);
    }

    /**
     * Preauthorize the given origin to access resources.
     * The authorization only valid for this WebView instance's life cycle and
     * will not retained.
     *
     * In the case that an origin has had resources preauthorized, calls to
     * {@link WebChromeClient#onPermissionRequest(PermissionRequest)} will not be
     * made for those resources from that origin.
     *
     * @param origin the origin authorized to access resources
     * @param resources the resource authorized to be accessed by origin.
     */
    public void preauthorizePermission(Uri origin, long resources) {
        checkThread();
        mProvider.preauthorizePermission(origin, resources);
    }

    /**
     * Sets the Picture listener. This is an interface used to receive
     * notifications of a new Picture.
+0 −2
Original line number Diff line number Diff line
@@ -248,8 +248,6 @@ public interface WebViewProvider {

    public View findHierarchyView(String className, int hashCode);

    public void preauthorizePermission(Uri origin, long resources);

    //-------------------------------------------------------------------------
    // Provider internal methods
    //-------------------------------------------------------------------------