summaryrefslogtreecommitdiffstats
path: root/media/java
diff options
context:
space:
mode:
Diffstat (limited to 'media/java')
-rw-r--r--media/java/android/drm/mobile1/DrmConstraintInfo.java96
-rw-r--r--media/java/android/drm/mobile1/DrmException.java34
-rw-r--r--media/java/android/drm/mobile1/DrmRawContent.java464
-rw-r--r--media/java/android/drm/mobile1/DrmRights.java136
-rw-r--r--media/java/android/drm/mobile1/DrmRightsManager.java255
-rw-r--r--media/java/android/drm/mobile1/package.html5
-rw-r--r--media/java/android/media/AudioTrack.java151
-rw-r--r--media/java/android/media/Ringtone.java15
-rw-r--r--media/java/android/media/RingtoneManager.java53
-rw-r--r--media/java/android/media/SoundPool.java469
10 files changed, 451 insertions, 1227 deletions
diff --git a/media/java/android/drm/mobile1/DrmConstraintInfo.java b/media/java/android/drm/mobile1/DrmConstraintInfo.java
deleted file mode 100644
index 50ae8bd..0000000
--- a/media/java/android/drm/mobile1/DrmConstraintInfo.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.drm.mobile1;
-
-import java.util.Date;
-
-/**
- * This class provides interfaces to access the DRM constraint.
- */
-public class DrmConstraintInfo {
- /**
- * The constraint of count.
- */
- private int count;
-
- /**
- * The constraint of start date.
- */
- private long startDate;
-
- /**
- * The constraint of end date.
- */
- private long endDate;
-
- /**
- * The constraint of interval.
- */
- private long interval;
-
- /**
- * Construct the DrmConstraint.
- */
- DrmConstraintInfo() {
- count = -1;
- startDate = -1;
- endDate = -1;
- interval = -1;
- }
-
- /**
- * Get the count constraint.
- *
- * @return the count or -1 if no limit.
- */
- public int getCount() {
- return count;
- }
-
- /**
- * Get the start date constraint.
- *
- * @return the start date or null if no limit.
- */
- public Date getStartDate() {
- if (startDate == -1)
- return null;
-
- return new Date(startDate);
- }
-
- /**
- * Get the end date constraint.
- *
- * @return the end date or null if no limit.
- */
- public Date getEndDate() {
- if (endDate == -1)
- return null;
-
- return new Date(endDate);
- }
-
- /**
- * Get the Interval constraint.
- *
- * @return the interval or -1 if no limit.
- */
- public long getInterval() {
- return interval;
- }
-}
diff --git a/media/java/android/drm/mobile1/DrmException.java b/media/java/android/drm/mobile1/DrmException.java
deleted file mode 100644
index 7b06c92..0000000
--- a/media/java/android/drm/mobile1/DrmException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.drm.mobile1;
-
-import java.io.IOException;
-
-/**
- * A DrmException is thrown to report errors specific to handle DRM content and rights.
- */
-public class DrmException extends Exception
-{
- // TODO: add more specific DRM error codes.
-
- private DrmException() {
- }
-
- public DrmException(String message) {
- super(message);
- }
-}
diff --git a/media/java/android/drm/mobile1/DrmRawContent.java b/media/java/android/drm/mobile1/DrmRawContent.java
deleted file mode 100644
index 046b84a..0000000
--- a/media/java/android/drm/mobile1/DrmRawContent.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.drm.mobile1;
-
-import java.io.*;
-
-/**
- * This class provides interfaces to access the DRM raw content.
- */
-public class DrmRawContent {
- /**
- * The "application/vnd.oma.drm.message" mime type.
- */
- public static final String DRM_MIMETYPE_MESSAGE_STRING = "application/vnd.oma.drm.message";
-
- /**
- * The "application/vnd.oma.drm.content" mime type.
- */
- public static final String DRM_MIMETYPE_CONTENT_STRING = "application/vnd.oma.drm.content";
-
- /**
- * The DRM delivery type: Forward-Lock
- */
- public static final int DRM_FORWARD_LOCK = 1;
-
- /**
- * The DRM delivery type: Combined Delivery
- */
- public static final int DRM_COMBINED_DELIVERY = 2;
-
- /**
- * The DRM delivery type: Separate Delivery
- */
- public static final int DRM_SEPARATE_DELIVERY = 3;
-
- /**
- * The DRM delivery type: Separate Delivery in DRM message
- */
- public static final int DRM_SEPARATE_DELIVERY_DM = 4;
-
- /**
- * The DRM media content length is unknown currently
- */
- public static final int DRM_UNKNOWN_DATA_LEN = -1;
-
-
- /**
- * The id of "application/vnd.oma.drm.message" mime type.
- */
- private static final int DRM_MIMETYPE_MESSAGE = 1;
-
- /**
- * The id of "application/vnd.oma.drm.content" mime type.
- */
- private static final int DRM_MIMETYPE_CONTENT = 2;
-
- /**
- * Successful operation.
- */
- private static final int JNI_DRM_SUCCESS = 0;
-
- /**
- * General failure.
- */
- private static final int JNI_DRM_FAILURE = -1;
-
- /**
- * Indicates the end of the DRM content is reached.
- */
- private static final int JNI_DRM_EOF = -2;
-
- /**
- * The media content length is unknown from native method
- */
- private static final int JNI_DRM_UNKNOWN_DATA_LEN = -3;
-
- /**
- * The member to save the original InputStream data.
- */
- private BufferedInputStream inData;
-
- /**
- * The member to save the original InputStream data length.
- */
- private int inDataLen;
-
- /**
- * The unique id to this DRM content. It will be initialized
- * in constructor by native method. And it will not be changed
- * after initialization.
- */
- private int id;
-
- /**
- * The rights issuer address of this DRM object.
- */
- private String rightsIssuer;
-
- /**
- * The media content type of this DRM object.
- */
- private String mediaType;
-
- /**
- * The delivery method type of this DRM object.
- */
- private int rawType;
-
-
- /**
- * Construct a DrmRawContent object.
- *
- * @param inRawdata object of DRM raw data stream.
- * @param len the length of raw data can be read.
- * @param mimeTypeStr the mime type of the DRM content.
- */
- public DrmRawContent(InputStream inRawdata, int len, String mimeTypeStr) throws DrmException, IOException {
- int mimeType;
-
- id = -1;
- inData = new BufferedInputStream(inRawdata, 1024);
- inDataLen = len;
-
- if (DRM_MIMETYPE_MESSAGE_STRING.equals(mimeTypeStr))
- mimeType = DRM_MIMETYPE_MESSAGE;
- else if (DRM_MIMETYPE_CONTENT_STRING.equals(mimeTypeStr))
- mimeType = DRM_MIMETYPE_CONTENT;
- else
- throw new IllegalArgumentException("mimeType must be DRM_MIMETYPE_MESSAGE or DRM_MIMETYPE_CONTENT");
-
- if (len <= 0)
- throw new IllegalArgumentException("len must be > 0");
-
- /* call native method to initialize this DRM content */
- id = nativeConstructDrmContent(inData, inDataLen, mimeType);
-
- if (JNI_DRM_FAILURE == id)
- throw new DrmException("nativeConstructDrmContent() returned JNI_DRM_FAILURE");
-
- /* init the rights issuer field. */
- rightsIssuer = nativeGetRightsAddress();
-
- /* init the raw content type. */
- rawType = nativeGetDeliveryMethod();
- if (JNI_DRM_FAILURE == rawType)
- throw new DrmException("nativeGetDeliveryMethod() returned JNI_DRM_FAILURE");
-
- /* init the media content type. */
- mediaType = nativeGetContentType();
- if (null == mediaType)
- throw new DrmException("nativeGetContentType() returned null");
- }
-
- /**
- * Get rights address from raw Seperate Delivery content.
- *
- * @return the string of the rights issuer address,
- * or null if no rights issuer.
- */
- public String getRightsAddress() {
- return rightsIssuer;
- }
-
- /**
- * Get the type of the raw DRM content.
- *
- * @return one of the following delivery type of this DRM content:
- * #DRM_FORWARD_LOCK
- * #DRM_COMBINED_DELIVERY
- * #DRM_SEPARATE_DELIVERY
- * #DRM_SEPARATE_DELIVERY_DM
- */
- public int getRawType() {
- return rawType;
- }
-
- /**
- * Get one InputStream object to read decrypted content.
- *
- * @param rights the rights object contain decrypted key.
- *
- * @return the InputStream object of decrypted media content.
- */
- public InputStream getContentInputStream(DrmRights rights) {
- if (null == rights)
- throw new NullPointerException();
-
- return new DrmInputStream(rights);
- }
-
- /**
- * Get the type of the decrypted media content.
- *
- * @return the decrypted media content type of this DRM content.
- */
- public String getContentType() {
- return mediaType;
- }
-
- /**
- * Get the length of the decrypted media content.
- *
- * @param rights the rights object contain decrypted key.
- *
- * @return the length of the decrypted media content.
- * #DRM_UNKNOWN_DATA_LEN if the length is unknown currently.
- */
- public int getContentLength(DrmRights rights) throws DrmException {
- /**
- * Because currently the media object associate with rights object
- * has been handled in native logic, so here it is not need to deal
- * the rights. But for the apps, it is mandatory for user to get
- * the rights object before get the media content length.
- */
- if (null == rights)
- throw new NullPointerException();
-
- int mediaLen = nativeGetContentLength();
-
- if (JNI_DRM_FAILURE == mediaLen)
- throw new DrmException("nativeGetContentLength() returned JNI_DRM_FAILURE");
-
- if (JNI_DRM_UNKNOWN_DATA_LEN == mediaLen)
- return DRM_UNKNOWN_DATA_LEN;
-
- return mediaLen;
- }
-
- /**
- * This class provide a InputStream to the DRM media content.
- */
- class DrmInputStream extends InputStream
- {
- /**
- * The flag to indicate whether this stream is closed or not.
- */
- private boolean isClosed;
-
- /**
- * The offset of this DRM content to be reset.
- */
- private int offset;
-
- /**
- * A byte of data to be readed.
- */
- private byte[] b;
-
- /**
- * Construct a DrmInputStream instance.
- */
- public DrmInputStream(DrmRights rights) {
- /**
- * Because currently the media object associate with rights object
- * has been handled in native logic, so here it is not need to deal
- * the rights. But for the apps, it is mandatory for user to get
- * the rights object before get the media content data.
- */
-
- isClosed = false;
- offset = 0;
- b = new byte[1];
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#available()
- */
- public int available() throws IOException {
- /* call native method to get this DRM decrypted media content length */
- int len = nativeGetContentLength();
-
- if (JNI_DRM_FAILURE == len)
- throw new IOException();
-
- /* if the length is unknown, just return 0 for available value */
- if (JNI_DRM_UNKNOWN_DATA_LEN == len)
- return 0;
-
- int availableLen = len - offset;
- if (availableLen < 0)
- throw new IOException();
-
- return availableLen;
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#read()
- */
- public int read() throws IOException {
- int res;
-
- res = read(b, 0, 1);
-
- if (-1 == res)
- return -1;
-
- return b[0] & 0xff;
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#read(byte)
- */
- public int read(byte[] b) throws IOException {
- return read(b, 0, b.length);
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#read(byte, int, int)
- */
- public int read(byte[] b, int off, int len) throws IOException {
- if (null == b)
- throw new NullPointerException();
- if (off < 0 || len < 0 || off + len > b.length)
- throw new IndexOutOfBoundsException();
- if (true == isClosed)
- throw new IOException();
-
- if (0 == len)
- return 0;
-
- len = nativeReadContent(b, off, len, offset);
-
- if (JNI_DRM_FAILURE == len)
- throw new IOException();
- else if (JNI_DRM_EOF == len)
- return -1;
-
- offset += len;
-
- return len;
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#markSupported()
- */
- public boolean markSupported() {
- return false;
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#mark(int)
- */
- public void mark(int readlimit) {
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#reset()
- */
- public void reset() throws IOException {
- throw new IOException();
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#skip()
- */
- public long skip(long n) throws IOException {
- return 0;
- }
-
- /* Non-javadoc
- * @see java.io.InputStream#close()
- */
- public void close() {
- isClosed = true;
- }
- }
-
- /**
- * native method: construct a DRM content according the mime type.
- *
- * @param data input DRM content data to be parsed.
- * @param len the length of the data.
- * @param mimeType the mime type of this DRM content. the value of this field includes:
- * #DRM_MIMETYPE_MESSAGE
- * #DRM_MIMETYPE_CONTENT
- *
- * @return #the id of the DRM content if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeConstructDrmContent(InputStream data, int len, int mimeType);
-
- /**
- * native method: get this DRM content rights issuer.
- *
- * @return the address of rights issuer if in case of separate delivery.
- * null if not separete delivery, or otherwise.
- */
- private native String nativeGetRightsAddress();
-
- /**
- * native method: get this DRM content delivery type.
- *
- * @return the delivery method, the value may be one of the following:
- * #DRM_FORWARD_LOCK
- * #DRM_COMBINED_DELIVERY
- * #DRM_SEPARATE_DELIVERY
- * #DRM_SEPARATE_DELIVERY_DM
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeGetDeliveryMethod();
-
- /**
- * native method: get a piece of media content data.
- *
- * @param buf the buffer to save DRM media content data.
- * @param bufOff the offset of the buffer to start to save data.
- * @param len the number of byte to read.
- * @param mediaOff the offset of the media content data to start to read.
- *
- * @return the length of the media content data has been read.
- * #JNI_DRM_EOF if reach to end of the media content.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeReadContent(byte[] buf, int bufOff, int len, int mediaOff);
-
- /**
- * native method: get this DRM content type.
- *
- * @return the decrypted media content type.
- * null if fail.
- */
- private native String nativeGetContentType();
-
- /**
- * native method: get this DRM decrypted media content length.
- *
- * @return the length of decrypted media content.
- * #JNI_DRM_FAILURE if fail.
- * #JNI_DRM_UNKNOWN_DATA_LEN if the length is unknown currently.
- */
- private native int nativeGetContentLength();
-
- /**
- * The finalizer of the DRMRawContent. Do some cleanup.
- */
- protected native void finalize();
-
-
- /**
- * Load the shared library to link the native methods.
- */
- static {
- try {
- System.loadLibrary("drm1_jni");
- }
- catch (UnsatisfiedLinkError ule) {
- System.err.println("WARNING: Could not load libdrm1_jni.so");
- }
- }
-}
diff --git a/media/java/android/drm/mobile1/DrmRights.java b/media/java/android/drm/mobile1/DrmRights.java
deleted file mode 100644
index bcccb6a..0000000
--- a/media/java/android/drm/mobile1/DrmRights.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.drm.mobile1;
-
-/**
- * This class provides interfaces to access the DRM rights.
- */
-public class DrmRights {
- /**
- * The DRM permission of play.
- */
- public static final int DRM_PERMISSION_PLAY = 1;
-
- /**
- * The DRM permission of display.
- */
- public static final int DRM_PERMISSION_DISPLAY = 2;
-
- /**
- * The DRM permission of execute.
- */
- public static final int DRM_PERMISSION_EXECUTE = 3;
-
- /**
- * The DRM permission of print.
- */
- public static final int DRM_PERMISSION_PRINT = 4;
-
- /**
- * Successful operation.
- */
- private static final int JNI_DRM_SUCCESS = 0;
-
- /**
- * General failure.
- */
- private static final int JNI_DRM_FAILURE = -1;
-
- /**
- * The uid of this rights object.
- */
- private String roId = "";
-
-
- /**
- * Construct the DrmRights.
- */
- public DrmRights() {
- }
-
- /**
- * Get the constraint of the given permission on this rights object.
- *
- * @param permission the given permission.
- *
- * @return a DrmConstraint instance.
- */
- public DrmConstraintInfo getConstraint(int permission) {
- DrmConstraintInfo c = new DrmConstraintInfo();
-
- /* call native method to get latest constraint information */
- int res = nativeGetConstraintInfo(permission, c);
-
- if (JNI_DRM_FAILURE == res)
- return null;
-
- return c;
- }
-
- /**
- * Consume the rights of the given permission.
- *
- * @param permission the given permission.
- *
- * @return true if consume success.
- * false if consume failure.
- */
- public boolean consumeRights(int permission) {
- /* call native method to consume and update rights */
- int res = nativeConsumeRights(permission);
-
- if (JNI_DRM_FAILURE == res)
- return false;
-
- return true;
- }
-
-
- /**
- * native method: get the constraint information of the given permission.
- *
- * @param permission the given permission.
- * @param constraint the instance of constraint.
- *
- * @return #JNI_DRM_SUCCESS if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeGetConstraintInfo(int permission, DrmConstraintInfo constraint);
-
- /**
- * native method: consume the rights of the given permission.
- *
- * @param permission the given permission.
- *
- * @return #JNI_DRM_SUCCESS if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeConsumeRights(int permission);
-
-
- /**
- * Load the shared library to link the native methods.
- */
- static {
- try {
- System.loadLibrary("drm1_jni");
- }
- catch (UnsatisfiedLinkError ule) {
- System.err.println("WARNING: Could not load libdrm1_jni.so");
- }
- }
-}
diff --git a/media/java/android/drm/mobile1/DrmRightsManager.java b/media/java/android/drm/mobile1/DrmRightsManager.java
deleted file mode 100644
index 1bc36ec..0000000
--- a/media/java/android/drm/mobile1/DrmRightsManager.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.drm.mobile1;
-
-import java.io.*;
-import java.util.*;
-
-/**
- * This class provides interfaces to access the DRM right manager.
- */
-public class DrmRightsManager {
- /**
- * The "application/vnd.oma.drm.rights+xml" mime type.
- */
- public static final String DRM_MIMETYPE_RIGHTS_XML_STRING = "application/vnd.oma.drm.rights+xml";
-
- /**
- * The "application/vnd.oma.drm.rights+wbxml" mime type.
- */
- public static final String DRM_MIMETYPE_RIGHTS_WBXML_STRING = "application/vnd.oma.drm.rights+wbxml";
-
- /**
- * The id of "application/vnd.oma.drm.rights+xml" mime type.
- */
- private static final int DRM_MIMETYPE_RIGHTS_XML = 3;
-
- /**
- * The id of "application/vnd.oma.drm.rights+wbxml" mime type.
- */
- private static final int DRM_MIMETYPE_RIGHTS_WBXML = 4;
-
- /**
- * The id of "application/vnd.oma.drm.message" mime type.
- */
- private static final int DRM_MIMETYPE_MESSAGE = 1;
-
- /**
- * Successful operation.
- */
- private static final int JNI_DRM_SUCCESS = 0;
-
- /**
- * General failure.
- */
- private static final int JNI_DRM_FAILURE = -1;
-
- /**
- * The instance of the rights manager.
- */
- private static DrmRightsManager singleton = null;
-
-
- /**
- * Construct a DrmRightsManager
- */
- protected DrmRightsManager() {
- }
-
- /**
- * Get the DrmRightsManager instance.
- *
- * @return the instance of DrmRightsManager.
- */
- public static synchronized DrmRightsManager getInstance() {
- if (singleton == null) {
- singleton = new DrmRightsManager();
- }
-
- return singleton;
- }
-
- /**
- * Install one DRM rights and return one instance of DrmRights.
- *
- * @param rightsData raw rights data.
- * @param mimeTypeStr the mime type of the rights object.
- *
- * @return the instance of the installed DrmRights.
- */
- public synchronized DrmRights installRights(InputStream rightsData, int len, String mimeTypeStr) throws DrmException, IOException {
- int mimeType = 0;
-
- if (DRM_MIMETYPE_RIGHTS_XML_STRING.equals(mimeTypeStr))
- mimeType = DRM_MIMETYPE_RIGHTS_XML;
- else if (DRM_MIMETYPE_RIGHTS_WBXML_STRING.equals(mimeTypeStr))
- mimeType = DRM_MIMETYPE_RIGHTS_WBXML;
- else if (DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equals(mimeTypeStr))
- mimeType = DRM_MIMETYPE_MESSAGE;
- else
- throw new IllegalArgumentException("mimeType must be DRM_MIMETYPE_RIGHTS_XML or DRM_MIMETYPE_RIGHTS_WBXML or DRM_MIMETYPE_MESSAGE");
-
- if (len <= 0)
- return null;
-
- DrmRights rights = new DrmRights();
-
- /* call native method to install this rights object. */
- int res = nativeInstallDrmRights(rightsData, len, mimeType, rights);
-
- if (JNI_DRM_FAILURE == res)
- throw new DrmException("nativeInstallDrmRights() returned JNI_DRM_FAILURE");
-
- return rights;
- }
-
- /**
- * Query DRM rights of specified DRM raw content.
- *
- * @param content raw content object.
- *
- * @return the instance of DrmRights, or null if there is no rights.
- */
- public synchronized DrmRights queryRights(DrmRawContent content) {
- DrmRights rights = new DrmRights();
-
- /* call native method to query the rights */
- int res = nativeQueryRights(content, rights);
-
- if (JNI_DRM_FAILURE == res)
- return null;
-
- return rights;
- }
-
- /**
- * Get the list of all DRM rights saved in local client.
- *
- * @return the list of all the rights object.
- */
- public synchronized List getRightsList() {
- List rightsList = new ArrayList();
-
- /* call native method to get how many rights object in current agent */
- int num = nativeGetNumOfRights();
-
- if (JNI_DRM_FAILURE == num)
- return null;
-
- if (num > 0) {
- DrmRights[] rightsArray = new DrmRights[num];
- int i;
-
- for (i = 0; i < num; i++)
- rightsArray[i] = new DrmRights();
-
- /* call native method to get all the rights information */
- num = nativeGetRightsList(rightsArray, num);
-
- if (JNI_DRM_FAILURE == num)
- return null;
-
- /* add all rights informations to ArrayList */
- for (i = 0; i < num; i++)
- rightsList.add(rightsArray[i]);
- }
-
- return rightsList;
- }
-
- /**
- * Delete the specified DRM rights object.
- *
- * @param rights the specified rights object to be deleted.
- */
- public synchronized void deleteRights(DrmRights rights) {
- /* call native method to delete the specified rights object */
- int res = nativeDeleteRights(rights);
-
- if (JNI_DRM_FAILURE == res)
- return;
- }
-
-
- /**
- * native method: install rights object to local client.
- *
- * @param data input DRM rights object data to be installed.
- * @param len the length of the data.
- * @param mimeType the mime type of this DRM rights object. the value of this field includes:
- * #DRM_MIMETYPE_RIGHTS_XML
- * #DRM_MIMETYPE_RIGHTS_WBXML
- * @parma rights the instance of DRMRights to be filled.
- *
- * @return #JNI_DRM_SUCCESS if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeInstallDrmRights(InputStream data, int len, int mimeType, DrmRights rights);
-
- /**
- * native method: query the given DRM content's rights object.
- *
- * @param content the given DRM content.
- * @param rights the instance of rights to set if have.
- *
- * @return #JNI_DRM_SUCCESS if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeQueryRights(DrmRawContent content, DrmRights rights);
-
- /**
- * native method: get how many rights object in current DRM agent.
- *
- * @return the number of the rights object.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeGetNumOfRights();
-
- /**
- * native method: get all the rights object in current local agent.
- *
- * @param rights the array instance of rights object.
- * @param numRights how many rights can be saved.
- *
- * @return the number of the rights object has been gotten.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeGetRightsList(DrmRights[] rights, int numRights);
-
- /**
- * native method: delete a specified rights object.
- *
- * @param rights the specified rights object to be deleted.
- *
- * @return #JNI_DRM_SUCCESS if succeed.
- * #JNI_DRM_FAILURE if fail.
- */
- private native int nativeDeleteRights(DrmRights rights);
-
-
- /**
- * Load the shared library to link the native methods.
- */
- static {
- try {
- System.loadLibrary("drm1_jni");
- }
- catch (UnsatisfiedLinkError ule) {
- System.err.println("WARNING: Could not load libdrm1_jni.so");
- }
- }
-}
diff --git a/media/java/android/drm/mobile1/package.html b/media/java/android/drm/mobile1/package.html
deleted file mode 100644
index 1c9bf9d..0000000
--- a/media/java/android/drm/mobile1/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
-<body>
- {@hide}
-</body>
-</html>
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 399eb7b..60eaa92 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -26,7 +26,7 @@ import android.util.Log;
/**
* The AudioTrack class manages and plays a single audio resource for Java applications.
- * It allows streaming PCM audio buffers to the audio hardware for playback. This is
+ * It allows streaming of PCM audio buffers to the audio sink for playback. This is
* achieved by "pushing" the data to the AudioTrack object using one of the
* {@link #write(byte[], int, int)} and {@link #write(short[], int, int)} methods.
*
@@ -53,8 +53,10 @@ import android.util.Log;
* can play before running out of data.<br>
* For an AudioTrack using the static mode, this size is the maximum size of the sound that can
* be played from it.<br>
- * For the streaming mode, data will be written to the hardware in chunks of
+ * For the streaming mode, data will be written to the audio sink in chunks of
* sizes less than or equal to the total buffer size.
+ *
+ * AudioTrack is not final and thus permits subclasses, but such use is not recommended.
*/
public class AudioTrack
{
@@ -130,7 +132,7 @@ public class AudioTrack
private static final int ERROR_NATIVESETUP_NATIVEINITFAILED = -20;
// Events:
- // to keep in sync with frameworks/base/include/media/AudioTrack.h
+ // to keep in sync with frameworks/av/include/media/AudioTrack.h
/**
* Event id denotes when playback head has reached a previously set marker.
*/
@@ -159,9 +161,10 @@ public class AudioTrack
*/
private final Object mPlayStateLock = new Object();
/**
- * Size of the native audio buffer.
+ * Sizes of the native audio buffer.
*/
private int mNativeBufferSizeInBytes = 0;
+ private int mNativeBufferSizeInFrames = 0;
/**
* Handler for marker events coming from the native code.
*/
@@ -171,7 +174,7 @@ public class AudioTrack
*/
private final Looper mInitializationLooper;
/**
- * The audio data sampling rate in Hz.
+ * The audio data source sampling rate in Hz.
*/
private int mSampleRate; // initialized by all constructors
/**
@@ -192,7 +195,7 @@ public class AudioTrack
*/
private int mStreamType = AudioManager.STREAM_MUSIC;
/**
- * The way audio is consumed by the hardware, streaming or static.
+ * The way audio is consumed by the audio sink, streaming or static.
*/
private int mDataLoadMode = MODE_STREAM;
/**
@@ -236,17 +239,20 @@ public class AudioTrack
* {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
* {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
* {@link AudioManager#STREAM_ALARM}, and {@link AudioManager#STREAM_NOTIFICATION}.
- * @param sampleRateInHz the sample rate expressed in Hertz.
+ * @param sampleRateInHz the initial source sample rate expressed in Hz.
* @param channelConfig describes the configuration of the audio channels.
* See {@link AudioFormat#CHANNEL_OUT_MONO} and
* {@link AudioFormat#CHANNEL_OUT_STEREO}
* @param audioFormat the format in which the audio data is represented.
* See {@link AudioFormat#ENCODING_PCM_16BIT} and
* {@link AudioFormat#ENCODING_PCM_8BIT}
- * @param bufferSizeInBytes the total size (in bytes) of the buffer where audio data is read
- * from for playback. If using the AudioTrack in streaming mode, you can write data into
- * this buffer in smaller chunks than this size. If using the AudioTrack in static mode,
- * this is the maximum size of the sound that will be played for this instance.
+ * @param bufferSizeInBytes the total size (in bytes) of the internal buffer where audio data is
+ * read from for playback.
+ * If track's creation mode is {@link #MODE_STREAM}, you can write data into
+ * this buffer in chunks less than or equal to this size, and it is typical to use
+ * chunks of 1/2 of the total size to permit double-buffering.
+ * If the track's creation mode is {@link #MODE_STATIC},
+ * this is the maximum length sample, or audio clip, that can be played by this instance.
* See {@link #getMinBufferSize(int, int, int)} to determine the minimum required buffer size
* for the successful creation of an AudioTrack instance in streaming mode. Using values
* smaller than getMinBufferSize() will result in an initialization failure.
@@ -257,7 +263,7 @@ public class AudioTrack
int bufferSizeInBytes, int mode)
throws IllegalArgumentException {
this(streamType, sampleRateInHz, channelConfig, audioFormat,
- bufferSizeInBytes, mode, 0);
+ bufferSizeInBytes, mode, 0 /*session*/);
}
/**
@@ -267,7 +273,7 @@ public class AudioTrack
* is provided when creating an AudioEffect, this effect will be applied only to audio tracks
* and media players in the same session and not to the output mix.
* When an AudioTrack is created without specifying a session, it will create its own session
- * which can be retreived by calling the {@link #getAudioSessionId()} method.
+ * which can be retrieved by calling the {@link #getAudioSessionId()} method.
* If a non-zero session ID is provided, this AudioTrack will share effects attached to this
* session
* with all other media players or audio tracks in the same session, otherwise a new session
@@ -276,7 +282,7 @@ public class AudioTrack
* {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
* {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
* {@link AudioManager#STREAM_ALARM}, and {@link AudioManager#STREAM_NOTIFICATION}.
- * @param sampleRateInHz the sample rate expressed in Hertz.
+ * @param sampleRateInHz the initial source sample rate expressed in Hz.
* @param channelConfig describes the configuration of the audio channels.
* See {@link AudioFormat#CHANNEL_OUT_MONO} and
* {@link AudioFormat#CHANNEL_OUT_STEREO}
@@ -464,7 +470,7 @@ public class AudioTrack
}
- // Convenience method for the contructor's audio buffer size check.
+ // Convenience method for the constructor's audio buffer size check.
// preconditions:
// mChannelCount is valid
// mAudioFormat is valid
@@ -480,6 +486,7 @@ public class AudioTrack
}
mNativeBufferSizeInBytes = audioBufferSize;
+ mNativeBufferSizeInFrames = audioBufferSize / frameSizeInBytes;
}
@@ -559,7 +566,6 @@ public class AudioTrack
/**
* Returns the configured channel configuration.
-
* See {@link AudioFormat#CHANNEL_OUT_MONO}
* and {@link AudioFormat#CHANNEL_OUT_STEREO}.
*/
@@ -577,8 +583,7 @@ public class AudioTrack
/**
* Returns the state of the AudioTrack instance. This is useful after the
* AudioTrack instance has been created to check if it was initialized
- * properly. This ensures that the appropriate hardware resources have been
- * acquired.
+ * properly. This ensures that the appropriate resources have been acquired.
* @see #STATE_INITIALIZED
* @see #STATE_NO_STATIC_DATA
* @see #STATE_UNINITIALIZED
@@ -600,14 +605,26 @@ public class AudioTrack
}
/**
- * Returns the native frame count used by the hardware.
+ * Returns the "native frame count", derived from the bufferSizeInBytes specified at
+ * creation time and converted to frame units.
+ * If track's creation mode is {@link #MODE_STATIC},
+ * it is equal to the specified bufferSizeInBytes converted to frame units.
+ * If track's creation mode is {@link #MODE_STREAM},
+ * it is typically greater than or equal to the specified bufferSizeInBytes converted to frame
+ * units; it may be rounded up to a larger value if needed by the target device implementation.
+ * @deprecated Only accessible by subclasses, which are not recommended for AudioTrack.
+ * See {@link AudioManager#getProperty(String)} for key
+ * {@link AudioManager#PROPERTY_OUTPUT_FRAMES_PER_BUFFER}.
*/
+ @Deprecated
protected int getNativeFrameCount() {
return native_get_native_frame_count();
}
/**
* Returns marker position expressed in frames.
+ * @return marker position in wrapping frame units similar to {@link #getPlaybackHeadPosition},
+ * or zero if marker is disabled.
*/
public int getNotificationMarkerPosition() {
return native_get_marker_pos();
@@ -615,20 +632,26 @@ public class AudioTrack
/**
* Returns the notification update period expressed in frames.
+ * Zero means that no position update notifications are being delivered.
*/
public int getPositionNotificationPeriod() {
return native_get_pos_update_period();
}
/**
- * Returns the playback head position expressed in frames
+ * Returns the playback head position expressed in frames.
+ * Though the "int" type is signed 32-bits, the value should be reinterpreted as if it is
+ * unsigned 32-bits. That is, the next position after 0x7FFFFFFF is (int) 0x80000000.
+ * This is a continuously advancing counter. It will wrap (overflow) periodically,
+ * for example approximately once every 27:03:11 hours:minutes:seconds at 44.1 kHz.
+ * It is reset to zero by flush(), reload(), and stop().
*/
public int getPlaybackHeadPosition() {
return native_get_position();
}
/**
- * Returns the hardware output sample rate
+ * Returns the output sample rate in Hz for the specified stream type.
*/
static public int getNativeOutputSampleRate(int streamType) {
return native_get_output_sample_rate(streamType);
@@ -639,7 +662,10 @@ public class AudioTrack
* object to be created in the {@link #MODE_STREAM} mode. Note that this size doesn't
* guarantee a smooth playback under load, and higher values should be chosen according to
* the expected frequency at which the buffer will be refilled with additional data to play.
- * @param sampleRateInHz the sample rate expressed in Hertz.
+ * For example, if you intend to dynamically set the source sample rate of an AudioTrack
+ * to a higher value than the initial source sample rate, be sure to configure the buffer size
+ * based on the highest planned sample rate.
+ * @param sampleRateInHz the source sample rate expressed in Hz.
* @param channelConfig describes the configuration of the audio channels.
* See {@link AudioFormat#CHANNEL_OUT_MONO} and
* {@link AudioFormat#CHANNEL_OUT_STEREO}
@@ -647,8 +673,7 @@ public class AudioTrack
* See {@link AudioFormat#ENCODING_PCM_16BIT} and
* {@link AudioFormat#ENCODING_PCM_8BIT}
* @return {@link #ERROR_BAD_VALUE} if an invalid parameter was passed,
- * or {@link #ERROR} if the implementation was unable to query the hardware for its output
- * properties,
+ * or {@link #ERROR} if unable to query for output properties,
* or the minimum buffer size expressed in bytes.
*/
static public int getMinBufferSize(int sampleRateInHz, int channelConfig, int audioFormat) {
@@ -781,10 +806,13 @@ public class AudioTrack
/**
* Sets the playback sample rate for this track. This sets the sampling rate at which
- * the audio data will be consumed and played back, not the original sampling rate of the
- * content. Setting it to half the sample rate of the content will cause the playback to
- * last twice as long, but will also result in a negative pitch shift.
- * The valid sample rate range is from 1Hz to twice the value returned by
+ * the audio data will be consumed and played back
+ * (as set by the sampleRateInHz parameter in the
+ * {@link #AudioTrack(int, int, int, int, int, int)} constructor),
+ * not the original sampling rate of the
+ * content. For example, setting it to half the sample rate of the content will cause the
+ * playback to last twice as long, but will also result in a pitch shift down by one octave.
+ * The valid sample rate range is from 1 Hz to twice the value returned by
* {@link #getNativeOutputSampleRate(int)}.
* @param sampleRateInHz the sample rate expressed in Hz
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
@@ -802,8 +830,11 @@ public class AudioTrack
/**
- * Sets the position of the notification marker.
- * @param markerInFrames marker in frames
+ * Sets the position of the notification marker. At most one marker can be active.
+ * @param markerInFrames marker position in wrapping frame units similar to
+ * {@link #getPlaybackHeadPosition}, or zero to disable the marker.
+ * To set a marker at a position which would appear as zero due to wraparound,
+ * a workaround is to use a non-zero position near zero, such as -1 or 1.
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
*/
@@ -833,6 +864,8 @@ public class AudioTrack
* The track must be stopped or paused for the position to be changed,
* and must use the {@link #MODE_STATIC} mode.
* @param positionInFrames playback head position expressed in frames
+ * Zero corresponds to start of buffer.
+ * The position must not be greater than the buffer size in frames, or negative.
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
*/
@@ -841,18 +874,28 @@ public class AudioTrack
getPlayState() == PLAYSTATE_PLAYING) {
return ERROR_INVALID_OPERATION;
}
+ if (!(0 <= positionInFrames && positionInFrames <= mNativeBufferSizeInFrames)) {
+ return ERROR_BAD_VALUE;
+ }
return native_set_position(positionInFrames);
}
/**
* Sets the loop points and the loop count. The loop can be infinite.
* Similarly to setPlaybackHeadPosition,
- * the track must be stopped or paused for the position to be changed,
+ * the track must be stopped or paused for the loop points to be changed,
* and must use the {@link #MODE_STATIC} mode.
* @param startInFrames loop start marker expressed in frames
+ * Zero corresponds to start of buffer.
+ * The start marker must not be greater than or equal to the buffer size in frames, or negative.
* @param endInFrames loop end marker expressed in frames
+ * The total buffer size in frames corresponds to end of buffer.
+ * The end marker must not be greater than the buffer size in frames.
+ * For looping, the end marker must not be less than or equal to the start marker,
+ * but to disable looping
+ * it is permitted for start marker, end marker, and loop count to all be 0.
* @param loopCount the number of times the loop is looped.
- * A value of -1 means infinite looping.
+ * A value of -1 means infinite looping, and 0 disables looping.
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
*/
@@ -861,14 +904,23 @@ public class AudioTrack
getPlayState() == PLAYSTATE_PLAYING) {
return ERROR_INVALID_OPERATION;
}
+ if (loopCount == 0) {
+ ; // explicitly allowed as an exception to the loop region range check
+ } else if (!(0 <= startInFrames && startInFrames < mNativeBufferSizeInFrames &&
+ startInFrames < endInFrames && endInFrames <= mNativeBufferSizeInFrames)) {
+ return ERROR_BAD_VALUE;
+ }
return native_set_loop(startInFrames, endInFrames, loopCount);
}
/**
- * Sets the initialization state of the instance. To be used in an AudioTrack subclass
- * constructor to set a subclass-specific post-initialization state.
+ * Sets the initialization state of the instance. This method was originally intended to be used
+ * in an AudioTrack subclass constructor to set a subclass-specific post-initialization state.
+ * However, subclasses of AudioTrack are no longer recommended, so this method is obsolete.
* @param state the state of the AudioTrack instance
+ * @deprecated Only accessible by subclasses, which are not recommended for AudioTrack.
*/
+ @Deprecated
protected void setState(int state) {
mState = state;
}
@@ -879,6 +931,7 @@ public class AudioTrack
//--------------------
/**
* Starts playing an AudioTrack.
+ * If track's creation mode is {@link #MODE_STATIC}, you must have called write() prior.
*
* @throws IllegalStateException
*/
@@ -943,7 +996,8 @@ public class AudioTrack
/**
* Flushes the audio data currently queued for playback. Any data that has
- * not been played back will be discarded.
+ * not been played back will be discarded. No-op if not stopped or paused,
+ * or if the track's creation mode is not {@link #MODE_STREAM}.
*/
public void flush() {
if (mState == STATE_INITIALIZED) {
@@ -954,11 +1008,13 @@ public class AudioTrack
}
/**
- * Writes the audio data to the audio hardware for playback. Will block until
- * all data has been written to the audio mixer.
+ * Writes the audio data to the audio sink for playback (streaming mode),
+ * or copies audio data for later playback (static buffer mode).
+ * In streaming mode, will block until all data has been written to the audio sink.
+ * In static buffer mode, copies the data to the buffer starting at offset 0.
* Note that the actual playback of this data might occur after this function
* returns. This function is thread safe with respect to {@link #stop} calls,
- * in which case all of the specified data might not be written to the mixer.
+ * in which case all of the specified data might not be written to the audio sink.
*
* @param audioData the array that holds the data to play.
* @param offsetInBytes the offset expressed in bytes in audioData where the data to play
@@ -995,16 +1051,18 @@ public class AudioTrack
/**
- * Writes the audio data to the audio hardware for playback. Will block until
- * all data has been written to the audio mixer.
+ * Writes the audio data to the audio sink for playback (streaming mode),
+ * or copies audio data for later playback (static buffer mode).
+ * In streaming mode, will block until all data has been written to the audio sink.
+ * In static buffer mode, copies the data to the buffer starting at offset 0.
* Note that the actual playback of this data might occur after this function
* returns. This function is thread safe with respect to {@link #stop} calls,
- * in which case all of the specified data might not be written to the mixer.
+ * in which case all of the specified data might not be written to the audio sink.
*
* @param audioData the array that holds the data to play.
* @param offsetInShorts the offset expressed in shorts in audioData where the data to play
* starts.
- * @param sizeInShorts the number of bytes to read in audioData after the offset.
+ * @param sizeInShorts the number of shorts to read in audioData after the offset.
* @return the number of shorts that were written or {@link #ERROR_INVALID_OPERATION}
* if the object wasn't properly initialized, or {@link #ERROR_BAD_VALUE} if
* the parameters don't resolve to valid data and indexes.
@@ -1037,8 +1095,8 @@ public class AudioTrack
/**
* Notifies the native resource to reuse the audio data already loaded in the native
- * layer. This call is only valid with AudioTrack instances that don't use the streaming
- * model.
+ * layer, that is to rewind to start of buffer.
+ * The track's creation mode must be {@link #MODE_STATIC}.
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
*/
@@ -1079,8 +1137,9 @@ public class AudioTrack
/**
* Sets the send level of the audio track to the attached auxiliary effect
- * {@link #attachAuxEffect(int)}. The level value range is 0 to 1.0.
- * <p>By default the send level is 0, so even if an effect is attached to the player
+ * {@link #attachAuxEffect(int)}. The level value range is 0.0f to 1.0f.
+ * Values are clamped to the (0.0f, 1.0f) interval if outside this range.
+ * <p>By default the send level is 0.0f, so even if an effect is attached to the player
* this method must be called for the effect to be applied.
* <p>Note that the passed level value is a raw scalar. UI controls should be scaled
* logarithmically: the gain applied by audio framework ranges from -72dB to 0dB,
diff --git a/media/java/android/media/Ringtone.java b/media/java/android/media/Ringtone.java
index ebbfad9..c335e55 100644
--- a/media/java/android/media/Ringtone.java
+++ b/media/java/android/media/Ringtone.java
@@ -24,7 +24,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Binder;
import android.os.RemoteException;
-import android.provider.DrmStore;
import android.provider.MediaStore;
import android.provider.Settings;
import android.util.Log;
@@ -50,12 +49,6 @@ public class Ringtone {
MediaStore.Audio.Media.TITLE
};
- private static final String[] DRM_COLUMNS = new String[] {
- DrmStore.Audio._ID,
- DrmStore.Audio.DATA,
- DrmStore.Audio.TITLE
- };
-
private final Context mContext;
private final AudioManager mAudioManager;
private final boolean mAllowRemote;
@@ -101,8 +94,8 @@ public class Ringtone {
}
/**
- * Returns a human-presentable title for ringtone. Looks in media and DRM
- * content providers. If not in either, uses the filename
+ * Returns a human-presentable title for ringtone. Looks in media
+ * content provider. If not in either, uses the filename
*
* @param context A context used for querying.
*/
@@ -131,9 +124,7 @@ public class Ringtone {
}
} else {
try {
- if (DrmStore.AUTHORITY.equals(authority)) {
- cursor = res.query(uri, DRM_COLUMNS, null, null, null);
- } else if (MediaStore.AUTHORITY.equals(authority)) {
+ if (MediaStore.AUTHORITY.equals(authority)) {
cursor = res.query(uri, MEDIA_COLUMNS, null, null, null);
}
} catch (SecurityException e) {
diff --git a/media/java/android/media/RingtoneManager.java b/media/java/android/media/RingtoneManager.java
index 5e18bfa..8e4004b 100644
--- a/media/java/android/media/RingtoneManager.java
+++ b/media/java/android/media/RingtoneManager.java
@@ -27,7 +27,6 @@ import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.net.Uri;
import android.os.Environment;
-import android.provider.DrmStore;
import android.provider.MediaStore;
import android.provider.Settings;
import android.provider.Settings.System;
@@ -85,7 +84,6 @@ public class RingtoneManager {
* {@link #EXTRA_RINGTONE_SHOW_DEFAULT},
* {@link #EXTRA_RINGTONE_SHOW_SILENT}, {@link #EXTRA_RINGTONE_TYPE},
* {@link #EXTRA_RINGTONE_DEFAULT_URI}, {@link #EXTRA_RINGTONE_TITLE},
- * {@link #EXTRA_RINGTONE_INCLUDE_DRM}.
* <p>
* Output: {@link #EXTRA_RINGTONE_PICKED_URI}.
*/
@@ -113,7 +111,9 @@ public class RingtoneManager {
/**
* Given to the ringtone picker as a boolean. Whether to include DRM ringtones.
+ * @deprecated DRM ringtones are no longer supported
*/
+ @Deprecated
public static final String EXTRA_RINGTONE_INCLUDE_DRM =
"android.intent.extra.ringtone.INCLUDE_DRM";
@@ -183,12 +183,6 @@ public class RingtoneManager {
MediaStore.Audio.Media.TITLE_KEY
};
- private static final String[] DRM_COLUMNS = new String[] {
- DrmStore.Audio._ID, DrmStore.Audio.TITLE,
- "\"" + DrmStore.Audio.CONTENT_URI + "\"",
- DrmStore.Audio.TITLE + " AS " + MediaStore.Audio.Media.TITLE_KEY
- };
-
private static final String[] MEDIA_COLUMNS = new String[] {
MediaStore.Audio.Media._ID, MediaStore.Audio.Media.TITLE,
"\"" + MediaStore.Audio.Media.EXTERNAL_CONTENT_URI + "\"",
@@ -228,8 +222,6 @@ public class RingtoneManager {
private boolean mStopPreviousRingtone = true;
private Ringtone mPreviousRingtone;
-
- private boolean mIncludeDrm;
/**
* Constructs a RingtoneManager. This constructor is recommended as its
@@ -328,18 +320,26 @@ public class RingtoneManager {
*
* @return Whether DRM ringtones will be included.
* @see #setIncludeDrm(boolean)
+ * Obsolete - always returns false
+ * @deprecated DRM ringtones are no longer supported
*/
+ @Deprecated
public boolean getIncludeDrm() {
- return mIncludeDrm;
+ return false;
}
/**
* Sets whether to include DRM ringtones.
*
* @param includeDrm Whether to include DRM ringtones.
+ * Obsolete - no longer has any effect
+ * @deprecated DRM ringtones are no longer supported
*/
+ @Deprecated
public void setIncludeDrm(boolean includeDrm) {
- mIncludeDrm = includeDrm;
+ if (includeDrm) {
+ Log.w(TAG, "setIncludeDrm no longer supported");
+ }
}
/**
@@ -363,10 +363,9 @@ public class RingtoneManager {
}
final Cursor internalCursor = getInternalRingtones();
- final Cursor drmCursor = mIncludeDrm ? getDrmRingtones() : null;
final Cursor mediaCursor = getMediaRingtones();
- return mCursor = new SortCursor(new Cursor[] { internalCursor, drmCursor, mediaCursor },
+ return mCursor = new SortCursor(new Cursor[] { internalCursor, mediaCursor },
MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
}
@@ -462,10 +461,6 @@ public class RingtoneManager {
uri = getValidRingtoneUriFromCursorAndClose(context, rm.getMediaRingtones());
}
- if (uri == null) {
- uri = getValidRingtoneUriFromCursorAndClose(context, rm.getDrmRingtones());
- }
-
return uri;
}
@@ -487,16 +482,9 @@ public class RingtoneManager {
private Cursor getInternalRingtones() {
return query(
MediaStore.Audio.Media.INTERNAL_CONTENT_URI, INTERNAL_COLUMNS,
- constructBooleanTrueWhereClause(mFilterColumns, mIncludeDrm),
+ constructBooleanTrueWhereClause(mFilterColumns),
null, MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
}
-
- private Cursor getDrmRingtones() {
- // DRM store does not have any columns to use for filtering
- return query(
- DrmStore.Audio.CONTENT_URI, DRM_COLUMNS,
- null, null, DrmStore.Audio.TITLE);
- }
private Cursor getMediaRingtones() {
// Get the external media cursor. First check to see if it is mounted.
@@ -506,7 +494,7 @@ public class RingtoneManager {
status.equals(Environment.MEDIA_MOUNTED_READ_ONLY))
? query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, MEDIA_COLUMNS,
- constructBooleanTrueWhereClause(mFilterColumns, mIncludeDrm), null,
+ constructBooleanTrueWhereClause(mFilterColumns), null,
MediaStore.Audio.Media.DEFAULT_SORT_ORDER)
: null;
}
@@ -536,7 +524,7 @@ public class RingtoneManager {
* @param columns The columns that must be true.
* @return The where clause.
*/
- private static String constructBooleanTrueWhereClause(List<String> columns, boolean includeDrm) {
+ private static String constructBooleanTrueWhereClause(List<String> columns) {
if (columns == null) return null;
@@ -554,15 +542,6 @@ public class RingtoneManager {
sb.append(")");
- if (!includeDrm) {
- // If not DRM files should be shown, the where clause
- // will be something like "(is_notification=1) and is_drm=0"
- sb.append(" and ");
- sb.append(MediaStore.MediaColumns.IS_DRM);
- sb.append("=0");
- }
-
-
return sb.toString();
}
diff --git a/media/java/android/media/SoundPool.java b/media/java/android/media/SoundPool.java
index 587af47..5127479 100644
--- a/media/java/android/media/SoundPool.java
+++ b/media/java/android/media/SoundPool.java
@@ -16,19 +16,21 @@
package android.media;
-import android.util.AndroidRuntimeException;
-import android.util.Log;
import java.io.File;
import java.io.FileDescriptor;
-import android.os.ParcelFileDescriptor;
+import java.io.IOException;
import java.lang.ref.WeakReference;
+
import android.content.Context;
import android.content.res.AssetFileDescriptor;
-import java.io.IOException;
-
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
+import android.os.ParcelFileDescriptor;
+import android.os.SystemProperties;
+import android.util.AndroidRuntimeException;
+import android.util.Log;
+
/**
* The SoundPool class manages and plays audio resources for applications.
@@ -102,24 +104,8 @@ import android.os.Message;
* another level, a new SoundPool is created, sounds are loaded, and play
* resumes.</p>
*/
-public class SoundPool
-{
- static { System.loadLibrary("soundpool"); }
-
- private final static String TAG = "SoundPool";
- private final static boolean DEBUG = false;
-
- private int mNativeContext; // accessed by native methods
-
- private EventHandler mEventHandler;
- private OnLoadCompleteListener mOnLoadCompleteListener;
-
- private final Object mLock;
-
- // SoundPool messages
- //
- // must match SoundPool.h
- private static final int SAMPLE_LOADED = 1;
+public class SoundPool {
+ private final SoundPoolDelegate mImpl;
/**
* Constructor. Constructs a SoundPool object with the following
@@ -135,12 +121,11 @@ public class SoundPool
* @return a SoundPool object, or null if creation failed
*/
public SoundPool(int maxStreams, int streamType, int srcQuality) {
-
- // do native setup
- if (native_setup(new WeakReference(this), maxStreams, streamType, srcQuality) != 0) {
- throw new RuntimeException("Native setup failed");
+ if (SystemProperties.getBoolean("config.disable_media", false)) {
+ mImpl = new SoundPoolStub();
+ } else {
+ mImpl = new SoundPoolImpl(this, maxStreams, streamType, srcQuality);
}
- mLock = new Object();
}
/**
@@ -151,25 +136,8 @@ public class SoundPool
* a value of 1 for future compatibility.
* @return a sound ID. This value can be used to play or unload the sound.
*/
- public int load(String path, int priority)
- {
- // pass network streams to player
- if (path.startsWith("http:"))
- return _load(path, priority);
-
- // try local path
- int id = 0;
- try {
- File f = new File(path);
- ParcelFileDescriptor fd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
- if (fd != null) {
- id = _load(fd.getFileDescriptor(), 0, f.length(), priority);
- fd.close();
- }
- } catch (java.io.IOException e) {
- Log.e(TAG, "error loading " + path);
- }
- return id;
+ public int load(String path, int priority) {
+ return mImpl.load(path, priority);
}
/**
@@ -188,17 +156,7 @@ public class SoundPool
* @return a sound ID. This value can be used to play or unload the sound.
*/
public int load(Context context, int resId, int priority) {
- AssetFileDescriptor afd = context.getResources().openRawResourceFd(resId);
- int id = 0;
- if (afd != null) {
- id = _load(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength(), priority);
- try {
- afd.close();
- } catch (java.io.IOException ex) {
- //Log.d(TAG, "close failed:", ex);
- }
- }
- return id;
+ return mImpl.load(context, resId, priority);
}
/**
@@ -210,15 +168,7 @@ public class SoundPool
* @return a sound ID. This value can be used to play or unload the sound.
*/
public int load(AssetFileDescriptor afd, int priority) {
- if (afd != null) {
- long len = afd.getLength();
- if (len < 0) {
- throw new AndroidRuntimeException("no length for fd");
- }
- return _load(afd.getFileDescriptor(), afd.getStartOffset(), len, priority);
- } else {
- return 0;
- }
+ return mImpl.load(afd, priority);
}
/**
@@ -236,13 +186,9 @@ public class SoundPool
* @return a sound ID. This value can be used to play or unload the sound.
*/
public int load(FileDescriptor fd, long offset, long length, int priority) {
- return _load(fd, offset, length, priority);
+ return mImpl.load(fd, offset, length, priority);
}
- private native final int _load(String uri, int priority);
-
- private native final int _load(FileDescriptor fd, long offset, long length, int priority);
-
/**
* Unload a sound from a sound ID.
*
@@ -253,7 +199,9 @@ public class SoundPool
* @param soundID a soundID returned by the load() function
* @return true if just unloaded, false if previously unloaded
*/
- public native final boolean unload(int soundID);
+ public final boolean unload(int soundID) {
+ return mImpl.unload(soundID);
+ }
/**
* Play a sound from a sound ID.
@@ -279,8 +227,11 @@ public class SoundPool
* @param rate playback rate (1.0 = normal playback, range 0.5 to 2.0)
* @return non-zero streamID if successful, zero if failed
*/
- public native final int play(int soundID, float leftVolume, float rightVolume,
- int priority, int loop, float rate);
+ public final int play(int soundID, float leftVolume, float rightVolume,
+ int priority, int loop, float rate) {
+ return mImpl.play(
+ soundID, leftVolume, rightVolume, priority, loop, rate);
+ }
/**
* Pause a playback stream.
@@ -293,7 +244,9 @@ public class SoundPool
*
* @param streamID a streamID returned by the play() function
*/
- public native final void pause(int streamID);
+ public final void pause(int streamID) {
+ mImpl.pause(streamID);
+ }
/**
* Resume a playback stream.
@@ -305,7 +258,9 @@ public class SoundPool
*
* @param streamID a streamID returned by the play() function
*/
- public native final void resume(int streamID);
+ public final void resume(int streamID) {
+ mImpl.resume(streamID);
+ }
/**
* Pause all active streams.
@@ -315,7 +270,9 @@ public class SoundPool
* are playing. It also sets a flag so that any streams that
* are playing can be resumed by calling autoResume().
*/
- public native final void autoPause();
+ public final void autoPause() {
+ mImpl.autoPause();
+ }
/**
* Resume all previously active streams.
@@ -323,7 +280,9 @@ public class SoundPool
* Automatically resumes all streams that were paused in previous
* calls to autoPause().
*/
- public native final void autoResume();
+ public final void autoResume() {
+ mImpl.autoResume();
+ }
/**
* Stop a playback stream.
@@ -336,7 +295,9 @@ public class SoundPool
*
* @param streamID a streamID returned by the play() function
*/
- public native final void stop(int streamID);
+ public final void stop(int streamID) {
+ mImpl.stop(streamID);
+ }
/**
* Set stream volume.
@@ -350,8 +311,10 @@ public class SoundPool
* @param leftVolume left volume value (range = 0.0 to 1.0)
* @param rightVolume right volume value (range = 0.0 to 1.0)
*/
- public native final void setVolume(int streamID,
- float leftVolume, float rightVolume);
+ public final void setVolume(int streamID,
+ float leftVolume, float rightVolume) {
+ mImpl.setVolume(streamID, leftVolume, rightVolume);
+ }
/**
* Similar, except set volume of all channels to same value.
@@ -371,7 +334,9 @@ public class SoundPool
*
* @param streamID a streamID returned by the play() function
*/
- public native final void setPriority(int streamID, int priority);
+ public final void setPriority(int streamID, int priority) {
+ mImpl.setPriority(streamID, priority);
+ }
/**
* Set loop mode.
@@ -384,7 +349,9 @@ public class SoundPool
* @param streamID a streamID returned by the play() function
* @param loop loop mode (0 = no loop, -1 = loop forever)
*/
- public native final void setLoop(int streamID, int loop);
+ public final void setLoop(int streamID, int loop) {
+ mImpl.setLoop(streamID, loop);
+ }
/**
* Change playback rate.
@@ -398,14 +365,11 @@ public class SoundPool
* @param streamID a streamID returned by the play() function
* @param rate playback rate (1.0 = normal playback, range 0.5 to 2.0)
*/
- public native final void setRate(int streamID, float rate);
+ public final void setRate(int streamID, float rate) {
+ mImpl.setRate(streamID, rate);
+ }
- /**
- * Interface definition for a callback to be invoked when all the
- * sounds are loaded.
- */
- public interface OnLoadCompleteListener
- {
+ public interface OnLoadCompleteListener {
/**
* Called when a sound has completed loading.
*
@@ -419,76 +383,297 @@ public class SoundPool
/**
* Sets the callback hook for the OnLoadCompleteListener.
*/
- public void setOnLoadCompleteListener(OnLoadCompleteListener listener)
- {
- synchronized(mLock) {
- if (listener != null) {
- // setup message handler
- Looper looper;
- if ((looper = Looper.myLooper()) != null) {
- mEventHandler = new EventHandler(this, looper);
- } else if ((looper = Looper.getMainLooper()) != null) {
- mEventHandler = new EventHandler(this, looper);
- } else {
- mEventHandler = null;
+ public void setOnLoadCompleteListener(OnLoadCompleteListener listener) {
+ mImpl.setOnLoadCompleteListener(listener);
+ }
+
+ /**
+ * Release the SoundPool resources.
+ *
+ * Release all memory and native resources used by the SoundPool
+ * object. The SoundPool can no longer be used and the reference
+ * should be set to null.
+ */
+ public final void release() {
+ mImpl.release();
+ }
+
+ /**
+ * Interface for SoundPool implementations.
+ * SoundPool is statically referenced and unconditionally called from all
+ * over the framework, so we can't simply omit the class or make it throw
+ * runtime exceptions, as doing so would break the framework. Instead we
+ * now select either a real or no-op impl object based on whether media is
+ * enabled.
+ *
+ * @hide
+ */
+ /* package */ interface SoundPoolDelegate {
+ public int load(String path, int priority);
+ public int load(Context context, int resId, int priority);
+ public int load(AssetFileDescriptor afd, int priority);
+ public int load(
+ FileDescriptor fd, long offset, long length, int priority);
+ public boolean unload(int soundID);
+ public int play(
+ int soundID, float leftVolume, float rightVolume,
+ int priority, int loop, float rate);
+ public void pause(int streamID);
+ public void resume(int streamID);
+ public void autoPause();
+ public void autoResume();
+ public void stop(int streamID);
+ public void setVolume(int streamID, float leftVolume, float rightVolume);
+ public void setVolume(int streamID, float volume);
+ public void setPriority(int streamID, int priority);
+ public void setLoop(int streamID, int loop);
+ public void setRate(int streamID, float rate);
+ public void setOnLoadCompleteListener(OnLoadCompleteListener listener);
+ public void release();
+ }
+
+
+ /**
+ * Real implementation of the delegate interface. This was formerly the
+ * body of SoundPool itself.
+ */
+ /* package */ static class SoundPoolImpl implements SoundPoolDelegate {
+ static { System.loadLibrary("soundpool"); }
+
+ private final static String TAG = "SoundPool";
+ private final static boolean DEBUG = false;
+
+ private int mNativeContext; // accessed by native methods
+
+ private EventHandler mEventHandler;
+ private SoundPool.OnLoadCompleteListener mOnLoadCompleteListener;
+ private SoundPool mProxy;
+
+ private final Object mLock;
+
+ // SoundPool messages
+ //
+ // must match SoundPool.h
+ private static final int SAMPLE_LOADED = 1;
+
+ public SoundPoolImpl(SoundPool proxy, int maxStreams, int streamType, int srcQuality) {
+
+ // do native setup
+ if (native_setup(new WeakReference(this), maxStreams, streamType, srcQuality) != 0) {
+ throw new RuntimeException("Native setup failed");
+ }
+ mLock = new Object();
+ mProxy = proxy;
+ }
+
+ public int load(String path, int priority)
+ {
+ // pass network streams to player
+ if (path.startsWith("http:"))
+ return _load(path, priority);
+
+ // try local path
+ int id = 0;
+ try {
+ File f = new File(path);
+ ParcelFileDescriptor fd = ParcelFileDescriptor.open(f, ParcelFileDescriptor.MODE_READ_ONLY);
+ if (fd != null) {
+ id = _load(fd.getFileDescriptor(), 0, f.length(), priority);
+ fd.close();
}
+ } catch (java.io.IOException e) {
+ Log.e(TAG, "error loading " + path);
+ }
+ return id;
+ }
+
+ public int load(Context context, int resId, int priority) {
+ AssetFileDescriptor afd = context.getResources().openRawResourceFd(resId);
+ int id = 0;
+ if (afd != null) {
+ id = _load(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength(), priority);
+ try {
+ afd.close();
+ } catch (java.io.IOException ex) {
+ //Log.d(TAG, "close failed:", ex);
+ }
+ }
+ return id;
+ }
+
+ public int load(AssetFileDescriptor afd, int priority) {
+ if (afd != null) {
+ long len = afd.getLength();
+ if (len < 0) {
+ throw new AndroidRuntimeException("no length for fd");
+ }
+ return _load(afd.getFileDescriptor(), afd.getStartOffset(), len, priority);
} else {
- mEventHandler = null;
+ return 0;
}
- mOnLoadCompleteListener = listener;
}
- }
- private class EventHandler extends Handler
- {
- private SoundPool mSoundPool;
+ public int load(FileDescriptor fd, long offset, long length, int priority) {
+ return _load(fd, offset, length, priority);
+ }
+
+ private native final int _load(String uri, int priority);
+
+ private native final int _load(FileDescriptor fd, long offset, long length, int priority);
+
+ public native final boolean unload(int soundID);
+
+ public native final int play(int soundID, float leftVolume, float rightVolume,
+ int priority, int loop, float rate);
+
+ public native final void pause(int streamID);
+
+ public native final void resume(int streamID);
+
+ public native final void autoPause();
+
+ public native final void autoResume();
+
+ public native final void stop(int streamID);
- public EventHandler(SoundPool soundPool, Looper looper) {
- super(looper);
- mSoundPool = soundPool;
+ public native final void setVolume(int streamID,
+ float leftVolume, float rightVolume);
+
+ public void setVolume(int streamID, float volume) {
+ setVolume(streamID, volume, volume);
}
- @Override
- public void handleMessage(Message msg) {
- switch(msg.what) {
- case SAMPLE_LOADED:
- if (DEBUG) Log.d(TAG, "Sample " + msg.arg1 + " loaded");
- synchronized(mLock) {
- if (mOnLoadCompleteListener != null) {
- mOnLoadCompleteListener.onLoadComplete(mSoundPool, msg.arg1, msg.arg2);
+ public native final void setPriority(int streamID, int priority);
+
+ public native final void setLoop(int streamID, int loop);
+
+ public native final void setRate(int streamID, float rate);
+
+ public void setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener)
+ {
+ synchronized(mLock) {
+ if (listener != null) {
+ // setup message handler
+ Looper looper;
+ if ((looper = Looper.myLooper()) != null) {
+ mEventHandler = new EventHandler(mProxy, looper);
+ } else if ((looper = Looper.getMainLooper()) != null) {
+ mEventHandler = new EventHandler(mProxy, looper);
+ } else {
+ mEventHandler = null;
}
+ } else {
+ mEventHandler = null;
}
- break;
- default:
- Log.e(TAG, "Unknown message type " + msg.what);
- return;
+ mOnLoadCompleteListener = listener;
}
}
- }
- // post event from native code to message handler
- private static void postEventFromNative(Object weakRef, int msg, int arg1, int arg2, Object obj)
- {
- SoundPool soundPool = (SoundPool)((WeakReference)weakRef).get();
- if (soundPool == null)
- return;
+ private class EventHandler extends Handler
+ {
+ private SoundPool mSoundPool;
+
+ public EventHandler(SoundPool soundPool, Looper looper) {
+ super(looper);
+ mSoundPool = soundPool;
+ }
- if (soundPool.mEventHandler != null) {
- Message m = soundPool.mEventHandler.obtainMessage(msg, arg1, arg2, obj);
- soundPool.mEventHandler.sendMessage(m);
+ @Override
+ public void handleMessage(Message msg) {
+ switch(msg.what) {
+ case SAMPLE_LOADED:
+ if (DEBUG) Log.d(TAG, "Sample " + msg.arg1 + " loaded");
+ synchronized(mLock) {
+ if (mOnLoadCompleteListener != null) {
+ mOnLoadCompleteListener.onLoadComplete(mSoundPool, msg.arg1, msg.arg2);
+ }
+ }
+ break;
+ default:
+ Log.e(TAG, "Unknown message type " + msg.what);
+ return;
+ }
+ }
}
+
+ // post event from native code to message handler
+ private static void postEventFromNative(Object weakRef, int msg, int arg1, int arg2, Object obj)
+ {
+ SoundPoolImpl soundPoolImpl = (SoundPoolImpl)((WeakReference)weakRef).get();
+ if (soundPoolImpl == null)
+ return;
+
+ if (soundPoolImpl.mEventHandler != null) {
+ Message m = soundPoolImpl.mEventHandler.obtainMessage(msg, arg1, arg2, obj);
+ soundPoolImpl.mEventHandler.sendMessage(m);
+ }
+ }
+
+ public native final void release();
+
+ private native final int native_setup(Object weakRef, int maxStreams, int streamType, int srcQuality);
+
+ protected void finalize() { release(); }
}
/**
- * Release the SoundPool resources.
- *
- * Release all memory and native resources used by the SoundPool
- * object. The SoundPool can no longer be used and the reference
- * should be set to null.
+ * No-op implementation of SoundPool.
+ * Used when media is disabled by the system.
+ * @hide
*/
- public native final void release();
+ /* package */ static class SoundPoolStub implements SoundPoolDelegate {
+ public SoundPoolStub() { }
+
+ public int load(String path, int priority) {
+ return 0;
+ }
+
+ public int load(Context context, int resId, int priority) {
+ return 0;
+ }
+
+ public int load(AssetFileDescriptor afd, int priority) {
+ return 0;
+ }
+
+ public int load(FileDescriptor fd, long offset, long length, int priority) {
+ return 0;
+ }
+
+ public final boolean unload(int soundID) {
+ return true;
+ }
+
+ public final int play(int soundID, float leftVolume, float rightVolume,
+ int priority, int loop, float rate) {
+ return 0;
+ }
+
+ public final void pause(int streamID) { }
+
+ public final void resume(int streamID) { }
+
+ public final void autoPause() { }
+
+ public final void autoResume() { }
- private native final int native_setup(Object weakRef, int maxStreams, int streamType, int srcQuality);
+ public final void stop(int streamID) { }
- protected void finalize() { release(); }
+ public final void setVolume(int streamID,
+ float leftVolume, float rightVolume) { }
+
+ public void setVolume(int streamID, float volume) {
+ }
+
+ public final void setPriority(int streamID, int priority) { }
+
+ public final void setLoop(int streamID, int loop) { }
+
+ public final void setRate(int streamID, float rate) { }
+
+ public void setOnLoadCompleteListener(SoundPool.OnLoadCompleteListener listener) {
+ }
+
+ public final void release() { }
+ }
}