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

Commit 24a11d31 authored by Hector Dearman's avatar Hector Dearman
Browse files

Connect WebView Async Cookie APIs

Bug: 14379829
Change-Id: I6b0e0644153a805eccb48d30b0ad3e91babd8093
parent 5d140e4b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -35041,12 +35041,15 @@ package android.webkit {
    method public java.lang.String getCookie(java.lang.String);
    method public static synchronized android.webkit.CookieManager getInstance();
    method public synchronized boolean hasCookies();
    method public void removeAllCookie();
    method public void removeExpiredCookie();
    method public void removeSessionCookie();
    method public deprecated void removeAllCookie();
    method public void removeAllCookies(android.webkit.ValueCallback<java.lang.Boolean>);
    method public deprecated void removeExpiredCookie();
    method public deprecated void removeSessionCookie();
    method public void removeSessionCookies(android.webkit.ValueCallback<java.lang.Boolean>);
    method public synchronized void setAcceptCookie(boolean);
    method public static void setAcceptFileSchemeCookies(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>);
  }
  public final class CookieSyncManager extends android.webkit.WebSyncManager {
+65 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.webkit;

import android.net.WebAddress;
import android.webkit.ValueCallback;

/**
 * Manages the cookies used by an application's {@link WebView} instances.
@@ -72,7 +73,7 @@ public class CookieManager {
     * path and name will be replaced with the new cookie. The cookie being set
     * will be ignored if it is expired.
     *
     * @param url the URL for which the cookie is set
     * @param url the URL for which the cookie is to be set
     * @param value the cookie as a string, using the format of the 'Set-Cookie'
     *              HTTP response header
     */
@@ -80,6 +81,29 @@ public class CookieManager {
        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
     * will be ignored if it is expired.
     * <p>
     * This method is asynchronous.
     * If a {@link ValueCallback} is provided,
     * {@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
     * thread's {@link android.os.Looper} once the operation is complete.
     * The value provided to the callback indicates whether the cookie was set successfully.
     * You can pass {@code null} as the callback if you don't need to know when the operation
     * completes or whether it succeeded, and in this case it is safe to call the method from a
     * thread without a Looper.
     *
     * @param url the URL for which the cookie is to be set
     * @param value the cookie as a string, using the format of the 'Set-Cookie'
     *              HTTP response header
     * @param callback a callback to be executed when the cookie has been set
     */
    public void setCookie(String url, String value, ValueCallback<Boolean> callback) {
        throw new MustOverrideException();
    }

    /**
     * Gets the cookies for the given URL.
     *
@@ -120,18 +144,56 @@ public class CookieManager {
    /**
     * Removes all session cookies, which are cookies without an expiration
     * date.
     * @deprecated use {@link #removeSessionCookies(ValueCallback)} instead.
     */
    public void removeSessionCookie() {
        throw new MustOverrideException();
    }

    /**
     * Removes all session cookies, which are cookies without an expiration
     * date.
     * <p>
     * This method is asynchronous.
     * If a {@link ValueCallback} is provided,
     * {@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
     * thread's {@link android.os.Looper} once the operation is complete.
     * The value provided to the callback indicates whether any cookies were removed.
     * You can pass {@code null} as the callback if you don't need to know when the operation
     * completes or whether any cookie were removed, and in this case it is safe to call the
     * method from a thread without a Looper.
     * @param callback a callback which is executed when the session cookies have been removed
     */
    public void removeSessionCookies(ValueCallback<Boolean> callback) {
        throw new MustOverrideException();
    }

    /**
     * Removes all cookies.
     * @deprecated Use {@link #removeAllCookies(ValueCallback)} instead.
     */
    @Deprecated
    public void removeAllCookie() {
        throw new MustOverrideException();
    }

    /**
     * Removes all cookies.
     * <p>
     * This method is asynchronous.
     * If a {@link ValueCallback} is provided,
     * {@link ValueCallback#onReceiveValue(T) onReceiveValue()} will be called on the current
     * thread's {@link android.os.Looper} once the operation is complete.
     * The value provided to the callback indicates whether any cookies were removed.
     * You can pass {@code null} as the callback if you don't need to know when the operation
     * completes or whether any cookies were removed, and in this case it is safe to call the
     * method from a thread without a Looper.
     * @param callback a callback which is executed when the cookies have been removed
     */
    public void removeAllCookies(ValueCallback<Boolean> callback) {
        throw new MustOverrideException();
    }

    /**
     * Gets whether there are stored cookies.
     *
@@ -153,7 +215,9 @@ public class CookieManager {

    /**
     * Removes all expired cookies.
     * @deprecated The WebView handles removing expired cookies automatically.
     */
    @Deprecated
    public void removeExpiredCookie() {
        throw new MustOverrideException();
    }