More robust DRM support, including tests.

Based on guidance from the DRM team, we should pass DRM files
directly to MediaMetadataRetriever, which can be used to obtain both
the underlying MIME type and the typical metadata to be indexed.

To help ensure this works correctly and doesn't regress, borrow
strategy from CTS which creates new Forward Locked media items for
testing, and verify that we scan them correctly.

Allow MediaMetadataRetriever to override the MIME type obtained
from a file extension, but only when the primary type agrees with
the extension.  This is the same policy we apply to XMP metadata.

Bug: 141146658
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I494a539a81ed39411a3b59c4433b6520967962c2
This commit is contained in:
Jeff Sharkey
2019-12-06 14:44:18 -07:00
parent 1403ee3ad5
commit 530deca4be
2 changed files with 15 additions and 0 deletions

View File

@@ -13439,6 +13439,7 @@ package android.drm {
method public android.drm.DrmConvertedStatus closeConvertSession(int);
method public android.drm.DrmConvertedStatus convertData(int, byte[]);
method public String[] getAvailableDrmEngines();
method @NonNull public java.util.Collection<android.drm.DrmSupportInfo> getAvailableDrmSupportInfo();
method public android.content.ContentValues getConstraints(String, int);
method public android.content.ContentValues getConstraints(android.net.Uri, int);
method public int getDrmObjectType(String, String);

View File

@@ -16,6 +16,7 @@
package android.drm;
import android.annotation.NonNull;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -37,6 +38,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -369,6 +372,17 @@ public class DrmManagerClient implements AutoCloseable {
return descriptions.toArray(drmEngines);
}
/**
* Retrieves information about all the DRM plug-ins (agents) that are
* registered with the DRM framework.
*
* @return List of all the DRM plug-ins (agents) that are registered with
* the DRM framework.
*/
public @NonNull Collection<DrmSupportInfo> getAvailableDrmSupportInfo() {
return Arrays.asList(_getAllSupportInfo(mUniqueId));
}
/**
* Retrieves constraint information for rights-protected content.
*