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

Commit 1da2179e authored by Selim Gurun's avatar Selim Gurun Committed by Android Git Automerger
Browse files

am bc19d47a: am 773433af: Merge "Address API review" into lmp-dev

* commit 'bc19d47ac43698f48548e703ef6a379e9b79ea04':
  Address API review
parents 7bf01fea ab29dfe7
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -36859,23 +36859,31 @@ package android.webkit {
    method public void onRequestFocus(android.webkit.WebView);
    method public void onShowCustomView(android.view.View, android.webkit.WebChromeClient.CustomViewCallback);
    method public deprecated void onShowCustomView(android.view.View, int, android.webkit.WebChromeClient.CustomViewCallback);
    method public boolean showFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams);
    method public boolean onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams);
  }
  public static abstract interface WebChromeClient.CustomViewCallback {
    method public abstract void onCustomViewHidden();
  }
  public static class WebChromeClient.FileChooserParams {
  public static abstract class WebChromeClient.FileChooserParams {
    ctor public WebChromeClient.FileChooserParams();
    field public static final int MODE_OPEN_FOLDER = 2; // 0x2
    field public static final int MODE_OPEN_MULTIPLE = 1; // 0x1
    field public static final int MODE_SAVE = 4; // 0x4
    field public java.lang.String acceptTypes;
    field public boolean capture;
    field public java.lang.String defaultFilename;
    field public int mode;
    field public java.lang.String title;
    method public abstract java.lang.String[] getAcceptTypes();
    method public abstract java.lang.String getDefaultFilename();
    method public abstract int getMode();
    method public abstract java.lang.CharSequence getTitle();
    method public abstract android.webkit.WebChromeClient.UploadHelper getUploadHelper();
    method public abstract boolean isCaptureEnabled();
    field public static final int OPEN = 0; // 0x0
    field public static final int OPEN_FOLDER = 2; // 0x2
    field public static final int OPEN_MULTIPLE = 1; // 0x1
    field public static final int SAVE = 3; // 0x3
  }
  public static abstract class WebChromeClient.UploadHelper {
    ctor public WebChromeClient.UploadHelper();
    method public abstract android.content.Intent buildIntent();
    method public abstract android.net.Uri[] parseResult(int, android.content.Intent);
  }
  public class WebHistoryItem implements java.lang.Cloneable {
+65 −26
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.webkit;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.graphics.Bitmap;
import android.net.Uri;
@@ -409,55 +410,93 @@ public class WebChromeClient {
     *
     * @see FileChooserParams
     */
    public boolean showFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
    public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback,
            FileChooserParams fileChooserParams) {
        return false;
    }

    /**
     * Parameters used in the {@link #showFileChooser} method.
     * This is intended to be used as a read-only data struct by the application.
     * UploadHelper simplifies file upload operations by providing helper methods that
     * would handle most common file picker/media capture requests. The application
     * can use the helper to build an intent to start a file picker, and then parse
     * the result returned by the activity.
     *
     * How to use:
     * 1. Create a helper using {@link FileChooserParams#getUploadHelper}
     * 2. Build an intent using {@link UploadHelper#buildIntent}
     * 3. Fire the intent using {@link android.app.Activity#startActivityForResult}.
     * 4. Check for ActivityNotFoundException and take a user friendly action if thrown.
     * 5. Listen the result using {@link android.app.Activity#onActivityResult}
     * 6. Parse the result using {@link UploadHelper#parseResult}
     * 7. Send the result using filePathCallback of {@link WebChromeClient#onShowFileChooser}
     */
    public static abstract class UploadHelper {
        /**
         * Returns an intent that would start a file picker for file selection/media capture.
         */
    public static class FileChooserParams {
        // Flags for mode
        /** Bitflag for <code>mode</code> indicating multiple files maybe selected */
        public static final int MODE_OPEN_MULTIPLE = 1 << 0;
        /** Bitflag for <code>mode</code> indicating a folder  maybe selected.
         * The implementation should enumerate all files selected by this operation */
        public static final int MODE_OPEN_FOLDER = 1 << 1;
        /** Bitflag for <code>mode</code> indicating a non-existant filename maybe returned */
        public static final int MODE_SAVE = 1 << 2;
        public abstract Intent buildIntent();

        /**
         * Bit-field of the <code>MODE_</code> flags.
         * Parses the result returned by the file picker activity.
         *
         * 0 indicates plain single file open.
         * @param resultCode the integer result code returned by the file picker activity.
         * @param data the intent returned by the file picker activity.
         * @return the Uris of selected file(s) or null if the resultCode indicates
         *         activity canceled or any other error.
         */
        public int mode;
        public abstract Uri[] parseResult(int resultCode, Intent data);
    }

    /**
         * Comma-seperated list of acceptable MIME types.
     * Parameters used in the {@link #onShowFileChooser} method.
     */
        public String acceptTypes;
    public static abstract class FileChooserParams {
        /** Open single file. Requires that the file exists before allowing the user to pick it. */
        public static final int OPEN = 0;
        /** Like Open but allows multiple files to be selected. */
        public static final int OPEN_MULTIPLE = 1;
        /** Like Open but allows a folder to be selected. The implementation should enumerate
            all files selected by this operation. */
        public static final int OPEN_FOLDER = 2;
        /**  Allows picking a nonexistent file and saving it. */
        public static final int SAVE = 3;

        /**
         * true indicates a preference for a live media captured value (e.g. Camera, Microphone).
         *
         * Use <code>acceptTypes</code> to determine suitable capture devices.
         * Returns a helper to simplify choosing and uploading files. The helper builds a default
         * intent that the application can send using startActivityForResult and processes the
         * results.
         */
        public abstract UploadHelper getUploadHelper();

        /**
         * Returns file chooser mode.
         */
        public abstract int getMode();

        /**
         * Returns an array of acceptable MIME types. The array will be empty if no
         * acceptable types are specified.
         */
        public boolean capture;
        public abstract String[] getAcceptTypes();

        /**
         * The title to use for this file selector, or null.
         * Returns preference for a live media captured value (e.g. Camera, Microphone).
         * True indicates capture is enabled, false disabled.
         *
         * Maybe null, in which case a default title should be used.
         * Use <code>getAcceptTypes</code> to determine suitable capture devices.
         */
        public abstract boolean isCaptureEnabled();

        /**
         * Returns the title to use for this file selector, or null. If null a default
         * title should be used.
         */
        public String title;
        public abstract CharSequence getTitle();

        /**
         * Name of a default selection if appropriate, or null.
         * The file path of a default selection if specified, or null.
         */
        public String defaultFilename;
        public abstract String getDefaultFilename();
    };

    /**