diff options
-rw-r--r-- | api/current.txt | 24 | ||||
-rw-r--r-- | docs/html/about/dashboards/index.jd | 51 | ||||
-rw-r--r-- | media/java/android/media/DeniedByServerException.java | 27 | ||||
-rw-r--r-- | media/java/android/media/MediaDrm.java | 34 | ||||
-rw-r--r-- | media/java/android/media/MediaDrmException.java | 5 | ||||
-rw-r--r-- | media/java/android/media/NotProvisionedException.java | 29 | ||||
-rw-r--r-- | media/java/android/media/UnsupportedSchemeException.java | 27 | ||||
-rw-r--r-- | media/jni/android_media_MediaDrm.cpp | 15 |
8 files changed, 164 insertions, 48 deletions
diff --git a/api/current.txt b/api/current.txt index 3418761..1166546 100644 --- a/api/current.txt +++ b/api/current.txt @@ -11497,6 +11497,10 @@ package android.media { field public static final int QUALITY_MEDIUM = 1; // 0x1 } + public final class DeniedByServerException extends android.media.MediaDrmException { + ctor public DeniedByServerException(java.lang.String); + } + public class ExifInterface { ctor public ExifInterface(java.lang.String) throws java.io.IOException; method public double getAltitude(double); @@ -11818,18 +11822,18 @@ package android.media { } public final class MediaDrm { - ctor public MediaDrm(java.util.UUID) throws android.media.MediaDrmException; + ctor public MediaDrm(java.util.UUID) throws android.media.UnsupportedSchemeException; method public void closeSession(byte[]); method public android.media.MediaDrm.CryptoSession getCryptoSession(byte[], java.lang.String, java.lang.String); - method public android.media.MediaDrm.KeyRequest getKeyRequest(byte[], byte[], java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>); + method public android.media.MediaDrm.KeyRequest getKeyRequest(byte[], byte[], java.lang.String, int, java.util.HashMap<java.lang.String, java.lang.String>) throws android.media.NotProvisionedException; method public byte[] getPropertyByteArray(java.lang.String); method public java.lang.String getPropertyString(java.lang.String); method public android.media.MediaDrm.ProvisionRequest getProvisionRequest(); method public java.util.List<byte[]> getSecureStops(); method public static final boolean isCryptoSchemeSupported(java.util.UUID); - method public byte[] openSession(); - method public byte[] provideKeyResponse(byte[], byte[]); - method public void provideProvisionResponse(byte[]); + method public byte[] openSession() throws android.media.NotProvisionedException; + method public byte[] provideKeyResponse(byte[], byte[]) throws android.media.DeniedByServerException, android.media.NotProvisionedException; + method public void provideProvisionResponse(byte[]) throws android.media.DeniedByServerException; method public java.util.HashMap<java.lang.String, java.lang.String> queryKeyStatus(byte[]); method public final void release(); method public void releaseSecureStops(byte[]); @@ -11873,7 +11877,7 @@ package android.media { method public java.lang.String getDefaultUrl(); } - public final class MediaDrmException extends java.lang.Exception { + public class MediaDrmException extends java.lang.Exception { ctor public MediaDrmException(java.lang.String); } @@ -12339,6 +12343,10 @@ package android.media { field public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; // 0x1 } + public final class NotProvisionedException extends android.media.MediaDrmException { + ctor public NotProvisionedException(java.lang.String); + } + public class RemoteControlClient { ctor public RemoteControlClient(android.app.PendingIntent); ctor public RemoteControlClient(android.app.PendingIntent, android.os.Looper); @@ -12581,6 +12589,10 @@ package android.media { field public static final int TONE_SUP_RINGTONE = 23; // 0x17 } + public final class UnsupportedSchemeException extends android.media.MediaDrmException { + ctor public UnsupportedSchemeException(java.lang.String); + } + } package android.media.audiofx { diff --git a/docs/html/about/dashboards/index.jd b/docs/html/about/dashboards/index.jd index e17a0fd..6956634 100644 --- a/docs/html/about/dashboards/index.jd +++ b/docs/html/about/dashboards/index.jd @@ -57,7 +57,7 @@ Platform Versions</a>.</p> </div> -<p style="clear:both"><em>Data collected during a 14-day period ending on April 2, 2013. +<p style="clear:both"><em>Data collected during a 14-day period ending on May 1, 2013. <br/>Any versions with less than 0.1% distribution are not shown.</em> </p> @@ -83,7 +83,7 @@ Screens</a>.</p> </div> -<p style="clear:both"><em>Data collected during a 14-day period ending on April 2, 2013 +<p style="clear:both"><em>Data collected during a 14-day period ending on May 1, 2013 <br/>Any screen configurations with less than 0.1% distribution are not shown.</em></p> @@ -102,7 +102,7 @@ support for any lower version (for example, support for version 2.0 also implies <img alt="" style="float:right" -src="//chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=GL%201.1%20only|GL%202.0%20%26%201.1&chd=t%3A0.3,99.7&chf=bg,s,00000000" /> +src="//chart.googleapis.com/chart?cht=p&chs=400x250&chco=c4df9b,6fad0c&chl=GL%201.1%20only|GL%202.0%20%26%201.1&chd=t%3A0.2,99.8&chf=bg,s,00000000" /> <p>To declare which version of OpenGL ES your application requires, you should use the {@code android:glEsVersion} attribute of the <a @@ -120,17 +120,17 @@ uses.</p> </tr> <tr> <td>1.1 only</th> -<td>0.3%</td> +<td>0.2%</td> </tr> <tr> <td>2.0 & 1.1</th> -<td>99.7%</td> +<td>99.8%</td> </tr> </table> -<p style="clear:both"><em>Data collected during a 14-day period ending on April 2, 2013</em></p> +<p style="clear:both"><em>Data collected during a 14-day period ending on May 1, 2013</em></p> @@ -148,7 +148,7 @@ uses.</p> var VERSION_DATA = [ { - "chart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A1.8%2C4.0%2C39.8%2C0.2%2C29.3%2C25.0&chl=Eclair%7CFroyo%7CGingerbread%7CHoneycomb%7CIce%20Cream%20Sandwich%7CJelly%20Bean&chs=500x250&cht=p&chco=c4df9b%2C6fad0c", + "chart": "//chart.googleapis.com/chart?chs=500x250&cht=p&chf=bg%2Cs%2C00000000&chd=t%3A1.8%2C3.7%2C38.5%2C0.1%2C27.5%2C28.4&chco=c4df9b%2C6fad0c&chl=Eclair%7CFroyo%7CGingerbread%7CHoneycomb%7CIce%20Cream%20Sandwich%7CJelly%20Bean", "data": [ { "api": 4, @@ -163,7 +163,7 @@ var VERSION_DATA = { "api": 8, "name": "Froyo", - "perc": "4.0" + "perc": "3.7" }, { "api": 9, @@ -173,27 +173,27 @@ var VERSION_DATA = { "api": 10, "name": "Gingerbread", - "perc": "39.7" + "perc": "38.4" }, { "api": 13, "name": "Honeycomb", - "perc": "0.2" + "perc": "0.1" }, { "api": 15, "name": "Ice Cream Sandwich", - "perc": "29.3" + "perc": "27.5" }, { "api": 16, "name": "Jelly Bean", - "perc": "23.0" + "perc": "26.1" }, { "api": 17, "name": "Jelly Bean", - "perc": "2.0" + "perc": "2.3" } ] } @@ -205,34 +205,35 @@ var VERSION_DATA = var SCREEN_DATA = [ + { "data": { "Large": { - "hdpi": "0.5", - "ldpi": "0.7", - "mdpi": "2.7", + "hdpi": "0.4", + "ldpi": "0.6", + "mdpi": "2.9", "tvdpi": "1.0", - "xhdpi": "0.8" + "xhdpi": "0.7" }, "Normal": { - "hdpi": "37.9", + "hdpi": "37.3", "ldpi": "0.1", "mdpi": "16.1", - "xhdpi": "25.0", - "xxhdpi": "0.8" + "xhdpi": "24.9", + "xxhdpi": "1.3" }, "Small": { - "ldpi": "9.5" + "ldpi": "9.8" }, "Xlarge": { "hdpi": "0.1", - "ldpi": "0.1", - "mdpi": "4.6", + "ldpi": "0.2", + "mdpi": "4.5", "xhdpi": "0.1" } }, - "densitychart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A10.4%2C23.4%2C1.0%2C38.5%2C25.9%2C0.8&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chs=400x250&cht=p&chco=c4df9b%2C6fad0c", - "layoutchart": "//chart.googleapis.com/chart?chf=bg%2Cs%2C00000000&chd=t%3A4.9%2C5.7%2C79.9%2C9.5&chl=Xlarge%7CLarge%7CNormal%7CSmall&chs=400x250&cht=p&chco=c4df9b%2C6fad0c" + "densitychart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chf=bg%2Cs%2C00000000&chd=t%3A10.7%2C23.5%2C1.0%2C37.8%2C25.7%2C1.3&chco=c4df9b%2C6fad0c&chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi", + "layoutchart": "//chart.googleapis.com/chart?chs=400x250&cht=p&chf=bg%2Cs%2C00000000&chd=t%3A4.9%2C5.6%2C79.7%2C9.8&chco=c4df9b%2C6fad0c&chl=Xlarge%7CLarge%7CNormal%7CSmall" } ]; diff --git a/media/java/android/media/DeniedByServerException.java b/media/java/android/media/DeniedByServerException.java new file mode 100644 index 0000000..9c1633a --- /dev/null +++ b/media/java/android/media/DeniedByServerException.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2013 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.media; + +/** + * Exception thrown when the provisioning server or key server denies a + * certficate or license for a device. + */ +public final class DeniedByServerException extends MediaDrmException { + public DeniedByServerException(String detailMessage) { + super(detailMessage); + } +} diff --git a/media/java/android/media/MediaDrm.java b/media/java/android/media/MediaDrm.java index a58fa51..be2d9bc 100644 --- a/media/java/android/media/MediaDrm.java +++ b/media/java/android/media/MediaDrm.java @@ -127,11 +127,14 @@ public final class MediaDrm { private static final native boolean isCryptoSchemeSupportedNative(byte[] uuid); /** - * Instantiate a MediaDrm object using opaque, crypto scheme specific - * data. + * Instantiate a MediaDrm object + * * @param uuid The UUID of the crypto scheme. + * + * @throws UnsupportedSchemeException if the device does not support the + * specified scheme UUID */ - public MediaDrm(UUID uuid) throws MediaDrmException { + public MediaDrm(UUID uuid) throws UnsupportedSchemeException { Looper looper; if ((looper = Looper.myLooper()) != null) { mEventHandler = new EventHandler(this, looper); @@ -268,8 +271,10 @@ public final class MediaDrm { /** * Open a new session with the MediaDrm object. A session ID is returned. + * + * @throws NotProvisionedException if provisioning is needed */ - public native byte[] openSession(); + public native byte[] openSession() throws NotProvisionedException; /** * Close a session on the MediaDrm object that was previously opened @@ -346,10 +351,14 @@ public final class MediaDrm { * keys, which are identified by a keySetId. * @param optionalParameters are included in the key request message to * allow a client application to provide additional message parameters to the server. + * + * @throws NotProvisionedException if reprovisioning is needed, due to a + * problem with the certifcate */ public native KeyRequest getKeyRequest(byte[] scope, byte[] init, String mimeType, int keyType, - HashMap<String, String> optionalParameters); + HashMap<String, String> optionalParameters) + throws NotProvisionedException; /** @@ -360,8 +369,15 @@ public final class MediaDrm { * * @param sessionId the session ID for the DRM session * @param response the byte array response from the server + * + * @throws NotProvisionedException if the response indicates that + * reprovisioning is required + * @throws DeniedByServerException if the response indicates that the + * server rejected the request */ - public native byte[] provideKeyResponse(byte[] sessionId, byte[] response); + public native byte[] provideKeyResponse(byte[] sessionId, byte[] response) + throws NotProvisionedException, DeniedByServerException; + /** * Restore persisted offline keys into a new session. keySetId identifies the @@ -430,8 +446,12 @@ public final class MediaDrm { * * @param response the opaque provisioning response byte array to provide to the * DRM engine plugin. + * + * @throws DeniedByServerException if the response indicates that the + * server rejected the request */ - public native void provideProvisionResponse(byte[] response); + public native void provideProvisionResponse(byte[] response) + throws DeniedByServerException; /** * A means of enforcing limits on the number of concurrent streams per subscriber diff --git a/media/java/android/media/MediaDrmException.java b/media/java/android/media/MediaDrmException.java index d6f5ff4..d547574 100644 --- a/media/java/android/media/MediaDrmException.java +++ b/media/java/android/media/MediaDrmException.java @@ -17,10 +17,9 @@ package android.media; /** - * Exception thrown if MediaDrm object could not be instantiated for - * whatever reason. + * Base class for MediaDrm exceptions */ -public final class MediaDrmException extends Exception { +public class MediaDrmException extends Exception { public MediaDrmException(String detailMessage) { super(detailMessage); } diff --git a/media/java/android/media/NotProvisionedException.java b/media/java/android/media/NotProvisionedException.java new file mode 100644 index 0000000..32b8151 --- /dev/null +++ b/media/java/android/media/NotProvisionedException.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2013 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.media; + +/** + * Exception thrown when an operation on a MediaDrm object is attempted + * and the device does not have a certificate. The app should obtain and + * install a certificate using the MediaDrm provisioning methods then retry + * the operation. + */ +public final class NotProvisionedException extends MediaDrmException { + public NotProvisionedException(String detailMessage) { + super(detailMessage); + } +} diff --git a/media/java/android/media/UnsupportedSchemeException.java b/media/java/android/media/UnsupportedSchemeException.java new file mode 100644 index 0000000..d7b5d47 --- /dev/null +++ b/media/java/android/media/UnsupportedSchemeException.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2013 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.media; + +/** + * Exception thrown when an attempt is made to construct a MediaDrm object + * using a crypto scheme UUID that is not supported by the device + */ +public final class UnsupportedSchemeException extends MediaDrmException { + public UnsupportedSchemeException(String detailMessage) { + super(detailMessage); + } +} diff --git a/media/jni/android_media_MediaDrm.cpp b/media/jni/android_media_MediaDrm.cpp index d1b499e..ec88949 100644 --- a/media/jni/android_media_MediaDrm.cpp +++ b/media/jni/android_media_MediaDrm.cpp @@ -219,12 +219,6 @@ static bool throwExceptionAsNecessary( case ERROR_DRM_TAMPER_DETECTED: drmMessage = "Invalid state"; break; - case ERROR_DRM_NOT_PROVISIONED: - drmMessage = "Not provisioned"; - break; - case ERROR_DRM_DEVICE_REVOKED: - drmMessage = "Device revoked"; - break; default: break; } @@ -238,6 +232,12 @@ static bool throwExceptionAsNecessary( if (err == BAD_VALUE) { jniThrowException(env, "java/lang/IllegalArgumentException", msg); return true; + } else if (err == ERROR_DRM_NOT_PROVISIONED) { + jniThrowException(env, "android/media/NotProvisionedException", msg); + return true; + } else if (err == ERROR_DRM_DEVICE_REVOKED) { + jniThrowException(env, "android/media/DeniedByServerException", msg); + return true; } else if (err != OK) { String8 errbuf; if (drmMessage != NULL) { @@ -248,6 +248,7 @@ static bool throwExceptionAsNecessary( msg = errbuf.string(); } } + ALOGE("Illegal state exception: %s", msg); jniThrowException(env, "java/lang/IllegalStateException", msg); return true; } @@ -574,7 +575,7 @@ static void android_media_MediaDrm_native_setup( if (err != OK) { jniThrowException( env, - "android/media/MediaDrmException", + "android/media/UnsupportedSchemeException", "Failed to instantiate drm object."); return; } |