Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2005 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 | |
Steven Moreland | c4dd210 | 2017-02-23 13:57:21 -0800 | [diff] [blame] | 17 | #define LOG_TAG "hw-BpHwBinder" |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 18 | //#define LOG_NDEBUG 0 |
| 19 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 20 | #include <hwbinder/BpHwBinder.h> |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 21 | |
Martijn Coenen | 4080edc | 2016-05-04 14:17:02 +0200 | [diff] [blame] | 22 | #include <hwbinder/IPCThreadState.h> |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 23 | #include <utils/Log.h> |
| 24 | |
| 25 | #include <stdio.h> |
| 26 | |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 27 | //#undef ALOGV |
| 28 | //#define ALOGV(...) fprintf(stderr, __VA_ARGS__) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 29 | |
| 30 | namespace android { |
Martijn Coenen | f75a23d | 2016-08-01 11:55:17 +0200 | [diff] [blame] | 31 | namespace hardware { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 32 | |
| 33 | // --------------------------------------------------------------------------- |
| 34 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 35 | BpHwBinder::ObjectManager::ObjectManager() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 36 | { |
| 37 | } |
| 38 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 39 | BpHwBinder::ObjectManager::~ObjectManager() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 40 | { |
| 41 | kill(); |
| 42 | } |
| 43 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 44 | void BpHwBinder::ObjectManager::attach( |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 45 | const void* objectID, void* object, void* cleanupCookie, |
| 46 | IBinder::object_cleanup_func func) |
| 47 | { |
| 48 | entry_t e; |
| 49 | e.object = object; |
| 50 | e.cleanupCookie = cleanupCookie; |
| 51 | e.func = func; |
| 52 | |
| 53 | if (mObjects.indexOfKey(objectID) >= 0) { |
Steve Block | eafc621 | 2012-01-06 19:20:56 +0000 | [diff] [blame] | 54 | ALOGE("Trying to attach object ID %p to binder ObjectManager %p with object %p, but object ID already in use", |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 55 | objectID, this, object); |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | mObjects.add(objectID, e); |
| 60 | } |
| 61 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 62 | void* BpHwBinder::ObjectManager::find(const void* objectID) const |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 63 | { |
| 64 | const ssize_t i = mObjects.indexOfKey(objectID); |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 65 | if (i < 0) return nullptr; |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 66 | return mObjects.valueAt(i).object; |
| 67 | } |
| 68 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 69 | void BpHwBinder::ObjectManager::detach(const void* objectID) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 70 | { |
| 71 | mObjects.removeItem(objectID); |
| 72 | } |
| 73 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 74 | void BpHwBinder::ObjectManager::kill() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 75 | { |
| 76 | const size_t N = mObjects.size(); |
Mark Salyzyn | 386eb9e | 2014-05-30 16:35:57 -0700 | [diff] [blame] | 77 | ALOGV("Killing %zu objects in manager %p", N, this); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 78 | for (size_t i=0; i<N; i++) { |
| 79 | const entry_t& e = mObjects.valueAt(i); |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 80 | if (e.func != nullptr) { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 81 | e.func(mObjects.keyAt(i), e.object, e.cleanupCookie); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | mObjects.clear(); |
| 86 | } |
| 87 | |
| 88 | // --------------------------------------------------------------------------- |
| 89 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 90 | BpHwBinder::BpHwBinder(int32_t handle) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 91 | : mHandle(handle) |
| 92 | , mAlive(1) |
| 93 | , mObitsSent(0) |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 94 | , mObituaries(nullptr) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 95 | { |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 96 | ALOGV("Creating BpHwBinder %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 97 | |
| 98 | extendObjectLifetime(OBJECT_LIFETIME_WEAK); |
Martijn Coenen | b825372 | 2018-05-23 15:33:22 +0200 | [diff] [blame] | 99 | IPCThreadState::self()->incWeakHandle(handle, this); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 100 | } |
| 101 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 102 | status_t BpHwBinder::transact( |
Steven Moreland | 4cbd6ec | 2019-04-30 19:29:52 -0700 | [diff] [blame] | 103 | uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags, TransactCallback callback) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 104 | { |
| 105 | // Once a binder has died, it will never come back to life. |
| 106 | if (mAlive) { |
| 107 | status_t status = IPCThreadState::self()->transact( |
| 108 | mHandle, code, data, reply, flags); |
Steven Moreland | 4cbd6ec | 2019-04-30 19:29:52 -0700 | [diff] [blame] | 109 | |
| 110 | if (status == ::android::OK && callback != nullptr) { |
| 111 | callback(*reply); |
| 112 | } |
| 113 | |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 114 | if (status == DEAD_OBJECT) mAlive = 0; |
| 115 | return status; |
| 116 | } |
| 117 | |
| 118 | return DEAD_OBJECT; |
| 119 | } |
| 120 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 121 | status_t BpHwBinder::linkToDeath( |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 122 | const sp<DeathRecipient>& recipient, void* cookie, uint32_t flags) |
| 123 | { |
| 124 | Obituary ob; |
| 125 | ob.recipient = recipient; |
| 126 | ob.cookie = cookie; |
| 127 | ob.flags = flags; |
| 128 | |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 129 | LOG_ALWAYS_FATAL_IF(recipient == nullptr, |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 130 | "linkToDeath(): recipient must be non-NULL"); |
| 131 | |
| 132 | { |
| 133 | AutoMutex _l(mLock); |
| 134 | |
| 135 | if (!mObitsSent) { |
| 136 | if (!mObituaries) { |
| 137 | mObituaries = new Vector<Obituary>; |
| 138 | if (!mObituaries) { |
| 139 | return NO_MEMORY; |
| 140 | } |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 141 | ALOGV("Requesting death notification: %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 142 | getWeakRefs()->incWeak(this); |
| 143 | IPCThreadState* self = IPCThreadState::self(); |
| 144 | self->requestDeathNotification(mHandle, this); |
| 145 | self->flushCommands(); |
| 146 | } |
| 147 | ssize_t res = mObituaries->add(ob); |
| 148 | return res >= (ssize_t)NO_ERROR ? (status_t)NO_ERROR : res; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | return DEAD_OBJECT; |
| 153 | } |
| 154 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 155 | status_t BpHwBinder::unlinkToDeath( |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 156 | const wp<DeathRecipient>& recipient, void* cookie, uint32_t flags, |
| 157 | wp<DeathRecipient>* outRecipient) |
| 158 | { |
| 159 | AutoMutex _l(mLock); |
| 160 | |
| 161 | if (mObitsSent) { |
| 162 | return DEAD_OBJECT; |
| 163 | } |
| 164 | |
| 165 | const size_t N = mObituaries ? mObituaries->size() : 0; |
| 166 | for (size_t i=0; i<N; i++) { |
| 167 | const Obituary& obit = mObituaries->itemAt(i); |
| 168 | if ((obit.recipient == recipient |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 169 | || (recipient == nullptr && obit.cookie == cookie)) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 170 | && obit.flags == flags) { |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 171 | if (outRecipient != nullptr) { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 172 | *outRecipient = mObituaries->itemAt(i).recipient; |
| 173 | } |
| 174 | mObituaries->removeAt(i); |
| 175 | if (mObituaries->size() == 0) { |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 176 | ALOGV("Clearing death notification: %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 177 | IPCThreadState* self = IPCThreadState::self(); |
| 178 | self->clearDeathNotification(mHandle, this); |
| 179 | self->flushCommands(); |
| 180 | delete mObituaries; |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 181 | mObituaries = nullptr; |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 182 | } |
| 183 | return NO_ERROR; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | return NAME_NOT_FOUND; |
| 188 | } |
| 189 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 190 | void BpHwBinder::sendObituary() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 191 | { |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 192 | ALOGV("Sending obituary for proxy %p handle %d, mObitsSent=%s\n", |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 193 | this, mHandle, mObitsSent ? "true" : "false"); |
| 194 | |
| 195 | mAlive = 0; |
| 196 | if (mObitsSent) return; |
| 197 | |
| 198 | mLock.lock(); |
| 199 | Vector<Obituary>* obits = mObituaries; |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 200 | if(obits != nullptr) { |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 201 | ALOGV("Clearing sent death notification: %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 202 | IPCThreadState* self = IPCThreadState::self(); |
| 203 | self->clearDeathNotification(mHandle, this); |
| 204 | self->flushCommands(); |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 205 | mObituaries = nullptr; |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 206 | } |
| 207 | mObitsSent = 1; |
| 208 | mLock.unlock(); |
| 209 | |
Mark Salyzyn | 386eb9e | 2014-05-30 16:35:57 -0700 | [diff] [blame] | 210 | ALOGV("Reporting death of proxy %p for %zu recipients\n", |
| 211 | this, obits ? obits->size() : 0U); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 212 | |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 213 | if (obits != nullptr) { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 214 | const size_t N = obits->size(); |
| 215 | for (size_t i=0; i<N; i++) { |
| 216 | reportOneDeath(obits->itemAt(i)); |
| 217 | } |
| 218 | |
| 219 | delete obits; |
| 220 | } |
| 221 | } |
| 222 | |
Martijn Coenen | 320e1d3 | 2018-09-07 10:41:33 +0200 | [diff] [blame] | 223 | // Returns the strong refcount on the object this proxy points to, or |
| 224 | // -1 in case of failure. |
| 225 | ssize_t BpHwBinder::getNodeStrongRefCount() |
| 226 | { |
| 227 | return ProcessState::self()->getStrongRefCountForNodeByHandle(mHandle); |
| 228 | } |
| 229 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 230 | void BpHwBinder::reportOneDeath(const Obituary& obit) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 231 | { |
| 232 | sp<DeathRecipient> recipient = obit.recipient.promote(); |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 233 | ALOGV("Reporting death to recipient: %p\n", recipient.get()); |
Yi Kong | 55d4107 | 2018-07-23 14:55:39 -0700 | [diff] [blame] | 234 | if (recipient == nullptr) return; |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 235 | |
| 236 | recipient->binderDied(this); |
| 237 | } |
| 238 | |
| 239 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 240 | void BpHwBinder::attachObject( |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 241 | const void* objectID, void* object, void* cleanupCookie, |
| 242 | object_cleanup_func func) |
| 243 | { |
| 244 | AutoMutex _l(mLock); |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 245 | ALOGV("Attaching object %p to binder %p (manager=%p)", object, this, &mObjects); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 246 | mObjects.attach(objectID, object, cleanupCookie, func); |
| 247 | } |
| 248 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 249 | void* BpHwBinder::findObject(const void* objectID) const |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 250 | { |
| 251 | AutoMutex _l(mLock); |
| 252 | return mObjects.find(objectID); |
| 253 | } |
| 254 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 255 | void BpHwBinder::detachObject(const void* objectID) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 256 | { |
| 257 | AutoMutex _l(mLock); |
| 258 | mObjects.detach(objectID); |
| 259 | } |
| 260 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 261 | BpHwBinder* BpHwBinder::remoteBinder() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 262 | { |
| 263 | return this; |
| 264 | } |
| 265 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 266 | BpHwBinder::~BpHwBinder() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 267 | { |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 268 | ALOGV("Destroying BpHwBinder %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 269 | |
| 270 | IPCThreadState* ipc = IPCThreadState::self(); |
| 271 | |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 272 | if (ipc) { |
| 273 | ipc->expungeHandle(mHandle, this); |
| 274 | ipc->decWeakHandle(mHandle); |
| 275 | } |
| 276 | } |
| 277 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 278 | void BpHwBinder::onFirstRef() |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 279 | { |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 280 | ALOGV("onFirstRef BpHwBinder %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 281 | IPCThreadState* ipc = IPCThreadState::self(); |
Martijn Coenen | b825372 | 2018-05-23 15:33:22 +0200 | [diff] [blame] | 282 | if (ipc) ipc->incStrongHandle(mHandle, this); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 283 | } |
| 284 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 285 | void BpHwBinder::onLastStrongRef(const void* /*id*/) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 286 | { |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 287 | ALOGV("onLastStrongRef BpHwBinder %p handle %d\n", this, mHandle); |
Steve Block | 48f4e15 | 2011-10-20 11:56:00 +0100 | [diff] [blame] | 288 | IF_ALOGV() { |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 289 | printRefs(); |
| 290 | } |
| 291 | IPCThreadState* ipc = IPCThreadState::self(); |
Tomasz Wasilczyk | e4f0b99 | 2017-02-27 13:50:50 -0800 | [diff] [blame] | 292 | if (ipc) { |
| 293 | ipc->decStrongHandle(mHandle); |
| 294 | ipc->flushCommands(); |
| 295 | } |
Steven Moreland | d6d3aa7 | 2019-06-07 12:36:50 -0700 | [diff] [blame] | 296 | |
| 297 | mLock.lock(); |
| 298 | Vector<Obituary>* obits = mObituaries; |
| 299 | if(obits != nullptr) { |
| 300 | if (!obits->isEmpty()) { |
| 301 | ALOGI("onLastStrongRef automatically unlinking death recipients"); |
| 302 | } |
| 303 | |
| 304 | if (ipc) ipc->clearDeathNotification(mHandle, this); |
| 305 | mObituaries = nullptr; |
| 306 | } |
| 307 | mLock.unlock(); |
| 308 | |
| 309 | if (obits != nullptr) { |
| 310 | // XXX Should we tell any remaining DeathRecipient |
| 311 | // objects that the last strong ref has gone away, so they |
| 312 | // are no longer linked? |
| 313 | delete obits; |
| 314 | obits = nullptr; |
| 315 | } |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 316 | } |
| 317 | |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 318 | bool BpHwBinder::onIncStrongAttempted(uint32_t /*flags*/, const void* /*id*/) |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 319 | { |
Yifan Hong | 1e118d2 | 2017-01-12 14:42:28 -0800 | [diff] [blame] | 320 | ALOGV("onIncStrongAttempted BpHwBinder %p handle %d\n", this, mHandle); |
Mathias Agopian | 7922fa2 | 2009-05-18 15:08:03 -0700 | [diff] [blame] | 321 | IPCThreadState* ipc = IPCThreadState::self(); |
| 322 | return ipc ? ipc->attemptIncStrongHandle(mHandle) == NO_ERROR : false; |
| 323 | } |
| 324 | |
| 325 | // --------------------------------------------------------------------------- |
| 326 | |
Steven Moreland | 7173a4c | 2019-09-26 15:55:02 -0700 | [diff] [blame] | 327 | } // namespace hardware |
| 328 | } // namespace android |