Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | #include <android/binder_ibinder.h> |
Steven Moreland | 4d5ad49 | 2018-09-13 12:49:16 -0700 | [diff] [blame] | 18 | #include "ibinder_internal.h" |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 19 | |
Steven Moreland | 46b5fea | 2019-10-15 11:22:18 -0700 | [diff] [blame] | 20 | #include <android/binder_stability.h> |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 21 | #include <android/binder_status.h> |
Steven Moreland | 4d5ad49 | 2018-09-13 12:49:16 -0700 | [diff] [blame] | 22 | #include "parcel_internal.h" |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 23 | #include "status_internal.h" |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 24 | |
| 25 | #include <android-base/logging.h> |
Steven Moreland | f3034b0 | 2018-11-12 17:37:46 -0800 | [diff] [blame] | 26 | #include <binder/IPCThreadState.h> |
Ruchir Rastogi | cc7a746 | 2020-01-31 14:29:15 -0800 | [diff] [blame^] | 27 | #include <binder/IResultReceiver.h> |
| 28 | #include <private/android_filesystem_config.h> |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 29 | |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 30 | using DeathRecipient = ::android::IBinder::DeathRecipient; |
| 31 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 32 | using ::android::IBinder; |
Ruchir Rastogi | cc7a746 | 2020-01-31 14:29:15 -0800 | [diff] [blame^] | 33 | using ::android::IResultReceiver; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 34 | using ::android::Parcel; |
| 35 | using ::android::sp; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 36 | using ::android::status_t; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 37 | using ::android::String16; |
Steven Moreland | a194c45 | 2019-03-04 16:47:07 -0800 | [diff] [blame] | 38 | using ::android::String8; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 39 | using ::android::wp; |
| 40 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 41 | namespace ABBinderTag { |
| 42 | |
| 43 | static const void* kId = "ABBinder"; |
| 44 | static void* kValue = static_cast<void*>(new bool{true}); |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 45 | void clean(const void* /*id*/, void* /*obj*/, void* /*cookie*/){/* do nothing */}; |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 46 | |
| 47 | static void attach(const sp<IBinder>& binder) { |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 48 | binder->attachObject(kId, kValue, nullptr /*cookie*/, clean); |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 49 | } |
| 50 | static bool has(const sp<IBinder>& binder) { |
| 51 | return binder != nullptr && binder->findObject(kId) == kValue; |
| 52 | } |
| 53 | |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 54 | } // namespace ABBinderTag |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 55 | |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 56 | namespace ABpBinderTag { |
| 57 | |
| 58 | static std::mutex gLock; |
| 59 | static const void* kId = "ABpBinder"; |
| 60 | struct Value { |
| 61 | wp<ABpBinder> binder; |
| 62 | }; |
| 63 | void clean(const void* id, void* obj, void* cookie) { |
| 64 | CHECK(id == kId) << id << " " << obj << " " << cookie; |
| 65 | |
| 66 | delete static_cast<Value*>(obj); |
| 67 | }; |
| 68 | |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 69 | } // namespace ABpBinderTag |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 70 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 71 | AIBinder::AIBinder(const AIBinder_Class* clazz) : mClazz(clazz) {} |
| 72 | AIBinder::~AIBinder() {} |
| 73 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 74 | bool AIBinder::associateClass(const AIBinder_Class* clazz) { |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 75 | if (clazz == nullptr) return false; |
| 76 | if (mClazz == clazz) return true; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 77 | |
| 78 | String8 newDescriptor(clazz->getInterfaceDescriptor()); |
| 79 | |
| 80 | if (mClazz != nullptr) { |
| 81 | String8 currentDescriptor(mClazz->getInterfaceDescriptor()); |
| 82 | if (newDescriptor == currentDescriptor) { |
| 83 | LOG(ERROR) << __func__ << ": Class descriptors '" << currentDescriptor |
| 84 | << "' match during associateClass, but they are different class objects. " |
| 85 | "Class descriptor collision?"; |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 86 | } else { |
| 87 | LOG(ERROR) << __func__ |
| 88 | << ": Class cannot be associated on object which already has a class. " |
| 89 | "Trying to associate to '" |
| 90 | << newDescriptor.c_str() << "' but already set to '" |
| 91 | << currentDescriptor.c_str() << "'."; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 94 | // always a failure because we know mClazz != clazz |
| 95 | return false; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 96 | } |
| 97 | |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 98 | CHECK(asABpBinder() != nullptr); // ABBinder always has a descriptor |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 99 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 100 | String8 descriptor(getBinder()->getInterfaceDescriptor()); |
| 101 | if (descriptor != newDescriptor) { |
| 102 | LOG(ERROR) << __func__ << ": Expecting binder to have class '" << newDescriptor.c_str() |
| 103 | << "' but descriptor is actually '" << descriptor.c_str() << "'."; |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 104 | return false; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 105 | } |
| 106 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 107 | // if this is a local object, it's not one known to libbinder_ndk |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 108 | mClazz = clazz; |
| 109 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 110 | return true; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | ABBinder::ABBinder(const AIBinder_Class* clazz, void* userData) |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 114 | : AIBinder(clazz), BBinder(), mUserData(userData) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 115 | CHECK(clazz != nullptr); |
| 116 | } |
| 117 | ABBinder::~ABBinder() { |
| 118 | getClass()->onDestroy(mUserData); |
| 119 | } |
| 120 | |
| 121 | const String16& ABBinder::getInterfaceDescriptor() const { |
| 122 | return getClass()->getInterfaceDescriptor(); |
| 123 | } |
| 124 | |
Steven Moreland | a194c45 | 2019-03-04 16:47:07 -0800 | [diff] [blame] | 125 | status_t ABBinder::dump(int fd, const ::android::Vector<String16>& args) { |
| 126 | AIBinder_onDump onDump = getClass()->onDump; |
| 127 | |
| 128 | if (onDump == nullptr) { |
| 129 | return STATUS_OK; |
| 130 | } |
| 131 | |
| 132 | // technically UINT32_MAX would be okay here, but INT32_MAX is expected since this may be |
| 133 | // null in Java |
| 134 | if (args.size() > INT32_MAX) { |
| 135 | LOG(ERROR) << "ABBinder::dump received too many arguments: " << args.size(); |
| 136 | return STATUS_BAD_VALUE; |
| 137 | } |
| 138 | |
| 139 | std::vector<String8> utf8Args; // owns memory of utf8s |
| 140 | utf8Args.reserve(args.size()); |
| 141 | std::vector<const char*> utf8Pointers; // what can be passed over NDK API |
| 142 | utf8Pointers.reserve(args.size()); |
| 143 | |
| 144 | for (size_t i = 0; i < args.size(); i++) { |
| 145 | utf8Args.push_back(String8(args[i])); |
| 146 | utf8Pointers.push_back(utf8Args[i].c_str()); |
| 147 | } |
| 148 | |
| 149 | return onDump(this, fd, utf8Pointers.data(), utf8Pointers.size()); |
| 150 | } |
| 151 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 152 | status_t ABBinder::onTransact(transaction_code_t code, const Parcel& data, Parcel* reply, |
| 153 | binder_flags_t flags) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 154 | if (isUserCommand(code)) { |
| 155 | if (!data.checkInterface(this)) { |
Steven Moreland | 9d089af | 2018-09-18 08:58:09 -0700 | [diff] [blame] | 156 | return STATUS_BAD_TYPE; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | const AParcel in = AParcel::readOnly(this, &data); |
| 160 | AParcel out = AParcel(this, reply, false /*owns*/); |
| 161 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 162 | binder_status_t status = getClass()->onTransact(this, code, &in, &out); |
| 163 | return PruneStatusT(status); |
Ruchir Rastogi | cc7a746 | 2020-01-31 14:29:15 -0800 | [diff] [blame^] | 164 | } else if (code == SHELL_COMMAND_TRANSACTION) { |
| 165 | int in = data.readFileDescriptor(); |
| 166 | int out = data.readFileDescriptor(); |
| 167 | int err = data.readFileDescriptor(); |
| 168 | |
| 169 | int argc = data.readInt32(); |
| 170 | std::vector<String8> utf8Args; // owns memory of utf8s |
| 171 | std::vector<const char*> utf8Pointers; // what can be passed over NDK API |
| 172 | for (int i = 0; i < argc && data.dataAvail() > 0; i++) { |
| 173 | utf8Args.push_back(String8(data.readString16())); |
| 174 | utf8Pointers.push_back(utf8Args[i].c_str()); |
| 175 | } |
| 176 | |
| 177 | data.readStrongBinder(); // skip over the IShellCallback |
| 178 | sp<IResultReceiver> resultReceiver = IResultReceiver::asInterface(data.readStrongBinder()); |
| 179 | |
| 180 | // Shell commands should only be callable by ADB. |
| 181 | uid_t uid = AIBinder_getCallingUid(); |
| 182 | if (uid != AID_ROOT && uid != AID_SHELL) { |
| 183 | if (resultReceiver != nullptr) { |
| 184 | resultReceiver->send(-1); |
| 185 | } |
| 186 | return STATUS_PERMISSION_DENIED; |
| 187 | } |
| 188 | |
| 189 | // Check that the file descriptors are valid. |
| 190 | if (in == STATUS_BAD_TYPE || out == STATUS_BAD_TYPE || err == STATUS_BAD_TYPE) { |
| 191 | if (resultReceiver != nullptr) { |
| 192 | resultReceiver->send(-1); |
| 193 | } |
| 194 | return STATUS_BAD_VALUE; |
| 195 | } |
| 196 | |
| 197 | binder_status_t status = getClass()->handleShellCommand( |
| 198 | this, in, out, err, utf8Pointers.data(), utf8Pointers.size()); |
| 199 | if (resultReceiver != nullptr) { |
| 200 | resultReceiver->send(status); |
| 201 | } |
| 202 | return status; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 203 | } else { |
| 204 | return BBinder::onTransact(code, data, reply, flags); |
| 205 | } |
| 206 | } |
| 207 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 208 | ABpBinder::ABpBinder(const ::android::sp<::android::IBinder>& binder) |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 209 | : AIBinder(nullptr /*clazz*/), BpRefBase(binder) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 210 | CHECK(binder != nullptr); |
| 211 | } |
| 212 | ABpBinder::~ABpBinder() {} |
| 213 | |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 214 | void ABpBinder::onLastStrongRef(const void* id) { |
| 215 | { |
| 216 | std::lock_guard<std::mutex> lock(ABpBinderTag::gLock); |
| 217 | // Since ABpBinder is OBJECT_LIFETIME_WEAK, we must remove this weak reference in order for |
| 218 | // the ABpBinder to be deleted. Since a strong reference to this ABpBinder object should no |
| 219 | // longer be able to exist at the time of this method call, there is no longer a need to |
| 220 | // recover it. |
| 221 | |
| 222 | ABpBinderTag::Value* value = |
| 223 | static_cast<ABpBinderTag::Value*>(remote()->findObject(ABpBinderTag::kId)); |
| 224 | if (value != nullptr) { |
| 225 | value->binder = nullptr; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | BpRefBase::onLastStrongRef(id); |
| 230 | } |
| 231 | |
| 232 | sp<AIBinder> ABpBinder::lookupOrCreateFromBinder(const ::android::sp<::android::IBinder>& binder) { |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 233 | if (binder == nullptr) { |
| 234 | return nullptr; |
| 235 | } |
| 236 | if (ABBinderTag::has(binder)) { |
| 237 | return static_cast<ABBinder*>(binder.get()); |
| 238 | } |
Steven Moreland | 9496895 | 2018-09-05 14:42:59 -0700 | [diff] [blame] | 239 | |
| 240 | // The following code ensures that for a given binder object (remote or local), if it is not an |
| 241 | // ABBinder then at most one ABpBinder object exists in a given process representing it. |
| 242 | std::lock_guard<std::mutex> lock(ABpBinderTag::gLock); |
| 243 | |
| 244 | ABpBinderTag::Value* value = |
| 245 | static_cast<ABpBinderTag::Value*>(binder->findObject(ABpBinderTag::kId)); |
| 246 | if (value == nullptr) { |
| 247 | value = new ABpBinderTag::Value; |
| 248 | binder->attachObject(ABpBinderTag::kId, static_cast<void*>(value), nullptr /*cookie*/, |
| 249 | ABpBinderTag::clean); |
| 250 | } |
| 251 | |
| 252 | sp<ABpBinder> ret = value->binder.promote(); |
| 253 | if (ret == nullptr) { |
| 254 | ret = new ABpBinder(binder); |
| 255 | value->binder = ret; |
| 256 | } |
| 257 | |
| 258 | return ret; |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 259 | } |
| 260 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 261 | struct AIBinder_Weak { |
| 262 | wp<AIBinder> binder; |
| 263 | }; |
| 264 | AIBinder_Weak* AIBinder_Weak_new(AIBinder* binder) { |
Steven Moreland | 5ccb70f | 2018-09-04 16:30:21 -0700 | [diff] [blame] | 265 | if (binder == nullptr) { |
| 266 | return nullptr; |
| 267 | } |
| 268 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 269 | return new AIBinder_Weak{wp<AIBinder>(binder)}; |
| 270 | } |
Steven Moreland | 9b80e28 | 2018-09-19 13:57:23 -0700 | [diff] [blame] | 271 | void AIBinder_Weak_delete(AIBinder_Weak* weakBinder) { |
| 272 | delete weakBinder; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 273 | } |
| 274 | AIBinder* AIBinder_Weak_promote(AIBinder_Weak* weakBinder) { |
Steven Moreland | 5ccb70f | 2018-09-04 16:30:21 -0700 | [diff] [blame] | 275 | if (weakBinder == nullptr) { |
| 276 | return nullptr; |
| 277 | } |
| 278 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 279 | sp<AIBinder> binder = weakBinder->binder.promote(); |
| 280 | AIBinder_incStrong(binder.get()); |
| 281 | return binder.get(); |
| 282 | } |
| 283 | |
| 284 | AIBinder_Class::AIBinder_Class(const char* interfaceDescriptor, AIBinder_Class_onCreate onCreate, |
| 285 | AIBinder_Class_onDestroy onDestroy, |
| 286 | AIBinder_Class_onTransact onTransact) |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 287 | : onCreate(onCreate), |
| 288 | onDestroy(onDestroy), |
| 289 | onTransact(onTransact), |
| 290 | mInterfaceDescriptor(interfaceDescriptor) {} |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 291 | |
| 292 | AIBinder_Class* AIBinder_Class_define(const char* interfaceDescriptor, |
| 293 | AIBinder_Class_onCreate onCreate, |
| 294 | AIBinder_Class_onDestroy onDestroy, |
| 295 | AIBinder_Class_onTransact onTransact) { |
| 296 | if (interfaceDescriptor == nullptr || onCreate == nullptr || onDestroy == nullptr || |
| 297 | onTransact == nullptr) { |
| 298 | return nullptr; |
| 299 | } |
| 300 | |
| 301 | return new AIBinder_Class(interfaceDescriptor, onCreate, onDestroy, onTransact); |
| 302 | } |
| 303 | |
Steven Moreland | a194c45 | 2019-03-04 16:47:07 -0800 | [diff] [blame] | 304 | void AIBinder_Class_setOnDump(AIBinder_Class* clazz, AIBinder_onDump onDump) { |
| 305 | CHECK(clazz != nullptr) << "setOnDump requires non-null clazz"; |
| 306 | |
| 307 | // this is required to be called before instances are instantiated |
| 308 | clazz->onDump = onDump; |
| 309 | } |
| 310 | |
Ruchir Rastogi | cc7a746 | 2020-01-31 14:29:15 -0800 | [diff] [blame^] | 311 | void AIBinder_Class_setHandleShellCommand(AIBinder_Class* clazz, |
| 312 | AIBinder_handleShellCommand handleShellCommand) { |
| 313 | CHECK(clazz != nullptr) << "setHandleShellCommand requires non-null clazz"; |
| 314 | |
| 315 | clazz->handleShellCommand = handleShellCommand; |
| 316 | } |
| 317 | |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 318 | void AIBinder_DeathRecipient::TransferDeathRecipient::binderDied(const wp<IBinder>& who) { |
| 319 | CHECK(who == mWho); |
| 320 | |
| 321 | mOnDied(mCookie); |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 322 | |
| 323 | sp<AIBinder_DeathRecipient> recipient = mParentRecipient.promote(); |
| 324 | sp<IBinder> strongWho = who.promote(); |
| 325 | |
| 326 | // otherwise this will be cleaned up later with pruneDeadTransferEntriesLocked |
| 327 | if (recipient != nullptr && strongWho != nullptr) { |
| 328 | status_t result = recipient->unlinkToDeath(strongWho, mCookie); |
| 329 | if (result != ::android::DEAD_OBJECT) { |
| 330 | LOG(WARNING) << "Unlinking to dead binder resulted in: " << result; |
| 331 | } |
| 332 | } |
| 333 | |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 334 | mWho = nullptr; |
| 335 | } |
| 336 | |
| 337 | AIBinder_DeathRecipient::AIBinder_DeathRecipient(AIBinder_DeathRecipient_onBinderDied onDied) |
Steven Moreland | 6cf66ac | 2018-11-02 18:14:54 -0700 | [diff] [blame] | 338 | : mOnDied(onDied) { |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 339 | CHECK(onDied != nullptr); |
| 340 | } |
| 341 | |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 342 | void AIBinder_DeathRecipient::pruneDeadTransferEntriesLocked() { |
| 343 | mDeathRecipients.erase(std::remove_if(mDeathRecipients.begin(), mDeathRecipients.end(), |
| 344 | [](const sp<TransferDeathRecipient>& tdr) { |
| 345 | return tdr->getWho() == nullptr; |
| 346 | }), |
| 347 | mDeathRecipients.end()); |
| 348 | } |
| 349 | |
| 350 | binder_status_t AIBinder_DeathRecipient::linkToDeath(sp<IBinder> binder, void* cookie) { |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 351 | CHECK(binder != nullptr); |
| 352 | |
| 353 | std::lock_guard<std::mutex> l(mDeathRecipientsMutex); |
| 354 | |
| 355 | sp<TransferDeathRecipient> recipient = |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 356 | new TransferDeathRecipient(binder, cookie, this, mOnDied); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 357 | |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 358 | status_t status = binder->linkToDeath(recipient, cookie, 0 /*flags*/); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 359 | if (status != STATUS_OK) { |
| 360 | return PruneStatusT(status); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 361 | } |
| 362 | |
| 363 | mDeathRecipients.push_back(recipient); |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 364 | |
| 365 | pruneDeadTransferEntriesLocked(); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 366 | return STATUS_OK; |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 367 | } |
| 368 | |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 369 | binder_status_t AIBinder_DeathRecipient::unlinkToDeath(sp<IBinder> binder, void* cookie) { |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 370 | CHECK(binder != nullptr); |
| 371 | |
| 372 | std::lock_guard<std::mutex> l(mDeathRecipientsMutex); |
| 373 | |
| 374 | for (auto it = mDeathRecipients.rbegin(); it != mDeathRecipients.rend(); ++it) { |
| 375 | sp<TransferDeathRecipient> recipient = *it; |
| 376 | |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 377 | if (recipient->getCookie() == cookie && recipient->getWho() == binder) { |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 378 | mDeathRecipients.erase(it.base() - 1); |
| 379 | |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 380 | status_t status = binder->unlinkToDeath(recipient, cookie, 0 /*flags*/); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 381 | if (status != ::android::OK) { |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 382 | LOG(ERROR) << __func__ |
| 383 | << ": removed reference to death recipient but unlink failed."; |
| 384 | } |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 385 | return PruneStatusT(status); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 386 | } |
| 387 | } |
| 388 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 389 | return STATUS_NAME_NOT_FOUND; |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | // start of C-API methods |
| 393 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 394 | AIBinder* AIBinder_new(const AIBinder_Class* clazz, void* args) { |
| 395 | if (clazz == nullptr) { |
| 396 | LOG(ERROR) << __func__ << ": Must provide class to construct local binder."; |
| 397 | return nullptr; |
| 398 | } |
| 399 | |
| 400 | void* userData = clazz->onCreate(args); |
| 401 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 402 | sp<AIBinder> ret = new ABBinder(clazz, userData); |
| 403 | ABBinderTag::attach(ret->getBinder()); |
| 404 | |
| 405 | AIBinder_incStrong(ret.get()); |
| 406 | return ret.get(); |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 407 | } |
| 408 | |
Steven Moreland | 5ea54da | 2018-09-04 13:29:55 -0700 | [diff] [blame] | 409 | bool AIBinder_isRemote(const AIBinder* binder) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 410 | if (binder == nullptr) { |
Steven Moreland | 56f752a | 2018-11-05 17:23:37 -0800 | [diff] [blame] | 411 | return false; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 412 | } |
| 413 | |
| 414 | return binder->isRemote(); |
| 415 | } |
| 416 | |
Steven Moreland | 65867d7 | 2018-09-04 14:22:26 -0700 | [diff] [blame] | 417 | bool AIBinder_isAlive(const AIBinder* binder) { |
| 418 | if (binder == nullptr) { |
| 419 | return false; |
| 420 | } |
| 421 | |
| 422 | return const_cast<AIBinder*>(binder)->getBinder()->isBinderAlive(); |
| 423 | } |
| 424 | |
| 425 | binder_status_t AIBinder_ping(AIBinder* binder) { |
| 426 | if (binder == nullptr) { |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 427 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 65867d7 | 2018-09-04 14:22:26 -0700 | [diff] [blame] | 428 | } |
| 429 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 430 | return PruneStatusT(binder->getBinder()->pingBinder()); |
Steven Moreland | 65867d7 | 2018-09-04 14:22:26 -0700 | [diff] [blame] | 431 | } |
| 432 | |
Steven Moreland | a194c45 | 2019-03-04 16:47:07 -0800 | [diff] [blame] | 433 | binder_status_t AIBinder_dump(AIBinder* binder, int fd, const char** args, uint32_t numArgs) { |
| 434 | if (binder == nullptr) { |
| 435 | return STATUS_UNEXPECTED_NULL; |
| 436 | } |
| 437 | |
| 438 | ABBinder* bBinder = binder->asABBinder(); |
| 439 | if (bBinder != nullptr) { |
| 440 | AIBinder_onDump onDump = binder->getClass()->onDump; |
| 441 | if (onDump == nullptr) { |
| 442 | return STATUS_OK; |
| 443 | } |
| 444 | return PruneStatusT(onDump(bBinder, fd, args, numArgs)); |
| 445 | } |
| 446 | |
| 447 | ::android::Vector<String16> utf16Args; |
| 448 | utf16Args.setCapacity(numArgs); |
| 449 | for (uint32_t i = 0; i < numArgs; i++) { |
| 450 | utf16Args.push(String16(String8(args[i]))); |
| 451 | } |
| 452 | |
| 453 | status_t status = binder->getBinder()->dump(fd, utf16Args); |
| 454 | return PruneStatusT(status); |
| 455 | } |
| 456 | |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 457 | binder_status_t AIBinder_linkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, |
| 458 | void* cookie) { |
| 459 | if (binder == nullptr || recipient == nullptr) { |
| 460 | LOG(ERROR) << __func__ << ": Must provide binder and recipient."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 461 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 462 | } |
| 463 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 464 | // returns binder_status_t |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 465 | return recipient->linkToDeath(binder->getBinder(), cookie); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | binder_status_t AIBinder_unlinkToDeath(AIBinder* binder, AIBinder_DeathRecipient* recipient, |
| 469 | void* cookie) { |
| 470 | if (binder == nullptr || recipient == nullptr) { |
| 471 | LOG(ERROR) << __func__ << ": Must provide binder and recipient."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 472 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 473 | } |
| 474 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 475 | // returns binder_status_t |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 476 | return recipient->unlinkToDeath(binder->getBinder(), cookie); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 477 | } |
| 478 | |
Steven Moreland | f3034b0 | 2018-11-12 17:37:46 -0800 | [diff] [blame] | 479 | uid_t AIBinder_getCallingUid() { |
| 480 | return ::android::IPCThreadState::self()->getCallingUid(); |
| 481 | } |
| 482 | |
| 483 | pid_t AIBinder_getCallingPid() { |
| 484 | return ::android::IPCThreadState::self()->getCallingPid(); |
| 485 | } |
| 486 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 487 | void AIBinder_incStrong(AIBinder* binder) { |
| 488 | if (binder == nullptr) { |
| 489 | LOG(ERROR) << __func__ << ": on null binder"; |
| 490 | return; |
| 491 | } |
| 492 | |
| 493 | binder->incStrong(nullptr); |
| 494 | } |
| 495 | void AIBinder_decStrong(AIBinder* binder) { |
| 496 | if (binder == nullptr) { |
| 497 | LOG(ERROR) << __func__ << ": on null binder"; |
| 498 | return; |
| 499 | } |
| 500 | |
| 501 | binder->decStrong(nullptr); |
| 502 | } |
| 503 | int32_t AIBinder_debugGetRefCount(AIBinder* binder) { |
| 504 | if (binder == nullptr) { |
| 505 | LOG(ERROR) << __func__ << ": on null binder"; |
| 506 | return -1; |
| 507 | } |
| 508 | |
| 509 | return binder->getStrongCount(); |
| 510 | } |
| 511 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 512 | bool AIBinder_associateClass(AIBinder* binder, const AIBinder_Class* clazz) { |
| 513 | if (binder == nullptr) { |
| 514 | return false; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 515 | } |
| 516 | |
Steven Moreland | 71cddc3 | 2018-08-30 23:39:22 -0700 | [diff] [blame] | 517 | return binder->associateClass(clazz); |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | const AIBinder_Class* AIBinder_getClass(AIBinder* binder) { |
| 521 | if (binder == nullptr) { |
| 522 | return nullptr; |
| 523 | } |
| 524 | |
| 525 | return binder->getClass(); |
| 526 | } |
| 527 | |
| 528 | void* AIBinder_getUserData(AIBinder* binder) { |
| 529 | if (binder == nullptr) { |
| 530 | return nullptr; |
| 531 | } |
| 532 | |
| 533 | ABBinder* bBinder = binder->asABBinder(); |
| 534 | if (bBinder == nullptr) { |
| 535 | return nullptr; |
| 536 | } |
| 537 | |
| 538 | return bBinder->getUserData(); |
| 539 | } |
| 540 | |
| 541 | binder_status_t AIBinder_prepareTransaction(AIBinder* binder, AParcel** in) { |
| 542 | if (binder == nullptr || in == nullptr) { |
| 543 | LOG(ERROR) << __func__ << ": requires non-null parameters."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 544 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 545 | } |
| 546 | const AIBinder_Class* clazz = binder->getClass(); |
| 547 | if (clazz == nullptr) { |
| 548 | LOG(ERROR) << __func__ |
| 549 | << ": Class must be defined for a remote binder transaction. See " |
| 550 | "AIBinder_associateClass."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 551 | return STATUS_INVALID_OPERATION; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 552 | } |
| 553 | |
Steven Moreland | 3527c2e | 2018-09-05 17:07:14 -0700 | [diff] [blame] | 554 | if (!binder->isRemote()) { |
Steven Moreland | 74521c8 | 2018-09-07 14:50:40 -0700 | [diff] [blame] | 555 | LOG(WARNING) << "A binder object at " << binder |
| 556 | << " is being transacted on, however, this object is in the same process as " |
| 557 | "its proxy. Transacting with this binder is expensive compared to just " |
| 558 | "calling the corresponding functionality in the same process."; |
Steven Moreland | 3527c2e | 2018-09-05 17:07:14 -0700 | [diff] [blame] | 559 | } |
| 560 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 561 | *in = new AParcel(binder); |
Steven Moreland | f18615b | 2018-09-14 11:43:06 -0700 | [diff] [blame] | 562 | status_t status = (*in)->get()->writeInterfaceToken(clazz->getInterfaceDescriptor()); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 563 | binder_status_t ret = PruneStatusT(status); |
| 564 | |
| 565 | if (ret != STATUS_OK) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 566 | delete *in; |
| 567 | *in = nullptr; |
| 568 | } |
| 569 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 570 | return ret; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 571 | } |
| 572 | |
Steven Moreland | 9b80e28 | 2018-09-19 13:57:23 -0700 | [diff] [blame] | 573 | static void DestroyParcel(AParcel** parcel) { |
| 574 | delete *parcel; |
| 575 | *parcel = nullptr; |
| 576 | } |
| 577 | |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 578 | binder_status_t AIBinder_transact(AIBinder* binder, transaction_code_t code, AParcel** in, |
| 579 | AParcel** out, binder_flags_t flags) { |
| 580 | if (in == nullptr) { |
| 581 | LOG(ERROR) << __func__ << ": requires non-null in parameter"; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 582 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 583 | } |
| 584 | |
Steven Moreland | caa776c | 2018-09-04 13:48:11 -0700 | [diff] [blame] | 585 | using AutoParcelDestroyer = std::unique_ptr<AParcel*, void (*)(AParcel**)>; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 586 | // This object is the input to the transaction. This function takes ownership of it and deletes |
| 587 | // it. |
Steven Moreland | 9b80e28 | 2018-09-19 13:57:23 -0700 | [diff] [blame] | 588 | AutoParcelDestroyer forIn(in, DestroyParcel); |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 589 | |
| 590 | if (!isUserCommand(code)) { |
| 591 | LOG(ERROR) << __func__ << ": Only user-defined transactions can be made from the NDK."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 592 | return STATUS_UNKNOWN_TRANSACTION; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 593 | } |
| 594 | |
Steven Moreland | 46b5fea | 2019-10-15 11:22:18 -0700 | [diff] [blame] | 595 | constexpr binder_flags_t kAllFlags = FLAG_PRIVATE_VENDOR | FLAG_ONEWAY; |
| 596 | if ((flags & ~kAllFlags) != 0) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 597 | LOG(ERROR) << __func__ << ": Unrecognized flags sent: " << flags; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 598 | return STATUS_BAD_VALUE; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 599 | } |
| 600 | |
| 601 | if (binder == nullptr || *in == nullptr || out == nullptr) { |
| 602 | LOG(ERROR) << __func__ << ": requires non-null parameters."; |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 603 | return STATUS_UNEXPECTED_NULL; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | if ((*in)->getBinder() != binder) { |
| 607 | LOG(ERROR) << __func__ << ": parcel is associated with binder object " << binder |
| 608 | << " but called with " << (*in)->getBinder(); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 609 | return STATUS_BAD_VALUE; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 610 | } |
| 611 | |
| 612 | *out = new AParcel(binder); |
| 613 | |
Steven Moreland | f18615b | 2018-09-14 11:43:06 -0700 | [diff] [blame] | 614 | status_t status = binder->getBinder()->transact(code, *(*in)->get(), (*out)->get(), flags); |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 615 | binder_status_t ret = PruneStatusT(status); |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 616 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 617 | if (ret != STATUS_OK) { |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 618 | delete *out; |
| 619 | *out = nullptr; |
| 620 | } |
| 621 | |
Steven Moreland | 5d62e44 | 2018-09-13 15:01:02 -0700 | [diff] [blame] | 622 | return ret; |
Steven Moreland | 2e87adc | 2018-08-20 19:47:00 -0700 | [diff] [blame] | 623 | } |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 624 | |
| 625 | AIBinder_DeathRecipient* AIBinder_DeathRecipient_new( |
| 626 | AIBinder_DeathRecipient_onBinderDied onBinderDied) { |
| 627 | if (onBinderDied == nullptr) { |
| 628 | LOG(ERROR) << __func__ << ": requires non-null onBinderDied parameter."; |
| 629 | return nullptr; |
| 630 | } |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 631 | auto ret = new AIBinder_DeathRecipient(onBinderDied); |
| 632 | ret->incStrong(nullptr); |
| 633 | return ret; |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 634 | } |
| 635 | |
Steven Moreland | 9b80e28 | 2018-09-19 13:57:23 -0700 | [diff] [blame] | 636 | void AIBinder_DeathRecipient_delete(AIBinder_DeathRecipient* recipient) { |
Steven Moreland | 64127ca | 2019-03-13 09:25:44 -0700 | [diff] [blame] | 637 | if (recipient == nullptr) { |
| 638 | return; |
| 639 | } |
| 640 | |
| 641 | recipient->decStrong(nullptr); |
Steven Moreland | 901c745 | 2018-09-04 16:17:28 -0700 | [diff] [blame] | 642 | } |
Steven Moreland | ea14ef2 | 2019-08-20 10:50:08 -0700 | [diff] [blame] | 643 | |
| 644 | binder_status_t AIBinder_getExtension(AIBinder* binder, AIBinder** outExt) { |
| 645 | if (binder == nullptr || outExt == nullptr) { |
| 646 | if (outExt != nullptr) { |
| 647 | *outExt = nullptr; |
| 648 | } |
| 649 | return STATUS_UNEXPECTED_NULL; |
| 650 | } |
| 651 | |
| 652 | sp<IBinder> ext; |
| 653 | status_t res = binder->getBinder()->getExtension(&ext); |
| 654 | |
| 655 | if (res != android::OK) { |
| 656 | *outExt = nullptr; |
| 657 | return PruneStatusT(res); |
| 658 | } |
| 659 | |
| 660 | sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(ext); |
| 661 | if (ret != nullptr) ret->incStrong(binder); |
| 662 | |
| 663 | *outExt = ret.get(); |
| 664 | return STATUS_OK; |
| 665 | } |
| 666 | |
| 667 | binder_status_t AIBinder_setExtension(AIBinder* binder, AIBinder* ext) { |
| 668 | if (binder == nullptr || ext == nullptr) { |
| 669 | return STATUS_UNEXPECTED_NULL; |
| 670 | } |
| 671 | |
| 672 | ABBinder* rawBinder = binder->asABBinder(); |
| 673 | if (rawBinder == nullptr) { |
| 674 | return STATUS_INVALID_OPERATION; |
| 675 | } |
| 676 | |
| 677 | rawBinder->setExtension(ext->getBinder()); |
| 678 | return STATUS_OK; |
| 679 | } |