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

Commit 78f5a8aa authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update WebChromeClient FileChooserParams for File System Access API" into main

parents 14391d74 a205bd31
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -58179,12 +58179,16 @@ package android.webkit {
    method public abstract String[] getAcceptTypes();
    method @Nullable public abstract String getFilenameHint();
    method public abstract int getMode();
    method @FlaggedApi("android.webkit.file_system_access") public int getPermissionMode();
    method @Nullable public abstract CharSequence getTitle();
    method public abstract boolean isCaptureEnabled();
    method @Nullable public static android.net.Uri[] parseResult(int, android.content.Intent);
    field public static final int MODE_OPEN = 0; // 0x0
    field @FlaggedApi("android.webkit.file_system_access") 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 = 3; // 0x3
    field @FlaggedApi("android.webkit.file_system_access") public static final int PERMISSION_MODE_READ = 0; // 0x0
    field @FlaggedApi("android.webkit.file_system_access") public static final int PERMISSION_MODE_READ_WRITE = 1; // 0x1
  }
  public abstract class WebHistoryItem implements java.lang.Cloneable {
+37 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.webkit;

import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.Intent;
@@ -25,6 +27,9 @@ import android.net.Uri;
import android.os.Message;
import android.view.View;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class WebChromeClient {

    /**
@@ -551,14 +556,27 @@ public class WebChromeClient {
        public static final int MODE_OPEN = 0;
        /** Like Open but allows multiple files to be selected. */
        public static final int MODE_OPEN_MULTIPLE = 1;
        /** Like Open but allows a folder to be selected. The implementation should enumerate
            all files selected by this operation.
            This feature is not supported at the moment.
            @hide */
        /** Like Open but allows a folder to be selected. */
        @FlaggedApi(android.webkit.Flags.FLAG_FILE_SYSTEM_ACCESS)
        public static final int MODE_OPEN_FOLDER = 2;
        /**  Allows picking a nonexistent file and saving it. */
        public static final int MODE_SAVE = 3;

        /** @hide */
        @IntDef(prefix = { "PERMISSION_MODE_" }, value = {
            PERMISSION_MODE_READ,
            PERMISSION_MODE_READ_WRITE,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface PermissionMode {}

        /** File or directory should be opened for reading only. */
        @FlaggedApi(android.webkit.Flags.FLAG_FILE_SYSTEM_ACCESS)
        public static final int PERMISSION_MODE_READ = 0;
        /** File or directory should be opened for read and write. */
        @FlaggedApi(android.webkit.Flags.FLAG_FILE_SYSTEM_ACCESS)
        public static final int PERMISSION_MODE_READ_WRITE = 1;

        /**
         * Parse the result returned by the file picker activity. This method should be used with
         * {@link #createIntent}. Refer to {@link #createIntent} for how to use it.
@@ -615,6 +633,21 @@ public class WebChromeClient {
        @Nullable
        public abstract String getFilenameHint();

        /**
         * Returns permission mode {@link #PERMISSION_MODE_READ} or
         * {@link #PERMISSION_MODE_READ_WRITE} which indicates the intended mode for opening a file
         * or directory.
         *
         * This can be used to determine whether an Intent such as
         * {@link android.content.Intent#ACTION_OPEN_DOCUMENT} should be used rather than
         * {@link android.content.Intent#ACTION_GET_CONTENT} to choose files.
         */
        @FlaggedApi(Flags.FLAG_FILE_SYSTEM_ACCESS)
        @PermissionMode
        public int getPermissionMode() {
            return PERMISSION_MODE_READ;
        }

        /**
         * Creates an intent that would start a file picker for file selection.
         * The Intent supports choosing files from simple file sources available
+8 −0
Original line number Diff line number Diff line
@@ -26,3 +26,11 @@ flag {
    description: "New feature reduce user-agent for webview"
    bug: "371034303"
}

flag {
    name: "file_system_access"
    is_exported: true
    namespace: "webview"
    description: "New APIs required by File System Access"
    bug: "40101963"
}