Merge pull request #675 from shanujshekhar:shanujs/add-new-apis-exomediadrm

PiperOrigin-RevId: 569205163
This commit is contained in:
Copybara-Service 2023-09-28 09:31:14 -07:00
commit 6d77838a6b
2 changed files with 54 additions and 0 deletions

View File

@ -523,6 +523,40 @@ public interface ExoMediaDrm {
*/
void restoreKeys(byte[] sessionId, byte[] keySetId);
/**
* Removes an offline license.
*
* <p>This method is generally not needed, and should only be used if the preferred approach of
* generating a license release request by passing {@link #KEY_TYPE_RELEASE} to {@link
* #getKeyRequest} is not possible.
*
* <p>This is an optional method, and some implementations may only support it on certain Android
* API levels.
*
* <p>See {@link MediaDrm#removeOfflineLicense(byte[])} for more details.
*
* @param keySetId The {@code keySetId} of the license to remove.
* @throws UnsupportedOperationException if the implementation doesn't support this method.
*/
default void removeOfflineLicense(byte[] keySetId) {
throw new UnsupportedOperationException();
}
/**
* Returns a list of the {@code keySetIds} for all offline licenses.
*
* <p>This is an optional method, and some implementations may only support it on certain Android
* API levels.
*
* <p>See {@link MediaDrm#getOfflineLicenseKeySetIds()} for more details.
*
* @return The list of {@code keySetIds} for all offline licenses.
* @throws UnsupportedOperationException if the implementation doesn't support this method.
*/
default List<byte[]> getOfflineLicenseKeySetIds() {
throw new UnsupportedOperationException();
}
/**
* Returns metrics data for this ExoMediaDrm instance, or {@code null} if metrics are unavailable.
*/

View File

@ -327,6 +327,26 @@ public final class FrameworkMediaDrm implements ExoMediaDrm {
mediaDrm.restoreKeys(sessionId, keySetId);
}
@Override
@UnstableApi
@RequiresApi(29)
public void removeOfflineLicense(byte[] keySetId) {
if (Util.SDK_INT < 29) {
throw new UnsupportedOperationException();
}
mediaDrm.removeOfflineLicense(keySetId);
}
@Override
@UnstableApi
@RequiresApi(29)
public List<byte[]> getOfflineLicenseKeySetIds() {
if (Util.SDK_INT < 29) {
throw new UnsupportedOperationException();
}
return mediaDrm.getOfflineLicenseKeySetIds();
}
@UnstableApi
@Override
@Nullable