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

Commit fc9a27aa authored by Hector Dearman's avatar Hector Dearman
Browse files

Add Third Party Cookie API

Bug: 11678084
Change-Id: Ieb74fb6caae3d5a18dbfe748be47ebebad003cf7
parent 1e2f374e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -35174,6 +35174,7 @@ package android.webkit {
  public class CookieManager {
    method public synchronized boolean acceptCookie();
    method public synchronized boolean acceptThirdPartyCookies(android.webkit.WebView);
    method public static boolean allowFileSchemeCookies();
    method public java.lang.String getCookie(java.lang.String);
    method public static synchronized android.webkit.CookieManager getInstance();
@@ -35185,6 +35186,7 @@ package android.webkit {
    method public void removeSessionCookies(android.webkit.ValueCallback<java.lang.Boolean>);
    method public synchronized void setAcceptCookie(boolean);
    method public static void setAcceptFileSchemeCookies(boolean);
    method public synchronized void setAcceptThirdPartyCookies(android.webkit.WebView, boolean);
    method public void setCookie(java.lang.String, java.lang.String);
    method public void setCookie(java.lang.String, java.lang.String, android.webkit.ValueCallback<java.lang.Boolean>);
  }
+30 −1
Original line number Diff line number Diff line
@@ -68,6 +68,35 @@ public class CookieManager {
        throw new MustOverrideException();
    }

    /**
     * Sets whether the {@link WebView} should allow third party cookies to be set.
     * Allowing third party cookies is a per WebView policy and can be set
     * differently on different WebView instances.
     * <p>
     * Apps that target {@link android.os.Build.VERSION_CODES#KITKAT} or below
     * default to allowing third party cookies. Apps targeting
     * {@link android.os.Build.VERSION_CODES#L} or later default to disallowing
     * third party cookies.
     *
     * @param webview the {@link WebView} instance to set the cookie policy on
     * @param accept whether the {@link WebView} instance should accept
     *               third party cookies
     */
    public synchronized void setAcceptThirdPartyCookies(WebView webview,
            boolean accept) {
        throw new MustOverrideException();
    }

    /**
     * Gets whether the {@link WebView} should allow third party cookies to be set.
     *
     * @param webview the {@link WebView} instance to get the cookie policy for
     * @return true if the {@link WebView} accepts third party cookies
     */
    public synchronized boolean acceptThirdPartyCookies(WebView webview) {
        throw new MustOverrideException();
    }

    /**
     * Sets a cookie for the given URL. Any existing cookie with the same host,
     * path and name will be replaced with the new cookie. The cookie being set
+18 −0
Original line number Diff line number Diff line
@@ -499,6 +499,24 @@ public abstract class WebSettings {
        throw new MustOverrideException();
    }

    /**
     * Sets policy for third party cookies.
     * Developers should access this via {@link CookieManager#setShouldAcceptThirdPartyCookies}.
     * @hide Internal API.
     */
    public void setAcceptThirdPartyCookies(boolean accept) {
        throw new MustOverrideException();
    }

    /**
     * Gets policy for third party cookies.
     * Developers should access this via {@link CookieManager#getShouldAcceptThirdPartyCookies}.
     * @hide Internal API
     */
    public boolean getAcceptThirdPartyCookies() {
        throw new MustOverrideException();
    }

    /**
     * Sets the text size of the page. The default is {@link TextSize#NORMAL}.
     *