Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27b27777 authored by Gloria Wang's avatar Gloria Wang
Browse files

For issue 4082089

Add more info and error events into the DRM framework

Change-Id: I0bb3251c5947fc8e977d478e1ba46b242cb97e9d
parent 3ec9d06f
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -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"
+4 −0
Original line number Diff line number Diff line
@@ -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
+4 −0
Original line number Diff line number Diff line
@@ -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
+10 −6
Original line number Diff line number Diff line
@@ -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);
+7 −0
Original line number Diff line number Diff line
@@ -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:
    /**