DrmEvent.java revision dc91865622e3cc9ff0bb33b83f1d3b38cd7a6d7a
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 all the rights information associated with
27     * all DRM schemes are removed successfully
28     */
29    public static final int TYPE_ALL_RIGHTS_REMOVED = 1001;
30    /**
31     * Constant field signifies that given information is processed successfully
32     */
33    public static final int TYPE_DRM_INFO_PROCESSED = 1002;
34
35    public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
36
37    private final int mUniqueId;
38    private final int mType;
39    private String mMessage = "";
40
41    /**
42     * constructor for DrmEvent class
43     *
44     * @param uniqueId Unique session identifier
45     * @param type Type of information
46     * @param message Message description
47     */
48    protected DrmEvent(int uniqueId, int type, String message) {
49        mUniqueId = uniqueId;
50        mType = type;
51
52        if (null != message) {
53            mMessage = message;
54        }
55    }
56
57    /**
58     * Returns the Unique Id associated with this object
59     *
60     * @return Unique Id
61     */
62    public int getUniqueId() {
63        return mUniqueId;
64    }
65
66    /**
67     * Returns the Type of information associated with this object
68     *
69     * @return Type of information
70     */
71    public int getType() {
72        return mType;
73    }
74
75    /**
76     * Returns the message description associated with this object
77     *
78     * @return message description
79     */
80    public String getMessage() {
81        return mMessage;
82    }
83}
84
85