aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 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 | |
| 17 | #ifndef __DRM_INFO_EVENT_H__ |
| 18 | #define __DRM_INFO_EVENT_H__ |
| 19 | |
| 20 | namespace android { |
| 21 | |
| 22 | class String8; |
| 23 | |
| 24 | /** |
| 25 | * This is an entity class which would be passed to caller in |
| 26 | * DrmManagerClient::OnInfoListener::onInfo(const DrmInfoEvent&). |
| 27 | */ |
| 28 | class DrmInfoEvent { |
| 29 | public: |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 30 | /** |
| 31 | * The following constant values should be in sync with DrmInfoEvent.java |
| 32 | */ |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 33 | //! TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT, when registration has been |
| 34 | //! already done by another account ID. |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 35 | static const int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 1; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 36 | //! TYPE_REMOVE_RIGHTS, when the rights needs to be removed completely. |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 37 | static const int TYPE_REMOVE_RIGHTS = 2; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 38 | //! TYPE_RIGHTS_INSTALLED, when the rights are downloaded and installed ok. |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 39 | static const int TYPE_RIGHTS_INSTALLED = 3; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 40 | //! TYPE_WAIT_FOR_RIGHTS, rights object is on it's way to phone, |
| 41 | //! wait before calling checkRights again |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 42 | static const int TYPE_WAIT_FOR_RIGHTS = 4; |
| 43 | //! TYPE_ACCOUNT_ALREADY_REGISTERED, when registration has been |
| 44 | //! already done for the given account. |
| 45 | static const int TYPE_ACCOUNT_ALREADY_REGISTERED = 5; |
Gloria Wang | 27b2777 | 2011-03-14 12:04:15 -0700 | [diff] [blame] | 46 | //! TYPE_RIGHTS_REMOVED, when the rights has been removed. |
| 47 | static const int TYPE_RIGHTS_REMOVED = 6; |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 48 | |
| 49 | /** |
| 50 | * The following constant values should be in sync with DrmErrorEvent.java |
| 51 | */ |
| 52 | //! TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights |
| 53 | static const int TYPE_RIGHTS_NOT_INSTALLED = 2001; |
| 54 | //! TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights |
| 55 | static const int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002; |
| 56 | //! TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent |
| 57 | static const int TYPE_NOT_SUPPORTED = 2003; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 58 | //! TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal. |
| 59 | //! Can in the future perhaps be used to trigger garbage collector |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 60 | static const int TYPE_OUT_OF_MEMORY = 2004; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 61 | //! TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt |
| 62 | //! can be made to renew rights |
Takeshi Aimi | dc549d6 | 2010-09-20 23:40:41 +0900 | [diff] [blame] | 63 | static const int TYPE_NO_INTERNET_CONNECTION = 2005; |
Takeshi Aimi | c7b3ccc | 2010-10-08 23:05:49 +0900 | [diff] [blame] | 64 | //! TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo. |
| 65 | static const int TYPE_PROCESS_DRM_INFO_FAILED = 2006; |
Gloria Wang | 27b2777 | 2011-03-14 12:04:15 -0700 | [diff] [blame] | 66 | //! TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects |
| 67 | //! associated with all DRM schemes. |
| 68 | static const int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007; |
| 69 | //! TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo. |
| 70 | static const int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 71 | |
| 72 | public: |
| 73 | /** |
| 74 | * Constructor for DrmInfoEvent |
| 75 | * |
| 76 | * @param[in] uniqueId Unique session identifier |
| 77 | * @param[in] infoType Type of information |
| 78 | * @param[in] message Message description |
| 79 | */ |
Gloria Wang | cfbe436 | 2011-03-17 15:02:34 -0700 | [diff] [blame] | 80 | DrmInfoEvent(int uniqueId, int infoType, const String8 message); |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 81 | |
| 82 | /** |
| 83 | * Destructor for DrmInfoEvent |
| 84 | */ |
| 85 | virtual ~DrmInfoEvent() {} |
| 86 | |
| 87 | public: |
| 88 | /** |
| 89 | * Returns the Unique Id associated with this instance |
| 90 | * |
| 91 | * @return Unique Id |
| 92 | */ |
| 93 | int getUniqueId() const; |
| 94 | |
| 95 | /** |
| 96 | * Returns the Type of information associated with this object |
| 97 | * |
| 98 | * @return Type of information |
| 99 | */ |
| 100 | int getType() const; |
| 101 | |
| 102 | /** |
| 103 | * Returns the message description associated with this object |
| 104 | * |
| 105 | * @return Message description |
| 106 | */ |
Gloria Wang | cfbe436 | 2011-03-17 15:02:34 -0700 | [diff] [blame] | 107 | const String8 getMessage() const; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 108 | |
| 109 | private: |
| 110 | int mUniqueId; |
| 111 | int mInfoType; |
Gloria Wang | cfbe436 | 2011-03-17 15:02:34 -0700 | [diff] [blame] | 112 | const String8 mMessage; |
aimitakeshi | d074e30 | 2010-07-29 10:12:27 +0900 | [diff] [blame] | 113 | }; |
| 114 | |
| 115 | }; |
| 116 | |
| 117 | #endif /* __DRM_INFO_EVENT_H__ */ |
| 118 | |