DrmEvent.java revision dc549d60f98d809f626c99de614960409a847054
1/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.drm;
18
19/**
20 * This is the base class which would be used to notify the caller
21 * about any event occurred in DRM framework.
22 *
23 */
24public class DrmEvent {
25    /**
26     * Constant field signifies that unload and finalize the loaded plugins successfully
27     */
28    public static final int TYPE_FINALIZED = 1001;
29    /**
30     * Constant field signifies that register with the service successfully
31     */
32    public static final int TYPE_REGISTERED = 1002;
33    /**
34     * Constant field signifies that load and initialized the available plugins successfully
35     */
36    public static final int TYPE_INITIALIZED = 1003;
37    /**
38     * Constant field signifies that unregister with the service successfully
39     */
40    public static final int TYPE_UNREGISTERED = 1004;
41    /**
42     * Constant field signifies that rights information is acquired successfully
43     */
44    public static final int TYPE_RIGHTS_ACQUIRED = 1005;
45    /**
46     * Constant field signifies that all the rights information associated with
47     * all DRM schemes are removed successfully
48     */
49    public static final int TYPE_ALL_RIGHTS_REMOVED = 1006;
50    /**
51     * Constant field signifies that the required information to communicate with
52     * the service is acquired sucessfully
53     */
54    public static final int TYPE_DRM_INFO_ACQUIRED = 1007;
55
56    public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
57    public static final String DRM_INFO_OBJECT = "drm_info_object";
58
59    private final int mUniqueId;
60    private final int mType;
61    private String mMessage = "";
62
63    /**
64     * constructor for DrmEvent class
65     *
66     * @param uniqueId Unique session identifier
67     * @param type Type of information
68     * @param message Message description
69     */
70    protected DrmEvent(int uniqueId, int type, String message) {
71        mUniqueId = uniqueId;
72        mType = type;
73
74        if (null != message) {
75            mMessage = message;
76        }
77    }
78
79    /**
80     * Returns the Unique Id associated with this object
81     *
82     * @return Unique Id
83     */
84    public int getUniqueId() {
85        return mUniqueId;
86    }
87
88    /**
89     * Returns the Type of information associated with this object
90     *
91     * @return Type of information
92     */
93    public int getType() {
94        return mType;
95    }
96
97    /**
98     * Returns the message description associated with this object
99     *
100     * @return message description
101     */
102    public String getMessage() {
103        return mMessage;
104    }
105}
106
107