Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | //#define LOG_NDEBUG 0 |
| 18 | #define LOG_TAG "IDrm" |
| 19 | #include <utils/Log.h> |
| 20 | |
| 21 | #include <binder/Parcel.h> |
| 22 | #include <media/IDrm.h> |
| 23 | #include <media/stagefright/MediaErrors.h> |
| 24 | #include <media/stagefright/foundation/ADebug.h> |
| 25 | #include <media/stagefright/foundation/AString.h> |
| 26 | |
| 27 | namespace android { |
| 28 | |
| 29 | enum { |
| 30 | INIT_CHECK = IBinder::FIRST_CALL_TRANSACTION, |
| 31 | IS_CRYPTO_SUPPORTED, |
| 32 | CREATE_PLUGIN, |
| 33 | DESTROY_PLUGIN, |
| 34 | OPEN_SESSION, |
| 35 | CLOSE_SESSION, |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 36 | GET_KEY_REQUEST, |
| 37 | PROVIDE_KEY_RESPONSE, |
| 38 | REMOVE_KEYS, |
| 39 | RESTORE_KEYS, |
| 40 | QUERY_KEY_STATUS, |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 41 | GET_PROVISION_REQUEST, |
| 42 | PROVIDE_PROVISION_RESPONSE, |
| 43 | GET_SECURE_STOPS, |
| 44 | RELEASE_SECURE_STOPS, |
| 45 | GET_PROPERTY_STRING, |
| 46 | GET_PROPERTY_BYTE_ARRAY, |
| 47 | SET_PROPERTY_STRING, |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 48 | SET_PROPERTY_BYTE_ARRAY, |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 49 | GET_METRICS, |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 50 | SET_CIPHER_ALGORITHM, |
| 51 | SET_MAC_ALGORITHM, |
| 52 | ENCRYPT, |
| 53 | DECRYPT, |
| 54 | SIGN, |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 55 | SIGN_RSA, |
Jeff Tinker | c0d5f1f | 2013-04-02 13:08:05 -0700 | [diff] [blame] | 56 | VERIFY, |
Jeff Tinker | 68b1555 | 2014-04-30 10:19:03 -0700 | [diff] [blame] | 57 | SET_LISTENER, |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 58 | GET_SECURE_STOP, |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 59 | REMOVE_ALL_SECURE_STOPS, |
Jeff Tinker | 6d998b6 | 2017-12-18 14:37:43 -0800 | [diff] [blame] | 60 | GET_HDCP_LEVELS, |
| 61 | GET_NUMBER_OF_SESSIONS, |
| 62 | GET_SECURITY_LEVEL, |
| 63 | SET_SECURITY_LEVEL, |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 64 | REMOVE_SECURE_STOP, |
| 65 | GET_SECURE_STOP_IDS |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 66 | }; |
| 67 | |
| 68 | struct BpDrm : public BpInterface<IDrm> { |
Chih-Hung Hsieh | 090ef60 | 2016-04-27 10:39:54 -0700 | [diff] [blame] | 69 | explicit BpDrm(const sp<IBinder> &impl) |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 70 | : BpInterface<IDrm>(impl) { |
| 71 | } |
| 72 | |
| 73 | virtual status_t initCheck() const { |
| 74 | Parcel data, reply; |
| 75 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 76 | status_t status = remote()->transact(INIT_CHECK, data, &reply); |
| 77 | if (status != OK) { |
| 78 | return status; |
| 79 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 80 | |
| 81 | return reply.readInt32(); |
| 82 | } |
| 83 | |
Jeff Tinker | 9cf69e0 | 2013-08-21 11:59:23 -0700 | [diff] [blame] | 84 | virtual bool isCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 85 | Parcel data, reply; |
| 86 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 87 | data.write(uuid, 16); |
Jeff Tinker | 9cf69e0 | 2013-08-21 11:59:23 -0700 | [diff] [blame] | 88 | data.writeString8(mimeType); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 89 | status_t status = remote()->transact(IS_CRYPTO_SUPPORTED, data, &reply); |
| 90 | if (status != OK) { |
| 91 | ALOGE("isCryptoSchemeSupported: binder call failed: %d", status); |
| 92 | return false; |
| 93 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 94 | |
| 95 | return reply.readInt32() != 0; |
| 96 | } |
| 97 | |
Edwin Wong | 68b3d9f | 2017-01-06 19:07:54 -0800 | [diff] [blame] | 98 | virtual status_t createPlugin(const uint8_t uuid[16], |
| 99 | const String8& appPackageName) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 100 | Parcel data, reply; |
| 101 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 102 | data.write(uuid, 16); |
Edwin Wong | 68b3d9f | 2017-01-06 19:07:54 -0800 | [diff] [blame] | 103 | data.writeString8(appPackageName); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 104 | status_t status = remote()->transact(CREATE_PLUGIN, data, &reply); |
| 105 | if (status != OK) { |
Edwin Wong | 68b3d9f | 2017-01-06 19:07:54 -0800 | [diff] [blame] | 106 | ALOGE("createPlugin: binder call failed: %d", status); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 107 | return status; |
| 108 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 109 | |
| 110 | return reply.readInt32(); |
| 111 | } |
| 112 | |
| 113 | virtual status_t destroyPlugin() { |
| 114 | Parcel data, reply; |
| 115 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 116 | status_t status = remote()->transact(DESTROY_PLUGIN, data, &reply); |
| 117 | if (status != OK) { |
| 118 | return status; |
| 119 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 120 | |
| 121 | return reply.readInt32(); |
| 122 | } |
| 123 | |
| 124 | virtual status_t openSession(Vector<uint8_t> &sessionId) { |
| 125 | Parcel data, reply; |
| 126 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 127 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 128 | status_t status = remote()->transact(OPEN_SESSION, data, &reply); |
| 129 | if (status != OK) { |
| 130 | return status; |
| 131 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 132 | readVector(reply, sessionId); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 133 | |
| 134 | return reply.readInt32(); |
| 135 | } |
| 136 | |
| 137 | virtual status_t closeSession(Vector<uint8_t> const &sessionId) { |
| 138 | Parcel data, reply; |
| 139 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 140 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 141 | writeVector(data, sessionId); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 142 | status_t status = remote()->transact(CLOSE_SESSION, data, &reply); |
| 143 | if (status != OK) { |
| 144 | return status; |
| 145 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 146 | |
| 147 | return reply.readInt32(); |
| 148 | } |
| 149 | |
| 150 | virtual status_t |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 151 | getKeyRequest(Vector<uint8_t> const &sessionId, |
| 152 | Vector<uint8_t> const &initData, |
| 153 | String8 const &mimeType, DrmPlugin::KeyType keyType, |
| 154 | KeyedVector<String8, String8> const &optionalParameters, |
Jeff Tinker | d072c90 | 2015-03-16 13:39:29 -0700 | [diff] [blame] | 155 | Vector<uint8_t> &request, String8 &defaultUrl, |
| 156 | DrmPlugin::KeyRequestType *keyRequestType) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 157 | Parcel data, reply; |
| 158 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 159 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 160 | writeVector(data, sessionId); |
| 161 | writeVector(data, initData); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 162 | data.writeString8(mimeType); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 163 | data.writeInt32((uint32_t)keyType); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 164 | |
| 165 | data.writeInt32(optionalParameters.size()); |
| 166 | for (size_t i = 0; i < optionalParameters.size(); ++i) { |
| 167 | data.writeString8(optionalParameters.keyAt(i)); |
| 168 | data.writeString8(optionalParameters.valueAt(i)); |
| 169 | } |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 170 | |
| 171 | status_t status = remote()->transact(GET_KEY_REQUEST, data, &reply); |
| 172 | if (status != OK) { |
| 173 | return status; |
| 174 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 175 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 176 | readVector(reply, request); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 177 | defaultUrl = reply.readString8(); |
Jeff Tinker | d072c90 | 2015-03-16 13:39:29 -0700 | [diff] [blame] | 178 | *keyRequestType = static_cast<DrmPlugin::KeyRequestType>(reply.readInt32()); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 179 | |
| 180 | return reply.readInt32(); |
| 181 | } |
| 182 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 183 | virtual status_t provideKeyResponse(Vector<uint8_t> const &sessionId, |
| 184 | Vector<uint8_t> const &response, |
| 185 | Vector<uint8_t> &keySetId) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 186 | Parcel data, reply; |
| 187 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 188 | writeVector(data, sessionId); |
| 189 | writeVector(data, response); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 190 | |
| 191 | status_t status = remote()->transact(PROVIDE_KEY_RESPONSE, data, &reply); |
| 192 | if (status != OK) { |
| 193 | return status; |
| 194 | } |
| 195 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 196 | readVector(reply, keySetId); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 197 | |
| 198 | return reply.readInt32(); |
| 199 | } |
| 200 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 201 | virtual status_t removeKeys(Vector<uint8_t> const &keySetId) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 202 | Parcel data, reply; |
| 203 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 204 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 205 | writeVector(data, keySetId); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 206 | status_t status = remote()->transact(REMOVE_KEYS, data, &reply); |
| 207 | if (status != OK) { |
| 208 | return status; |
| 209 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 210 | |
| 211 | return reply.readInt32(); |
| 212 | } |
| 213 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 214 | virtual status_t restoreKeys(Vector<uint8_t> const &sessionId, |
| 215 | Vector<uint8_t> const &keySetId) { |
| 216 | Parcel data, reply; |
| 217 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 218 | |
| 219 | writeVector(data, sessionId); |
| 220 | writeVector(data, keySetId); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 221 | status_t status = remote()->transact(RESTORE_KEYS, data, &reply); |
| 222 | if (status != OK) { |
| 223 | return status; |
| 224 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 225 | |
| 226 | return reply.readInt32(); |
| 227 | } |
| 228 | |
| 229 | virtual status_t queryKeyStatus(Vector<uint8_t> const &sessionId, |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 230 | KeyedVector<String8, String8> &infoMap) const { |
| 231 | Parcel data, reply; |
| 232 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 233 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 234 | writeVector(data, sessionId); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 235 | status_t status = remote()->transact(QUERY_KEY_STATUS, data, &reply); |
| 236 | if (status != OK) { |
| 237 | return status; |
| 238 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 239 | |
| 240 | infoMap.clear(); |
| 241 | size_t count = reply.readInt32(); |
| 242 | for (size_t i = 0; i < count; i++) { |
| 243 | String8 key = reply.readString8(); |
| 244 | String8 value = reply.readString8(); |
| 245 | infoMap.add(key, value); |
| 246 | } |
| 247 | return reply.readInt32(); |
| 248 | } |
| 249 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 250 | virtual status_t getProvisionRequest(String8 const &certType, |
| 251 | String8 const &certAuthority, |
| 252 | Vector<uint8_t> &request, |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 253 | String8 &defaultUrl) { |
| 254 | Parcel data, reply; |
| 255 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 256 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 257 | data.writeString8(certType); |
| 258 | data.writeString8(certAuthority); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 259 | status_t status = remote()->transact(GET_PROVISION_REQUEST, data, &reply); |
| 260 | if (status != OK) { |
| 261 | return status; |
| 262 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 263 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 264 | readVector(reply, request); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 265 | defaultUrl = reply.readString8(); |
| 266 | |
| 267 | return reply.readInt32(); |
| 268 | } |
| 269 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 270 | virtual status_t provideProvisionResponse(Vector<uint8_t> const &response, |
| 271 | Vector<uint8_t> &certificate, |
| 272 | Vector<uint8_t> &wrappedKey) { |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 273 | Parcel data, reply; |
| 274 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 275 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 276 | writeVector(data, response); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 277 | status_t status = remote()->transact(PROVIDE_PROVISION_RESPONSE, data, &reply); |
| 278 | if (status != OK) { |
| 279 | return status; |
| 280 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 281 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 282 | readVector(reply, certificate); |
| 283 | readVector(reply, wrappedKey); |
| 284 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 285 | return reply.readInt32(); |
| 286 | } |
| 287 | |
| 288 | virtual status_t getSecureStops(List<Vector<uint8_t> > &secureStops) { |
| 289 | Parcel data, reply; |
| 290 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 291 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 292 | status_t status = remote()->transact(GET_SECURE_STOPS, data, &reply); |
| 293 | if (status != OK) { |
| 294 | return status; |
| 295 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 296 | |
| 297 | secureStops.clear(); |
| 298 | uint32_t count = reply.readInt32(); |
| 299 | for (size_t i = 0; i < count; i++) { |
| 300 | Vector<uint8_t> secureStop; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 301 | readVector(reply, secureStop); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 302 | secureStops.push_back(secureStop); |
| 303 | } |
| 304 | return reply.readInt32(); |
| 305 | } |
| 306 | |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 307 | virtual status_t getSecureStopIds(List<Vector<uint8_t> > &secureStopIds) { |
| 308 | Parcel data, reply; |
| 309 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 310 | |
| 311 | status_t status = remote()->transact(GET_SECURE_STOP_IDS, data, &reply); |
| 312 | if (status != OK) { |
| 313 | return status; |
| 314 | } |
| 315 | |
| 316 | secureStopIds.clear(); |
| 317 | uint32_t count = reply.readInt32(); |
| 318 | for (size_t i = 0; i < count; i++) { |
| 319 | Vector<uint8_t> secureStopId; |
| 320 | readVector(reply, secureStopId); |
| 321 | secureStopIds.push_back(secureStopId); |
| 322 | } |
| 323 | return reply.readInt32(); |
| 324 | } |
| 325 | |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 326 | virtual status_t getSecureStop(Vector<uint8_t> const &ssid, Vector<uint8_t> &secureStop) { |
| 327 | Parcel data, reply; |
| 328 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 329 | |
| 330 | writeVector(data, ssid); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 331 | status_t status = remote()->transact(GET_SECURE_STOP, data, &reply); |
| 332 | if (status != OK) { |
| 333 | return status; |
| 334 | } |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 335 | |
| 336 | readVector(reply, secureStop); |
| 337 | return reply.readInt32(); |
| 338 | } |
| 339 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 340 | virtual status_t releaseSecureStops(Vector<uint8_t> const &ssRelease) { |
| 341 | Parcel data, reply; |
| 342 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 343 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 344 | writeVector(data, ssRelease); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 345 | status_t status = remote()->transact(RELEASE_SECURE_STOPS, data, &reply); |
| 346 | if (status != OK) { |
| 347 | return status; |
| 348 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 349 | |
| 350 | return reply.readInt32(); |
| 351 | } |
| 352 | |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 353 | virtual status_t removeSecureStop(Vector<uint8_t> const &ssid) { |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 354 | Parcel data, reply; |
| 355 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 356 | |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 357 | writeVector(data, ssid); |
| 358 | status_t status = remote()->transact(REMOVE_SECURE_STOP, data, &reply); |
| 359 | if (status != OK) { |
| 360 | return status; |
| 361 | } |
| 362 | |
| 363 | return reply.readInt32(); |
| 364 | } |
| 365 | |
| 366 | virtual status_t removeAllSecureStops() { |
| 367 | Parcel data, reply; |
| 368 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 369 | |
| 370 | status_t status = remote()->transact(REMOVE_ALL_SECURE_STOPS, data, &reply); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 371 | if (status != OK) { |
| 372 | return status; |
| 373 | } |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 374 | |
| 375 | return reply.readInt32(); |
| 376 | } |
| 377 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 378 | virtual status_t getPropertyString(String8 const &name, String8 &value) const { |
| 379 | Parcel data, reply; |
| 380 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 381 | |
| 382 | data.writeString8(name); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 383 | status_t status = remote()->transact(GET_PROPERTY_STRING, data, &reply); |
| 384 | if (status != OK) { |
| 385 | return status; |
| 386 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 387 | |
| 388 | value = reply.readString8(); |
| 389 | return reply.readInt32(); |
| 390 | } |
| 391 | |
Jeff Tinker | 6d998b6 | 2017-12-18 14:37:43 -0800 | [diff] [blame] | 392 | virtual status_t getHdcpLevels(DrmPlugin::HdcpLevel *connected, |
| 393 | DrmPlugin::HdcpLevel *max) const { |
| 394 | Parcel data, reply; |
| 395 | |
| 396 | if (connected == NULL || max == NULL) { |
| 397 | return BAD_VALUE; |
| 398 | } |
| 399 | |
| 400 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 401 | |
| 402 | status_t status = remote()->transact(GET_HDCP_LEVELS, data, &reply); |
| 403 | if (status != OK) { |
| 404 | return status; |
| 405 | } |
| 406 | |
| 407 | *connected = static_cast<DrmPlugin::HdcpLevel>(reply.readInt32()); |
| 408 | *max = static_cast<DrmPlugin::HdcpLevel>(reply.readInt32()); |
| 409 | return reply.readInt32(); |
| 410 | } |
| 411 | |
| 412 | virtual status_t getNumberOfSessions(uint32_t *open, uint32_t *max) const { |
| 413 | Parcel data, reply; |
| 414 | |
| 415 | if (open == NULL || max == NULL) { |
| 416 | return BAD_VALUE; |
| 417 | } |
| 418 | |
| 419 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 420 | |
| 421 | status_t status = remote()->transact(GET_NUMBER_OF_SESSIONS, data, &reply); |
| 422 | if (status != OK) { |
| 423 | return status; |
| 424 | } |
| 425 | |
| 426 | *open = reply.readInt32(); |
| 427 | *max = reply.readInt32(); |
| 428 | return reply.readInt32(); |
| 429 | } |
| 430 | |
| 431 | virtual status_t getSecurityLevel(Vector<uint8_t> const &sessionId, |
| 432 | DrmPlugin::SecurityLevel *level) const { |
| 433 | Parcel data, reply; |
| 434 | |
| 435 | if (level == NULL) { |
| 436 | return BAD_VALUE; |
| 437 | } |
| 438 | |
| 439 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 440 | |
| 441 | writeVector(data, sessionId); |
| 442 | status_t status = remote()->transact(GET_SECURITY_LEVEL, data, &reply); |
| 443 | if (status != OK) { |
| 444 | return status; |
| 445 | } |
| 446 | |
| 447 | *level = static_cast<DrmPlugin::SecurityLevel>(reply.readInt32()); |
| 448 | return reply.readInt32(); |
| 449 | } |
| 450 | |
| 451 | virtual status_t setSecurityLevel(Vector<uint8_t> const &sessionId, |
| 452 | const DrmPlugin::SecurityLevel& level) { |
| 453 | Parcel data, reply; |
| 454 | |
| 455 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 456 | |
| 457 | writeVector(data, sessionId); |
| 458 | data.writeInt32(static_cast<uint32_t>(level)); |
| 459 | |
| 460 | status_t status = remote()->transact(SET_SECURITY_LEVEL, data, &reply); |
| 461 | if (status != OK) { |
| 462 | return status; |
| 463 | } |
| 464 | |
| 465 | return reply.readInt32(); |
| 466 | } |
| 467 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 468 | virtual status_t getPropertyByteArray(String8 const &name, Vector<uint8_t> &value) const { |
| 469 | Parcel data, reply; |
| 470 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 471 | |
| 472 | data.writeString8(name); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 473 | status_t status = remote()->transact(GET_PROPERTY_BYTE_ARRAY, data, &reply); |
| 474 | if (status != OK) { |
| 475 | return status; |
| 476 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 477 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 478 | readVector(reply, value); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 479 | return reply.readInt32(); |
| 480 | } |
| 481 | |
| 482 | virtual status_t setPropertyString(String8 const &name, String8 const &value) const { |
| 483 | Parcel data, reply; |
| 484 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 485 | |
| 486 | data.writeString8(name); |
| 487 | data.writeString8(value); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 488 | status_t status = remote()->transact(SET_PROPERTY_STRING, data, &reply); |
| 489 | if (status != OK) { |
| 490 | return status; |
| 491 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 492 | |
| 493 | return reply.readInt32(); |
| 494 | } |
| 495 | |
| 496 | virtual status_t setPropertyByteArray(String8 const &name, |
| 497 | Vector<uint8_t> const &value) const { |
| 498 | Parcel data, reply; |
| 499 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 500 | |
| 501 | data.writeString8(name); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 502 | writeVector(data, value); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 503 | status_t status = remote()->transact(SET_PROPERTY_BYTE_ARRAY, data, &reply); |
| 504 | if (status != OK) { |
| 505 | return status; |
| 506 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 507 | |
| 508 | return reply.readInt32(); |
| 509 | } |
| 510 | |
Adam Stone | 637b785 | 2018-01-30 12:09:36 -0800 | [diff] [blame] | 511 | virtual status_t getMetrics(os::PersistableBundle *metrics) { |
Adam Stone | 568b3c4 | 2018-01-31 12:57:16 -0800 | [diff] [blame^] | 512 | if (metrics == NULL) { |
| 513 | return BAD_VALUE; |
| 514 | } |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 515 | Parcel data, reply; |
| 516 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 517 | |
| 518 | status_t status = remote()->transact(GET_METRICS, data, &reply); |
| 519 | if (status != OK) { |
| 520 | return status; |
| 521 | } |
Adam Stone | 568b3c4 | 2018-01-31 12:57:16 -0800 | [diff] [blame^] | 522 | // The reply data is ordered as |
| 523 | // 1) 32 bit integer reply followed by |
| 524 | // 2) Serialized PersistableBundle containing metrics. |
| 525 | status_t reply_status; |
| 526 | if (reply.readInt32(&reply_status) != OK |
| 527 | || reply_status != OK) { |
| 528 | ALOGE("Failed to read getMetrics response code from parcel. %d", |
| 529 | reply_status); |
| 530 | return reply_status; |
| 531 | } |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 532 | |
Adam Stone | 568b3c4 | 2018-01-31 12:57:16 -0800 | [diff] [blame^] | 533 | status = metrics->readFromParcel(&reply); |
| 534 | if (status != OK) { |
| 535 | ALOGE("Failed to read metrics from parcel. %d", status); |
| 536 | return status; |
| 537 | } |
| 538 | return reply_status; |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 539 | } |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 540 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 541 | virtual status_t setCipherAlgorithm(Vector<uint8_t> const &sessionId, |
| 542 | String8 const &algorithm) { |
| 543 | Parcel data, reply; |
| 544 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 545 | |
| 546 | writeVector(data, sessionId); |
| 547 | data.writeString8(algorithm); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 548 | status_t status = remote()->transact(SET_CIPHER_ALGORITHM, data, &reply); |
| 549 | if (status != OK) { |
| 550 | return status; |
| 551 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 552 | return reply.readInt32(); |
| 553 | } |
| 554 | |
| 555 | virtual status_t setMacAlgorithm(Vector<uint8_t> const &sessionId, |
| 556 | String8 const &algorithm) { |
| 557 | Parcel data, reply; |
| 558 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 559 | |
| 560 | writeVector(data, sessionId); |
| 561 | data.writeString8(algorithm); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 562 | status_t status = remote()->transact(SET_MAC_ALGORITHM, data, &reply); |
| 563 | if (status != OK) { |
| 564 | return status; |
| 565 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 566 | return reply.readInt32(); |
| 567 | } |
| 568 | |
| 569 | virtual status_t encrypt(Vector<uint8_t> const &sessionId, |
| 570 | Vector<uint8_t> const &keyId, |
| 571 | Vector<uint8_t> const &input, |
| 572 | Vector<uint8_t> const &iv, |
| 573 | Vector<uint8_t> &output) { |
| 574 | Parcel data, reply; |
| 575 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 576 | |
| 577 | writeVector(data, sessionId); |
| 578 | writeVector(data, keyId); |
| 579 | writeVector(data, input); |
| 580 | writeVector(data, iv); |
| 581 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 582 | status_t status = remote()->transact(ENCRYPT, data, &reply); |
| 583 | if (status != OK) { |
| 584 | return status; |
| 585 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 586 | readVector(reply, output); |
| 587 | |
| 588 | return reply.readInt32(); |
| 589 | } |
| 590 | |
| 591 | virtual status_t decrypt(Vector<uint8_t> const &sessionId, |
| 592 | Vector<uint8_t> const &keyId, |
| 593 | Vector<uint8_t> const &input, |
| 594 | Vector<uint8_t> const &iv, |
| 595 | Vector<uint8_t> &output) { |
| 596 | Parcel data, reply; |
| 597 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 598 | |
| 599 | writeVector(data, sessionId); |
| 600 | writeVector(data, keyId); |
| 601 | writeVector(data, input); |
| 602 | writeVector(data, iv); |
| 603 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 604 | status_t status = remote()->transact(DECRYPT, data, &reply); |
| 605 | if (status != OK) { |
| 606 | return status; |
| 607 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 608 | readVector(reply, output); |
| 609 | |
| 610 | return reply.readInt32(); |
| 611 | } |
| 612 | |
| 613 | virtual status_t sign(Vector<uint8_t> const &sessionId, |
| 614 | Vector<uint8_t> const &keyId, |
| 615 | Vector<uint8_t> const &message, |
| 616 | Vector<uint8_t> &signature) { |
| 617 | Parcel data, reply; |
| 618 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 619 | |
| 620 | writeVector(data, sessionId); |
| 621 | writeVector(data, keyId); |
| 622 | writeVector(data, message); |
| 623 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 624 | status_t status = remote()->transact(SIGN, data, &reply); |
| 625 | if (status != OK) { |
| 626 | return status; |
| 627 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 628 | readVector(reply, signature); |
| 629 | |
| 630 | return reply.readInt32(); |
| 631 | } |
| 632 | |
| 633 | virtual status_t verify(Vector<uint8_t> const &sessionId, |
| 634 | Vector<uint8_t> const &keyId, |
| 635 | Vector<uint8_t> const &message, |
| 636 | Vector<uint8_t> const &signature, |
| 637 | bool &match) { |
| 638 | Parcel data, reply; |
| 639 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 640 | |
| 641 | writeVector(data, sessionId); |
| 642 | writeVector(data, keyId); |
| 643 | writeVector(data, message); |
| 644 | writeVector(data, signature); |
| 645 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 646 | status_t status = remote()->transact(VERIFY, data, &reply); |
| 647 | if (status != OK) { |
| 648 | return status; |
| 649 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 650 | match = (bool)reply.readInt32(); |
| 651 | return reply.readInt32(); |
| 652 | } |
| 653 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 654 | virtual status_t signRSA(Vector<uint8_t> const &sessionId, |
| 655 | String8 const &algorithm, |
| 656 | Vector<uint8_t> const &message, |
| 657 | Vector<uint8_t> const &wrappedKey, |
| 658 | Vector<uint8_t> &signature) { |
| 659 | Parcel data, reply; |
| 660 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
| 661 | |
| 662 | writeVector(data, sessionId); |
| 663 | data.writeString8(algorithm); |
| 664 | writeVector(data, message); |
| 665 | writeVector(data, wrappedKey); |
| 666 | |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 667 | status_t status = remote()->transact(SIGN_RSA, data, &reply); |
| 668 | if (status != OK) { |
| 669 | return status; |
| 670 | } |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 671 | readVector(reply, signature); |
| 672 | |
| 673 | return reply.readInt32(); |
| 674 | } |
| 675 | |
Jeff Tinker | c0d5f1f | 2013-04-02 13:08:05 -0700 | [diff] [blame] | 676 | virtual status_t setListener(const sp<IDrmClient>& listener) { |
| 677 | Parcel data, reply; |
| 678 | data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); |
Marco Nelissen | 06b4606 | 2014-11-14 07:58:25 -0800 | [diff] [blame] | 679 | data.writeStrongBinder(IInterface::asBinder(listener)); |
Jeff Tinker | 3b5401a | 2015-06-15 17:42:10 -0700 | [diff] [blame] | 680 | status_t status = remote()->transact(SET_LISTENER, data, &reply); |
| 681 | if (status != OK) { |
| 682 | return status; |
| 683 | } |
Jeff Tinker | c0d5f1f | 2013-04-02 13:08:05 -0700 | [diff] [blame] | 684 | return reply.readInt32(); |
| 685 | } |
| 686 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 687 | private: |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 688 | void readVector(Parcel &reply, Vector<uint8_t> &vector) const { |
| 689 | uint32_t size = reply.readInt32(); |
| 690 | vector.insertAt((size_t)0, size); |
| 691 | reply.read(vector.editArray(), size); |
| 692 | } |
| 693 | |
| 694 | void writeVector(Parcel &data, Vector<uint8_t> const &vector) const { |
| 695 | data.writeInt32(vector.size()); |
| 696 | data.write(vector.array(), vector.size()); |
| 697 | } |
| 698 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 699 | DISALLOW_EVIL_CONSTRUCTORS(BpDrm); |
| 700 | }; |
| 701 | |
| 702 | IMPLEMENT_META_INTERFACE(Drm, "android.drm.IDrm"); |
| 703 | |
| 704 | //////////////////////////////////////////////////////////////////////////////// |
| 705 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 706 | void BnDrm::readVector(const Parcel &data, Vector<uint8_t> &vector) const { |
| 707 | uint32_t size = data.readInt32(); |
Jeff Tinker | 3cf728e | 2017-10-18 20:54:26 +0000 | [diff] [blame] | 708 | if (vector.insertAt((size_t)0, size) < 0) { |
| 709 | vector.clear(); |
| 710 | } |
| 711 | if (data.read(vector.editArray(), size) != NO_ERROR) { |
| 712 | vector.clear(); |
| 713 | android_errorWriteWithInfoLog(0x534e4554, "62872384", -1, NULL, 0); |
| 714 | } |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 715 | } |
| 716 | |
| 717 | void BnDrm::writeVector(Parcel *reply, Vector<uint8_t> const &vector) const { |
| 718 | reply->writeInt32(vector.size()); |
| 719 | reply->write(vector.array(), vector.size()); |
| 720 | } |
| 721 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 722 | status_t BnDrm::onTransact( |
| 723 | uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) { |
| 724 | switch (code) { |
| 725 | case INIT_CHECK: |
| 726 | { |
| 727 | CHECK_INTERFACE(IDrm, data, reply); |
| 728 | reply->writeInt32(initCheck()); |
| 729 | return OK; |
| 730 | } |
| 731 | |
| 732 | case IS_CRYPTO_SUPPORTED: |
| 733 | { |
| 734 | CHECK_INTERFACE(IDrm, data, reply); |
| 735 | uint8_t uuid[16]; |
| 736 | data.read(uuid, sizeof(uuid)); |
Jeff Tinker | 9cf69e0 | 2013-08-21 11:59:23 -0700 | [diff] [blame] | 737 | String8 mimeType = data.readString8(); |
| 738 | reply->writeInt32(isCryptoSchemeSupported(uuid, mimeType)); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 739 | return OK; |
| 740 | } |
| 741 | |
| 742 | case CREATE_PLUGIN: |
| 743 | { |
| 744 | CHECK_INTERFACE(IDrm, data, reply); |
| 745 | uint8_t uuid[16]; |
| 746 | data.read(uuid, sizeof(uuid)); |
Edwin Wong | 68b3d9f | 2017-01-06 19:07:54 -0800 | [diff] [blame] | 747 | String8 appPackageName = data.readString8(); |
| 748 | reply->writeInt32(createPlugin(uuid, appPackageName)); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 749 | return OK; |
| 750 | } |
| 751 | |
| 752 | case DESTROY_PLUGIN: |
| 753 | { |
| 754 | CHECK_INTERFACE(IDrm, data, reply); |
| 755 | reply->writeInt32(destroyPlugin()); |
| 756 | return OK; |
| 757 | } |
| 758 | |
| 759 | case OPEN_SESSION: |
| 760 | { |
| 761 | CHECK_INTERFACE(IDrm, data, reply); |
| 762 | Vector<uint8_t> sessionId; |
| 763 | status_t result = openSession(sessionId); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 764 | writeVector(reply, sessionId); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 765 | reply->writeInt32(result); |
| 766 | return OK; |
| 767 | } |
| 768 | |
| 769 | case CLOSE_SESSION: |
| 770 | { |
| 771 | CHECK_INTERFACE(IDrm, data, reply); |
| 772 | Vector<uint8_t> sessionId; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 773 | readVector(data, sessionId); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 774 | reply->writeInt32(closeSession(sessionId)); |
| 775 | return OK; |
| 776 | } |
| 777 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 778 | case GET_KEY_REQUEST: |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 779 | { |
| 780 | CHECK_INTERFACE(IDrm, data, reply); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 781 | Vector<uint8_t> sessionId, initData; |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 782 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 783 | readVector(data, sessionId); |
| 784 | readVector(data, initData); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 785 | String8 mimeType = data.readString8(); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 786 | DrmPlugin::KeyType keyType = (DrmPlugin::KeyType)data.readInt32(); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 787 | |
| 788 | KeyedVector<String8, String8> optionalParameters; |
| 789 | uint32_t count = data.readInt32(); |
| 790 | for (size_t i = 0; i < count; ++i) { |
| 791 | String8 key, value; |
| 792 | key = data.readString8(); |
| 793 | value = data.readString8(); |
| 794 | optionalParameters.add(key, value); |
| 795 | } |
| 796 | |
| 797 | Vector<uint8_t> request; |
| 798 | String8 defaultUrl; |
Jeff Tinker | 8aff777 | 2016-02-08 17:52:25 -0800 | [diff] [blame] | 799 | DrmPlugin::KeyRequestType keyRequestType = DrmPlugin::kKeyRequestType_Unknown; |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 800 | |
Jeff Tinker | d072c90 | 2015-03-16 13:39:29 -0700 | [diff] [blame] | 801 | status_t result = getKeyRequest(sessionId, initData, mimeType, |
| 802 | keyType, optionalParameters, request, defaultUrl, |
| 803 | &keyRequestType); |
| 804 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 805 | writeVector(reply, request); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 806 | reply->writeString8(defaultUrl); |
Jeff Tinker | d072c90 | 2015-03-16 13:39:29 -0700 | [diff] [blame] | 807 | reply->writeInt32(static_cast<int32_t>(keyRequestType)); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 808 | reply->writeInt32(result); |
| 809 | return OK; |
| 810 | } |
| 811 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 812 | case PROVIDE_KEY_RESPONSE: |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 813 | { |
| 814 | CHECK_INTERFACE(IDrm, data, reply); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 815 | Vector<uint8_t> sessionId, response, keySetId; |
| 816 | readVector(data, sessionId); |
| 817 | readVector(data, response); |
| 818 | uint32_t result = provideKeyResponse(sessionId, response, keySetId); |
| 819 | writeVector(reply, keySetId); |
| 820 | reply->writeInt32(result); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 821 | return OK; |
| 822 | } |
| 823 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 824 | case REMOVE_KEYS: |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 825 | { |
| 826 | CHECK_INTERFACE(IDrm, data, reply); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 827 | Vector<uint8_t> keySetId; |
| 828 | readVector(data, keySetId); |
| 829 | reply->writeInt32(removeKeys(keySetId)); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 830 | return OK; |
| 831 | } |
| 832 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 833 | case RESTORE_KEYS: |
| 834 | { |
| 835 | CHECK_INTERFACE(IDrm, data, reply); |
| 836 | Vector<uint8_t> sessionId, keySetId; |
| 837 | readVector(data, sessionId); |
| 838 | readVector(data, keySetId); |
| 839 | reply->writeInt32(restoreKeys(sessionId, keySetId)); |
| 840 | return OK; |
| 841 | } |
| 842 | |
| 843 | case QUERY_KEY_STATUS: |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 844 | { |
| 845 | CHECK_INTERFACE(IDrm, data, reply); |
| 846 | Vector<uint8_t> sessionId; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 847 | readVector(data, sessionId); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 848 | KeyedVector<String8, String8> infoMap; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 849 | status_t result = queryKeyStatus(sessionId, infoMap); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 850 | size_t count = infoMap.size(); |
| 851 | reply->writeInt32(count); |
| 852 | for (size_t i = 0; i < count; ++i) { |
| 853 | reply->writeString8(infoMap.keyAt(i)); |
| 854 | reply->writeString8(infoMap.valueAt(i)); |
| 855 | } |
| 856 | reply->writeInt32(result); |
| 857 | return OK; |
| 858 | } |
| 859 | |
| 860 | case GET_PROVISION_REQUEST: |
| 861 | { |
| 862 | CHECK_INTERFACE(IDrm, data, reply); |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 863 | String8 certType = data.readString8(); |
| 864 | String8 certAuthority = data.readString8(); |
| 865 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 866 | Vector<uint8_t> request; |
| 867 | String8 defaultUrl; |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 868 | status_t result = getProvisionRequest(certType, certAuthority, |
| 869 | request, defaultUrl); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 870 | writeVector(reply, request); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 871 | reply->writeString8(defaultUrl); |
| 872 | reply->writeInt32(result); |
| 873 | return OK; |
| 874 | } |
| 875 | |
| 876 | case PROVIDE_PROVISION_RESPONSE: |
| 877 | { |
| 878 | CHECK_INTERFACE(IDrm, data, reply); |
| 879 | Vector<uint8_t> response; |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 880 | Vector<uint8_t> certificate; |
| 881 | Vector<uint8_t> wrappedKey; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 882 | readVector(data, response); |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 883 | status_t result = provideProvisionResponse(response, certificate, wrappedKey); |
| 884 | writeVector(reply, certificate); |
| 885 | writeVector(reply, wrappedKey); |
| 886 | reply->writeInt32(result); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 887 | return OK; |
| 888 | } |
| 889 | |
| 890 | case GET_SECURE_STOPS: |
| 891 | { |
| 892 | CHECK_INTERFACE(IDrm, data, reply); |
| 893 | List<Vector<uint8_t> > secureStops; |
| 894 | status_t result = getSecureStops(secureStops); |
| 895 | size_t count = secureStops.size(); |
| 896 | reply->writeInt32(count); |
| 897 | List<Vector<uint8_t> >::iterator iter = secureStops.begin(); |
| 898 | while(iter != secureStops.end()) { |
| 899 | size_t size = iter->size(); |
| 900 | reply->writeInt32(size); |
| 901 | reply->write(iter->array(), iter->size()); |
Jeff Tinker | 423e33c | 2013-04-08 15:23:17 -0700 | [diff] [blame] | 902 | iter++; |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 903 | } |
| 904 | reply->writeInt32(result); |
| 905 | return OK; |
| 906 | } |
| 907 | |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 908 | case GET_SECURE_STOP_IDS: |
| 909 | { |
| 910 | CHECK_INTERFACE(IDrm, data, reply); |
| 911 | List<Vector<uint8_t> > secureStopIds; |
| 912 | status_t result = getSecureStopIds(secureStopIds); |
| 913 | size_t count = secureStopIds.size(); |
| 914 | reply->writeInt32(count); |
| 915 | List<Vector<uint8_t> >::iterator iter = secureStopIds.begin(); |
| 916 | while(iter != secureStopIds.end()) { |
| 917 | size_t size = iter->size(); |
| 918 | reply->writeInt32(size); |
| 919 | reply->write(iter->array(), iter->size()); |
| 920 | iter++; |
| 921 | } |
| 922 | reply->writeInt32(result); |
| 923 | return OK; |
| 924 | } |
| 925 | |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 926 | case GET_SECURE_STOP: |
| 927 | { |
| 928 | CHECK_INTERFACE(IDrm, data, reply); |
| 929 | Vector<uint8_t> ssid, secureStop; |
| 930 | readVector(data, ssid); |
| 931 | status_t result = getSecureStop(ssid, secureStop); |
| 932 | writeVector(reply, secureStop); |
| 933 | reply->writeInt32(result); |
| 934 | return OK; |
| 935 | } |
| 936 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 937 | case RELEASE_SECURE_STOPS: |
| 938 | { |
| 939 | CHECK_INTERFACE(IDrm, data, reply); |
| 940 | Vector<uint8_t> ssRelease; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 941 | readVector(data, ssRelease); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 942 | reply->writeInt32(releaseSecureStops(ssRelease)); |
| 943 | return OK; |
| 944 | } |
| 945 | |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 946 | case REMOVE_SECURE_STOP: |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 947 | { |
| 948 | CHECK_INTERFACE(IDrm, data, reply); |
Jeff Tinker | 15177d7 | 2018-01-25 12:57:55 -0800 | [diff] [blame] | 949 | Vector<uint8_t> ssid; |
| 950 | readVector(data, ssid); |
| 951 | reply->writeInt32(removeSecureStop(ssid)); |
| 952 | return OK; |
| 953 | } |
| 954 | |
| 955 | case REMOVE_ALL_SECURE_STOPS: |
| 956 | { |
| 957 | CHECK_INTERFACE(IDrm, data, reply); |
| 958 | reply->writeInt32(removeAllSecureStops()); |
Jeff Tinker | 3c1285e | 2014-10-31 00:55:16 -0700 | [diff] [blame] | 959 | return OK; |
| 960 | } |
| 961 | |
Jeff Tinker | 6d998b6 | 2017-12-18 14:37:43 -0800 | [diff] [blame] | 962 | case GET_HDCP_LEVELS: |
| 963 | { |
| 964 | CHECK_INTERFACE(IDrm, data, reply); |
| 965 | DrmPlugin::HdcpLevel connected = DrmPlugin::kHdcpLevelUnknown; |
| 966 | DrmPlugin::HdcpLevel max = DrmPlugin::kHdcpLevelUnknown; |
| 967 | status_t result = getHdcpLevels(&connected, &max); |
| 968 | reply->writeInt32(connected); |
| 969 | reply->writeInt32(max); |
| 970 | reply->writeInt32(result); |
| 971 | return OK; |
| 972 | } |
| 973 | |
| 974 | case GET_NUMBER_OF_SESSIONS: |
| 975 | { |
| 976 | CHECK_INTERFACE(IDrm, data, reply); |
| 977 | uint32_t open = 0, max = 0; |
| 978 | status_t result = getNumberOfSessions(&open, &max); |
| 979 | reply->writeInt32(open); |
| 980 | reply->writeInt32(max); |
| 981 | reply->writeInt32(result); |
| 982 | return OK; |
| 983 | } |
| 984 | |
| 985 | case GET_SECURITY_LEVEL: |
| 986 | { |
| 987 | CHECK_INTERFACE(IDrm, data, reply); |
| 988 | Vector<uint8_t> sessionId; |
| 989 | readVector(data, sessionId); |
| 990 | DrmPlugin::SecurityLevel level = DrmPlugin::kSecurityLevelUnknown; |
| 991 | status_t result = getSecurityLevel(sessionId, &level); |
| 992 | reply->writeInt32(level); |
| 993 | reply->writeInt32(result); |
| 994 | return OK; |
| 995 | } |
| 996 | |
| 997 | case SET_SECURITY_LEVEL: |
| 998 | { |
| 999 | CHECK_INTERFACE(IDrm, data, reply); |
| 1000 | Vector<uint8_t> sessionId; |
| 1001 | readVector(data, sessionId); |
| 1002 | DrmPlugin::SecurityLevel level = |
| 1003 | static_cast<DrmPlugin::SecurityLevel>(data.readInt32()); |
| 1004 | status_t result = setSecurityLevel(sessionId, level); |
| 1005 | reply->writeInt32(result); |
| 1006 | return OK; |
| 1007 | } |
| 1008 | |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 1009 | case GET_PROPERTY_STRING: |
| 1010 | { |
| 1011 | CHECK_INTERFACE(IDrm, data, reply); |
| 1012 | String8 name = data.readString8(); |
| 1013 | String8 value; |
| 1014 | status_t result = getPropertyString(name, value); |
| 1015 | reply->writeString8(value); |
| 1016 | reply->writeInt32(result); |
| 1017 | return OK; |
| 1018 | } |
| 1019 | |
| 1020 | case GET_PROPERTY_BYTE_ARRAY: |
| 1021 | { |
| 1022 | CHECK_INTERFACE(IDrm, data, reply); |
| 1023 | String8 name = data.readString8(); |
| 1024 | Vector<uint8_t> value; |
| 1025 | status_t result = getPropertyByteArray(name, value); |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 1026 | writeVector(reply, value); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 1027 | reply->writeInt32(result); |
| 1028 | return OK; |
| 1029 | } |
| 1030 | |
| 1031 | case SET_PROPERTY_STRING: |
| 1032 | { |
| 1033 | CHECK_INTERFACE(IDrm, data, reply); |
| 1034 | String8 name = data.readString8(); |
| 1035 | String8 value = data.readString8(); |
| 1036 | reply->writeInt32(setPropertyString(name, value)); |
| 1037 | return OK; |
| 1038 | } |
| 1039 | |
| 1040 | case SET_PROPERTY_BYTE_ARRAY: |
| 1041 | { |
| 1042 | CHECK_INTERFACE(IDrm, data, reply); |
| 1043 | String8 name = data.readString8(); |
| 1044 | Vector<uint8_t> value; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 1045 | readVector(data, value); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 1046 | reply->writeInt32(setPropertyByteArray(name, value)); |
| 1047 | return OK; |
| 1048 | } |
| 1049 | |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 1050 | case GET_METRICS: |
| 1051 | { |
| 1052 | CHECK_INTERFACE(IDrm, data, reply); |
| 1053 | |
Adam Stone | 637b785 | 2018-01-30 12:09:36 -0800 | [diff] [blame] | 1054 | os::PersistableBundle metrics; |
| 1055 | status_t result = getMetrics(&metrics); |
Adam Stone | 568b3c4 | 2018-01-31 12:57:16 -0800 | [diff] [blame^] | 1056 | // The reply data is ordered as |
| 1057 | // 1) 32 bit integer reply followed by |
| 1058 | // 2) Serialized PersistableBundle containing metrics. |
| 1059 | // Only write the metrics if the getMetrics result was |
| 1060 | // OK and we successfully added the status to reply. |
| 1061 | status_t parcel_result = reply->writeInt32(result); |
| 1062 | if (result == OK && parcel_result == OK) { |
| 1063 | parcel_result = metrics.writeToParcel(reply); |
| 1064 | } |
| 1065 | return parcel_result; |
Adam Stone | ab394d1 | 2017-12-22 12:34:20 -0800 | [diff] [blame] | 1066 | } |
| 1067 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 1068 | case SET_CIPHER_ALGORITHM: |
| 1069 | { |
| 1070 | CHECK_INTERFACE(IDrm, data, reply); |
| 1071 | Vector<uint8_t> sessionId; |
| 1072 | readVector(data, sessionId); |
| 1073 | String8 algorithm = data.readString8(); |
| 1074 | reply->writeInt32(setCipherAlgorithm(sessionId, algorithm)); |
| 1075 | return OK; |
| 1076 | } |
| 1077 | |
| 1078 | case SET_MAC_ALGORITHM: |
| 1079 | { |
| 1080 | CHECK_INTERFACE(IDrm, data, reply); |
| 1081 | Vector<uint8_t> sessionId; |
| 1082 | readVector(data, sessionId); |
| 1083 | String8 algorithm = data.readString8(); |
| 1084 | reply->writeInt32(setMacAlgorithm(sessionId, algorithm)); |
| 1085 | return OK; |
| 1086 | } |
| 1087 | |
| 1088 | case ENCRYPT: |
| 1089 | { |
| 1090 | CHECK_INTERFACE(IDrm, data, reply); |
| 1091 | Vector<uint8_t> sessionId, keyId, input, iv, output; |
| 1092 | readVector(data, sessionId); |
| 1093 | readVector(data, keyId); |
| 1094 | readVector(data, input); |
| 1095 | readVector(data, iv); |
| 1096 | uint32_t result = encrypt(sessionId, keyId, input, iv, output); |
| 1097 | writeVector(reply, output); |
| 1098 | reply->writeInt32(result); |
| 1099 | return OK; |
| 1100 | } |
| 1101 | |
| 1102 | case DECRYPT: |
| 1103 | { |
| 1104 | CHECK_INTERFACE(IDrm, data, reply); |
| 1105 | Vector<uint8_t> sessionId, keyId, input, iv, output; |
| 1106 | readVector(data, sessionId); |
| 1107 | readVector(data, keyId); |
| 1108 | readVector(data, input); |
| 1109 | readVector(data, iv); |
| 1110 | uint32_t result = decrypt(sessionId, keyId, input, iv, output); |
| 1111 | writeVector(reply, output); |
| 1112 | reply->writeInt32(result); |
| 1113 | return OK; |
| 1114 | } |
| 1115 | |
| 1116 | case SIGN: |
| 1117 | { |
| 1118 | CHECK_INTERFACE(IDrm, data, reply); |
| 1119 | Vector<uint8_t> sessionId, keyId, message, signature; |
| 1120 | readVector(data, sessionId); |
| 1121 | readVector(data, keyId); |
| 1122 | readVector(data, message); |
| 1123 | uint32_t result = sign(sessionId, keyId, message, signature); |
| 1124 | writeVector(reply, signature); |
| 1125 | reply->writeInt32(result); |
| 1126 | return OK; |
| 1127 | } |
| 1128 | |
| 1129 | case VERIFY: |
| 1130 | { |
| 1131 | CHECK_INTERFACE(IDrm, data, reply); |
| 1132 | Vector<uint8_t> sessionId, keyId, message, signature; |
| 1133 | readVector(data, sessionId); |
| 1134 | readVector(data, keyId); |
| 1135 | readVector(data, message); |
| 1136 | readVector(data, signature); |
Jeff Tinker | 9a6861c | 2016-09-02 11:36:46 -0700 | [diff] [blame] | 1137 | bool match = false; |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 1138 | uint32_t result = verify(sessionId, keyId, message, signature, match); |
| 1139 | reply->writeInt32(match); |
| 1140 | reply->writeInt32(result); |
| 1141 | return OK; |
| 1142 | } |
| 1143 | |
Jeff Tinker | 68d9d71 | 2014-03-04 13:21:31 -0800 | [diff] [blame] | 1144 | case SIGN_RSA: |
| 1145 | { |
| 1146 | CHECK_INTERFACE(IDrm, data, reply); |
| 1147 | Vector<uint8_t> sessionId, message, wrappedKey, signature; |
| 1148 | readVector(data, sessionId); |
| 1149 | String8 algorithm = data.readString8(); |
| 1150 | readVector(data, message); |
| 1151 | readVector(data, wrappedKey); |
| 1152 | uint32_t result = signRSA(sessionId, algorithm, message, wrappedKey, signature); |
| 1153 | writeVector(reply, signature); |
| 1154 | reply->writeInt32(result); |
| 1155 | return OK; |
| 1156 | } |
| 1157 | |
Jeff Tinker | c0d5f1f | 2013-04-02 13:08:05 -0700 | [diff] [blame] | 1158 | case SET_LISTENER: { |
| 1159 | CHECK_INTERFACE(IDrm, data, reply); |
| 1160 | sp<IDrmClient> listener = |
| 1161 | interface_cast<IDrmClient>(data.readStrongBinder()); |
| 1162 | reply->writeInt32(setListener(listener)); |
| 1163 | return NO_ERROR; |
| 1164 | } break; |
| 1165 | |
Jeff Tinker | 4c63a23 | 2013-03-30 16:19:44 -0700 | [diff] [blame] | 1166 | default: |
| 1167 | return BBinder::onTransact(code, data, reply, flags); |
Jeff Tinker | 441a78d | 2013-02-08 10:18:35 -0800 | [diff] [blame] | 1168 | } |
| 1169 | } |
| 1170 | |
| 1171 | } // namespace android |