DrmErrorEvent.java revision f8bf3c46f524b1252bf466a351daaef61afdcecb
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
19import java.util.HashMap;
20
21/**
22 * This is an entity class which would be passed to caller in
23 * {@link DrmManagerClient.OnErrorListener#onError(DrmManagerClient, DrmErrorEvent)}
24 *
25 */
26public class DrmErrorEvent extends DrmEvent {
27    /**
28     * TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights.
29     */
30    public static final int TYPE_RIGHTS_NOT_INSTALLED = 2001;
31    /**
32     * TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights.
33     */
34    public static final int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002;
35    /**
36     * TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent.
37     */
38    public static final int TYPE_NOT_SUPPORTED = 2003;
39    /**
40     * TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal.
41     * Can in the future perhaps be used to trigger garbage collector.
42     */
43    public static final int TYPE_OUT_OF_MEMORY = 2004;
44    /**
45     * TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt
46     * can be made to renew rights.
47     */
48    public static final int TYPE_NO_INTERNET_CONNECTION = 2005;
49    /**
50     * TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
51     */
52    public static final int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
53    /**
54     * TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects
55     * associated with all DRM schemes.
56     */
57    public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
58    /**
59     * TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
60     */
61    public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;
62
63    /**
64     * constructor to create DrmErrorEvent object with given parameters
65     *
66     * @param uniqueId Unique session identifier
67     * @param type Type of the event. It could be one of the types defined above
68     * @param message Message description
69     */
70    public DrmErrorEvent(int uniqueId, int type, String message) {
71        super(uniqueId, type, message);
72    }
73
74    /**
75     * constructor to create DrmErrorEvent object with given parameters
76     *
77     * @param uniqueId Unique session identifier
78     * @param type Type of the event. It could be one of the types defined above
79     * @param message Message description
80     * @param attributes Attributes for extensible information. Could be any
81     * information provided by the plugin
82     */
83    public DrmErrorEvent(int uniqueId, int type, String message,
84                            HashMap<String, Object> attributes) {
85        super(uniqueId, type, message, attributes);
86    }
87}
88
89