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

Commit 6efba22c authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

New roots UX, async, performance, docs.

Yet another iteration from UX on how roots should be ordered.  Since
we no longer categorize by type, remove from public API.  Updated
asset drop with new dividers.

Update public API docs to be explicit about required columns.  Hide
flags and columns that aren't required for third-party apps.

Move remainder of potentially blocking work to AsyncTasks, including
creating directories, picked root resolution, and creation of new
documents once picked.

Improve performance of layouts by removing baseline alignment and
reduce hierarchy depth.  Set alpha on ImageViews directly to avoid
offscreen rendering hit.

Limit returned recents to 45 days.  Show load in recents when still
waiting for backends.  Show empty message when no recents stacks to
create from.  Use unique key when saving recent stacks.

Bug: 10941423, 10819454, 10964412, 10960718
Change-Id: I08cf589dcda7e203acf67928f4d30322ae36ee94
parent 3d52dc9c
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -20985,7 +20985,6 @@ package android.provider {
    field public static final java.lang.String COLUMN_MIME_TYPE = "mime_type";
    field public static final java.lang.String COLUMN_SIZE = "_size";
    field public static final java.lang.String COLUMN_SUMMARY = "summary";
    field public static final int FLAG_DIR_HIDE_GRID_TITLES = 64; // 0x40
    field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10
    field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20
    field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8
@@ -21002,18 +21001,12 @@ package android.provider {
    field public static final java.lang.String COLUMN_ICON = "icon";
    field public static final java.lang.String COLUMN_MIME_TYPES = "mime_types";
    field public static final java.lang.String COLUMN_ROOT_ID = "root_id";
    field public static final java.lang.String COLUMN_ROOT_TYPE = "root_type";
    field public static final java.lang.String COLUMN_SUMMARY = "summary";
    field public static final java.lang.String COLUMN_TITLE = "title";
    field public static final int FLAG_ADVANCED = 4; // 0x4
    field public static final int FLAG_EMPTY = 32; // 0x20
    field public static final int FLAG_LOCAL_ONLY = 2; // 0x2
    field public static final int FLAG_SUPPORTS_CREATE = 1; // 0x1
    field public static final int FLAG_SUPPORTS_RECENTS = 8; // 0x8
    field public static final int FLAG_SUPPORTS_SEARCH = 16; // 0x10
    field public static final int ROOT_TYPE_DEVICE = 3; // 0x3
    field public static final int ROOT_TYPE_SERVICE = 1; // 0x1
    field public static final int ROOT_TYPE_SHORTCUT = 2; // 0x2
    field public static final int FLAG_SUPPORTS_RECENTS = 4; // 0x4
    field public static final int FLAG_SUPPORTS_SEARCH = 8; // 0x8
  }
  public abstract class DocumentsProvider extends android.content.ContentProvider {
+51 −80
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ public final class DocumentsContract {
        /**
         * Unique ID of a document. This ID is both provided by and interpreted
         * by a {@link DocumentsProvider}, and should be treated as an opaque
         * value by client applications.
         * value by client applications. This column is required.
         * <p>
         * Each document must have a unique ID within a provider, but that
         * single document may be included as a child of multiple directories.
@@ -117,7 +117,7 @@ public final class DocumentsContract {
         * Concrete MIME type of a document. For example, "image/png" or
         * "application/pdf" for openable files. A document can also be a
         * directory containing additional documents, which is represented with
         * the {@link #MIME_TYPE_DIR} MIME type.
         * the {@link #MIME_TYPE_DIR} MIME type. This column is required.
         * <p>
         * Type: STRING
         *
@@ -127,15 +127,15 @@ public final class DocumentsContract {

        /**
         * Display name of a document, used as the primary title displayed to a
         * user.
         * user. This column is required.
         * <p>
         * Type: STRING
         */
        public static final String COLUMN_DISPLAY_NAME = OpenableColumns.DISPLAY_NAME;

        /**
         * Summary of a document, which may be shown to a user. The summary may
         * be {@code null}.
         * Summary of a document, which may be shown to a user. This column is
         * optional, and may be {@code null}.
         * <p>
         * Type: STRING
         */
@@ -143,9 +143,9 @@ public final class DocumentsContract {

        /**
         * Timestamp when a document was last modified, in milliseconds since
         * January 1, 1970 00:00:00.0 UTC, or {@code null} if unknown. A
         * {@link DocumentsProvider} can update this field using events from
         * {@link OnCloseListener} or other reliable
         * January 1, 1970 00:00:00.0 UTC. This column is required, and may be
         * {@code null} if unknown. A {@link DocumentsProvider} can update this
         * field using events from {@link OnCloseListener} or other reliable
         * {@link ParcelFileDescriptor} transports.
         * <p>
         * Type: INTEGER (long)
@@ -155,15 +155,16 @@ public final class DocumentsContract {
        public static final String COLUMN_LAST_MODIFIED = "last_modified";

        /**
         * Specific icon resource ID for a document, or {@code null} to use
         * platform default icon based on {@link #COLUMN_MIME_TYPE}.
         * Specific icon resource ID for a document. This column is optional,
         * and may be {@code null} to use a platform-provided default icon based
         * on {@link #COLUMN_MIME_TYPE}.
         * <p>
         * Type: INTEGER (int)
         */
        public static final String COLUMN_ICON = "icon";

        /**
         * Flags that apply to a document.
         * Flags that apply to a document. This column is required.
         * <p>
         * Type: INTEGER (int)
         *
@@ -171,12 +172,13 @@ public final class DocumentsContract {
         * @see #FLAG_SUPPORTS_DELETE
         * @see #FLAG_SUPPORTS_THUMBNAIL
         * @see #FLAG_DIR_PREFERS_GRID
         * @see #FLAG_DIR_SUPPORTS_CREATE
         * @see #FLAG_DIR_PREFERS_LAST_MODIFIED
         */
        public static final String COLUMN_FLAGS = "flags";

        /**
         * Size of a document, in bytes, or {@code null} if unknown.
         * Size of a document, in bytes, or {@code null} if unknown. This column
         * is required.
         * <p>
         * Type: INTEGER (long)
         */
@@ -265,8 +267,9 @@ public final class DocumentsContract {
         *
         * @see #COLUMN_FLAGS
         * @see #FLAG_DIR_PREFERS_GRID
         * @hide
         */
        public static final int FLAG_DIR_HIDE_GRID_TITLES = 1 << 6;
        public static final int FLAG_DIR_HIDE_GRID_TITLES = 1 << 16;
    }

    /**
@@ -282,31 +285,17 @@ public final class DocumentsContract {
        /**
         * Unique ID of a root. This ID is both provided by and interpreted by a
         * {@link DocumentsProvider}, and should be treated as an opaque value
         * by client applications.
         * by client applications. This column is required.
         * <p>
         * Type: STRING
         */
        public static final String COLUMN_ROOT_ID = "root_id";

        /**
         * Type of a root, used for clustering when presenting multiple roots to
         * a user.
         * <p>
         * Type: INTEGER (int)
         *
         * @see #ROOT_TYPE_SERVICE
         * @see #ROOT_TYPE_SHORTCUT
         * @see #ROOT_TYPE_DEVICE
         */
        public static final String COLUMN_ROOT_TYPE = "root_type";

        /**
         * Flags that apply to a root.
         * Flags that apply to a root. This column is required.
         * <p>
         * Type: INTEGER (int)
         *
         * @see #FLAG_ADVANCED
         * @see #FLAG_EMPTY
         * @see #FLAG_LOCAL_ONLY
         * @see #FLAG_SUPPORTS_CREATE
         * @see #FLAG_SUPPORTS_RECENTS
@@ -315,22 +304,23 @@ public final class DocumentsContract {
        public static final String COLUMN_FLAGS = "flags";

        /**
         * Icon resource ID for a root.
         * Icon resource ID for a root. This column is required.
         * <p>
         * Type: INTEGER (int)
         */
        public static final String COLUMN_ICON = "icon";

        /**
         * Title for a root, which will be shown to a user.
         * Title for a root, which will be shown to a user. This column is
         * required.
         * <p>
         * Type: STRING
         */
        public static final String COLUMN_TITLE = "title";

        /**
         * Summary for this root, which may be shown to a user. The summary may
         * be {@code null}.
         * Summary for this root, which may be shown to a user. This column is
         * optional, and may be {@code null}.
         * <p>
         * Type: STRING
         */
@@ -338,7 +328,7 @@ public final class DocumentsContract {

        /**
         * Document which is a directory that represents the top directory of
         * this root.
         * this root. This column is required.
         * <p>
         * Type: STRING
         *
@@ -347,49 +337,26 @@ public final class DocumentsContract {
        public static final String COLUMN_DOCUMENT_ID = "document_id";

        /**
         * Number of bytes available in this root, or {@code null} if unknown or
         * unbounded.
         * Number of bytes available in this root. This column is optional, and
         * may be {@code null} if unknown or unbounded.
         * <p>
         * Type: INTEGER (long)
         */
        public static final String COLUMN_AVAILABLE_BYTES = "available_bytes";

        /**
         * MIME types supported by this root, or {@code null} if the root
         * supports all MIME types. Multiple MIME types can be separated by a
         * newline. For example, a root supporting audio might use
         * "audio/*\napplication/x-flac".
         * MIME types supported by this root. This column is optional, and if
         * {@code null} the root is assumed to support all MIME types. Multiple
         * MIME types can be separated by a newline. For example, a root
         * supporting audio might return "audio/*\napplication/x-flac".
         * <p>
         * Type: String
         * Type: STRING
         */
        public static final String COLUMN_MIME_TYPES = "mime_types";

        /** {@hide} */
        public static final String MIME_TYPE_ITEM = "vnd.android.document/root";

        /**
         * Type of root that represents a storage service, such as a cloud-based
         * service.
         *
         * @see #COLUMN_ROOT_TYPE
         */
        public static final int ROOT_TYPE_SERVICE = 1;

        /**
         * Type of root that represents a shortcut to content that may be
         * available elsewhere through another storage root.
         *
         * @see #COLUMN_ROOT_TYPE
         */
        public static final int ROOT_TYPE_SHORTCUT = 2;

        /**
         * Type of root that represents a physical storage device.
         *
         * @see #COLUMN_ROOT_TYPE
         */
        public static final int ROOT_TYPE_DEVICE = 3;

        /**
         * Flag indicating that at least one directory under this root supports
         * creating content. Roots with this flag will be shown when an
@@ -408,14 +375,6 @@ public final class DocumentsContract {
         */
        public static final int FLAG_LOCAL_ONLY = 1 << 1;

        /**
         * Flag indicating that this root should only be visible to advanced
         * users.
         *
         * @see #COLUMN_FLAGS
         */
        public static final int FLAG_ADVANCED = 1 << 2;

        /**
         * Flag indicating that this root can report recently modified
         * documents.
@@ -423,7 +382,7 @@ public final class DocumentsContract {
         * @see #COLUMN_FLAGS
         * @see DocumentsContract#buildRecentDocumentsUri(String, String)
         */
        public static final int FLAG_SUPPORTS_RECENTS = 1 << 3;
        public static final int FLAG_SUPPORTS_RECENTS = 1 << 2;

        /**
         * Flag indicating that this root supports search.
@@ -432,19 +391,31 @@ public final class DocumentsContract {
         * @see DocumentsProvider#querySearchDocuments(String, String,
         *      String[])
         */
        public static final int FLAG_SUPPORTS_SEARCH = 1 << 4;
        public static final int FLAG_SUPPORTS_SEARCH = 1 << 3;

        /**
         * Flag indicating that this root is currently empty. This may be used
         * to hide the root when opening documents, but the root will still be
         * shown when creating documents and {@link #FLAG_SUPPORTS_CREATE} is
         * also set.
         * also set. If the value of this flag changes, such as when a root
         * becomes non-empty, you must send a content changed notification for
         * {@link DocumentsContract#buildRootsUri(String)}.
         *
         * @see #COLUMN_FLAGS
         * @see DocumentsProvider#querySearchDocuments(String, String,
         *      String[])
         * @see ContentResolver#notifyChange(Uri,
         *      android.database.ContentObserver, boolean)
         * @hide
         */
        public static final int FLAG_EMPTY = 1 << 16;

        /**
         * Flag indicating that this root should only be visible to advanced
         * users.
         *
         * @see #COLUMN_FLAGS
         * @hide
         */
        public static final int FLAG_EMPTY = 1 << 5;
        public static final int FLAG_ADVANCED = 1 << 17;
    }

    /**
−60 B (184 B)
Loading image diff...
+119 B
Loading image diff...
+150 B
Loading image diff...
Loading