Merge "For issue 4082089 Add more info and error events into the DRM framework" into honeycomb-mr1

This commit is contained in:
Gloria Wang
2011-03-14 17:02:58 -07:00
committed by Android (Google) Code Review
5 changed files with 47 additions and 6 deletions

View File

@@ -72665,6 +72665,17 @@
<parameter name="message" type="java.lang.String">
</parameter>
</constructor>
<field name="TYPE_ACQUIRE_DRM_INFO_FAILED"
type="int"
transient="false"
volatile="false"
value="2008"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TYPE_NOT_SUPPORTED"
type="int"
transient="false"
@@ -73018,6 +73029,17 @@
visibility="public"
>
</field>
<field name="TYPE_RIGHTS_REMOVED"
type="int"
transient="false"
volatile="false"
value="6"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="TYPE_WAIT_FOR_RIGHTS"
type="int"
transient="false"

View File

@@ -53,6 +53,10 @@ public class DrmErrorEvent extends DrmEvent {
* associated with all DRM schemes.
*/
public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
/**
* TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
*/
public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
/**
* constructor to create DrmErrorEvent object with given parameters

View File

@@ -45,6 +45,10 @@ public class DrmInfoEvent extends DrmEvent {
* already done for the given account.
*/
public static final int TYPE_ACCOUNT_ALREADY_REGISTERED = 5;
/**
* TYPE_RIGHTS_REMOVED, when the rights has been removed.
*/
public static final int TYPE_RIGHTS_REMOVED = 6;
/**
* constructor to create DrmInfoEvent object with given parameters

View File

@@ -181,7 +181,7 @@ public class DrmManagerClient {
}
public void handleMessage(Message msg) {
DrmInfoEvent event = null;
DrmInfoEvent info = null;
DrmErrorEvent error = null;
switch (msg.what) {
@@ -197,11 +197,15 @@ public class DrmManagerClient {
} catch (IOException e) {
e.printStackTrace();
}
event = new DrmInfoEvent(uniqueId, infoType, message);
info = new DrmInfoEvent(uniqueId, infoType, message);
break;
}
case DrmInfoEvent.TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT: {
event = new DrmInfoEvent(uniqueId, infoType, message);
case DrmInfoEvent.TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT:
case DrmInfoEvent.TYPE_RIGHTS_INSTALLED:
case DrmInfoEvent.TYPE_WAIT_FOR_RIGHTS:
case DrmInfoEvent.TYPE_ACCOUNT_ALREADY_REGISTERED:
case DrmInfoEvent.TYPE_RIGHTS_REMOVED: {
info = new DrmInfoEvent(uniqueId, infoType, message);
break;
}
default:
@@ -209,8 +213,8 @@ public class DrmManagerClient {
break;
}
if (null != mOnInfoListener && null != event) {
mOnInfoListener.onInfo(DrmManagerClient.this, event);
if (null != mOnInfoListener && null != info) {
mOnInfoListener.onInfo(DrmManagerClient.this, info);
}
if (null != mOnErrorListener && null != error) {
mOnErrorListener.onError(DrmManagerClient.this, error);

View File

@@ -43,6 +43,8 @@ public:
//! TYPE_ACCOUNT_ALREADY_REGISTERED, when registration has been
//! already done for the given account.
static const int TYPE_ACCOUNT_ALREADY_REGISTERED = 5;
//! TYPE_RIGHTS_REMOVED, when the rights has been removed.
static const int TYPE_RIGHTS_REMOVED = 6;
/**
* The following constant values should be in sync with DrmErrorEvent.java
@@ -61,6 +63,11 @@ public:
static const int TYPE_NO_INTERNET_CONNECTION = 2005;
//! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
//! TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects
//! associated with all DRM schemes.
static const int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
//! TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
static const int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
public:
/**