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

Commit 588c15e5 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Reveal color standard, transfer, and range.

We've already been parsing them for many years, and they're well
defined by other public APIs, so let's reveal them in MediaStore.

Also get some storage-related documentation updated to guide
developers towards replacements in a post-scoped-storage world.

Bug: 140247264, 139185855, 141523097, 139185322
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: Id39a74a9972a330b3f83913b2eef5100ec59627d
parent 2173ac60
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -9805,7 +9805,7 @@ package android.content {
    method public abstract java.io.File[] getExternalCacheDirs();
    method @Nullable public abstract java.io.File getExternalFilesDir(@Nullable String);
    method public abstract java.io.File[] getExternalFilesDirs(String);
    method public abstract java.io.File[] getExternalMediaDirs();
    method @Deprecated public abstract java.io.File[] getExternalMediaDirs();
    method public abstract java.io.File getFileStreamPath(String);
    method public abstract java.io.File getFilesDir();
    method public java.util.concurrent.Executor getMainExecutor();
@@ -25412,6 +25412,9 @@ package android.media {
    field public static final int METADATA_KEY_BITRATE = 20; // 0x14
    field public static final int METADATA_KEY_CAPTURE_FRAMERATE = 25; // 0x19
    field public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; // 0x0
    field public static final int METADATA_KEY_COLOR_RANGE = 37; // 0x25
    field public static final int METADATA_KEY_COLOR_STANDARD = 35; // 0x23
    field public static final int METADATA_KEY_COLOR_TRANSFER = 36; // 0x24
    field public static final int METADATA_KEY_COMPILATION = 15; // 0xf
    field public static final int METADATA_KEY_COMPOSER = 4; // 0x4
    field public static final int METADATA_KEY_DATE = 5; // 0x5
@@ -38749,6 +38752,9 @@ package android.provider {
    field public static final String ARTIST = "artist";
    field public static final String BOOKMARK = "bookmark";
    field public static final String CATEGORY = "category";
    field public static final String COLOR_RANGE = "color_range";
    field public static final String COLOR_STANDARD = "color_standard";
    field public static final String COLOR_TRANSFER = "color_transfer";
    field public static final String DESCRIPTION = "description";
    field public static final String IS_PRIVATE = "isprivate";
    field public static final String LANGUAGE = "language";
+7 −0
Original line number Diff line number Diff line
@@ -1559,7 +1559,14 @@ public abstract class Context {
     * @see Environment#getExternalStorageState(File)
     * @see Environment#isExternalStorageEmulated(File)
     * @see Environment#isExternalStorageRemovable(File)
     * @deprecated These directories still exist and are scanned, but developers
     *             are encouraged to migrate to inserting content into a
     *             {@link MediaStore} collection directly, as any app can
     *             contribute new media to {@link MediaStore} with no
     *             permissions required, starting in
     *             {@link android.os.Build.VERSION_CODES#Q}.
     */
    @Deprecated
    public abstract File[] getExternalMediaDirs();

    /**
+11 −0
Original line number Diff line number Diff line
@@ -35,12 +35,15 @@ import android.annotation.TestApi;
import android.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.net.Uri;
import android.os.MessageQueue.OnFileDescriptorEventListener;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructStat;
import android.util.Log;
import android.util.Size;

import dalvik.system.CloseGuard;
import dalvik.system.VMRuntime;
@@ -204,6 +207,10 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {

    /**
     * Create a new ParcelFileDescriptor accessing a given file.
     * <p>
     * This method should only be used for files that you have direct access to;
     * if you'd like to work with files hosted outside your app, use an API like
     * {@link ContentResolver#openFile(Uri, String, CancellationSignal)}.
     *
     * @param file The file to be opened.
     * @param mode The desired access mode, must be one of
@@ -226,6 +233,10 @@ public class ParcelFileDescriptor implements Parcelable, Closeable {

    /**
     * Create a new ParcelFileDescriptor accessing a given file.
     * <p>
     * This method should only be used for files that you have direct access to;
     * if you'd like to work with files hosted outside your app, use an API like
     * {@link ContentResolver#openFile(Uri, String, CancellationSignal)}.
     *
     * @param file The file to be opened.
     * @param mode The desired access mode, must be one of
+17 −6
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.graphics.Point;
import android.graphics.PostProcessor;
import android.media.ExifInterface;
import android.media.MediaFile;
import android.media.MediaFormat;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -3007,22 +3008,32 @@ public final class MediaStore {
            public static final String BOOKMARK = "bookmark";

            /**
             * The standard of color aspects
             * @hide
             * The color standard of this media file, if available.
             *
             * @see MediaFormat#COLOR_STANDARD_BT709
             * @see MediaFormat#COLOR_STANDARD_BT601_PAL
             * @see MediaFormat#COLOR_STANDARD_BT601_NTSC
             * @see MediaFormat#COLOR_STANDARD_BT2020
             */
            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
            public static final String COLOR_STANDARD = "color_standard";

            /**
             * The transfer of color aspects
             * @hide
             * The color transfer of this media file, if available.
             *
             * @see MediaFormat#COLOR_TRANSFER_LINEAR
             * @see MediaFormat#COLOR_TRANSFER_SDR_VIDEO
             * @see MediaFormat#COLOR_TRANSFER_ST2084
             * @see MediaFormat#COLOR_TRANSFER_HLG
             */
            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
            public static final String COLOR_TRANSFER = "color_transfer";

            /**
             * The range of color aspects
             * @hide
             * The color range of this media file, if available.
             *
             * @see MediaFormat#COLOR_RANGE_LIMITED
             * @see MediaFormat#COLOR_RANGE_FULL
             */
            @Column(value = Cursor.FIELD_TYPE_INTEGER, readOnly = true)
            public static final String COLOR_RANGE = "color_range";
+0 −6
Original line number Diff line number Diff line
@@ -1028,8 +1028,6 @@ public class MediaMetadataRetriever implements AutoCloseable {
     * @see MediaFormat#COLOR_STANDARD_BT601_PAL
     * @see MediaFormat#COLOR_STANDARD_BT601_NTSC
     * @see MediaFormat#COLOR_STANDARD_BT2020
     *
     * @hide
     */
    public static final int METADATA_KEY_COLOR_STANDARD = 35;

@@ -1040,8 +1038,6 @@ public class MediaMetadataRetriever implements AutoCloseable {
     * @see MediaFormat#COLOR_TRANSFER_SDR_VIDEO
     * @see MediaFormat#COLOR_TRANSFER_ST2084
     * @see MediaFormat#COLOR_TRANSFER_HLG
     *
     * @hide
     */
    public static final int METADATA_KEY_COLOR_TRANSFER = 36;

@@ -1050,8 +1046,6 @@ public class MediaMetadataRetriever implements AutoCloseable {
     *
     * @see MediaFormat#COLOR_RANGE_LIMITED
     * @see MediaFormat#COLOR_RANGE_FULL
     *
     * @hide
     */
    public static final int METADATA_KEY_COLOR_RANGE    = 37;
    // Add more here...
Loading