diff options
| author | 2020-11-17 01:49:54 +0000 | |
|---|---|---|
| committer | 2020-11-17 01:49:54 +0000 | |
| commit | 4c2eeff7b3ce2b467e8d4efda9e0a4fc66bbf704 (patch) | |
| tree | f7a6dbc93b840f04b780610cdd1c31a45169ca3e | |
| parent | 2768a7b6ba4a3eb148f802241633e5ba562dc8f2 (diff) | |
| parent | 6140d46d41f549ceff103e42270d0ada57705117 (diff) | |
Merge changes I89779ab3,I63ec0e57 am: 6c8e3812b9 am: f39786af24 am: 6140d46d41
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1498600
Change-Id: If96621b20c0847afd6f52f10c80f1592012b2e73
| -rw-r--r-- | libs/binder/Android.bp | 1 | ||||
| -rw-r--r-- | libs/binder/Debug.cpp | 2 | ||||
| -rw-r--r-- | libs/binder/IPCThreadState.cpp | 18 | ||||
| -rw-r--r-- | libs/binder/IServiceManager.cpp | 4 | ||||
| -rw-r--r-- | libs/binder/include/binder/Parcel.h | 2 | ||||
| -rw-r--r-- | libs/binder/ndk/Android.bp | 8 | ||||
| -rw-r--r-- | libs/binder/ndk/ibinder.cpp | 4 | ||||
| -rw-r--r-- | libs/binder/ndk/ibinder_internal.h | 4 |
8 files changed, 26 insertions, 17 deletions
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp index 7c1a307cfe..f4f036e406 100644 --- a/libs/binder/Android.bp +++ b/libs/binder/Android.bp @@ -181,7 +181,6 @@ cc_library { ], tidy_checks_as_errors: [ "*", - "-google-runtime-int", ], } diff --git a/libs/binder/Debug.cpp b/libs/binder/Debug.cpp index 64c1ff68c0..da342ff210 100644 --- a/libs/binder/Debug.cpp +++ b/libs/binder/Debug.cpp @@ -208,7 +208,7 @@ void printHexData(int32_t indent, const void *buf, size_t length, } for (offset = 0; ; offset += bytesPerLine, pos += bytesPerLine) { - long remain = length; + size_t remain = length; char* c = buffer; if (!oneLine && !cStyle) { diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp index c5835c614a..d4c7acfdfd 100644 --- a/libs/binder/IPCThreadState.cpp +++ b/libs/binder/IPCThreadState.cpp @@ -135,7 +135,7 @@ static const void* printBinderTransactionData(TextOutput& out, const void* data) out << "target.ptr=" << btd->target.ptr; } out << " (cookie " << btd->cookie << ")" << endl - << "code=" << TypeCode(btd->code) << ", flags=" << (void*)(long)btd->flags << endl + << "code=" << TypeCode(btd->code) << ", flags=" << (void*)(uint64_t)btd->flags << endl << "data=" << btd->data.ptr.buffer << " (" << (void*)btd->data_size << " bytes)" << endl << "offsets=" << btd->data.ptr.offsets << " (" << (void*)btd->offsets_size @@ -150,7 +150,7 @@ static const void* printReturnCommand(TextOutput& out, const void* _cmd) uint32_t code = (uint32_t)*cmd++; size_t cmdIndex = code & 0xff; if (code == BR_ERROR) { - out << "BR_ERROR: " << (void*)(long)(*cmd++) << endl; + out << "BR_ERROR: " << (void*)(uint64_t)(*cmd++) << endl; return cmd; } else if (cmdIndex >= N) { out << "Unknown reply: " << code << endl; @@ -177,21 +177,21 @@ static const void* printReturnCommand(TextOutput& out, const void* _cmd) case BR_DECREFS: { const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c << ")"; + out << ": target=" << (void*)(uint64_t)b << " (cookie " << (void*)(uint64_t)c << ")"; } break; case BR_ATTEMPT_ACQUIRE: { const int32_t p = *cmd++; const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c + out << ": target=" << (void*)(uint64_t)b << " (cookie " << (void*)(uint64_t)c << "), pri=" << p; } break; case BR_DEAD_BINDER: case BR_CLEAR_DEATH_NOTIFICATION_DONE: { const int32_t c = *cmd++; - out << ": death cookie " << (void*)(long)c; + out << ": death cookie " << (void*)(uint64_t)c; } break; default: @@ -232,7 +232,7 @@ static const void* printCommand(TextOutput& out, const void* _cmd) case BC_FREE_BUFFER: { const int32_t buf = *cmd++; - out << ": buffer=" << (void*)(long)buf; + out << ": buffer=" << (void*)(uint64_t)buf; } break; case BC_INCREFS: @@ -247,7 +247,7 @@ static const void* printCommand(TextOutput& out, const void* _cmd) case BC_ACQUIRE_DONE: { const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c << ")"; + out << ": target=" << (void*)(uint64_t)b << " (cookie " << (void*)(uint64_t)c << ")"; } break; case BC_ATTEMPT_ACQUIRE: { @@ -260,12 +260,12 @@ static const void* printCommand(TextOutput& out, const void* _cmd) case BC_CLEAR_DEATH_NOTIFICATION: { const int32_t h = *cmd++; const int32_t c = *cmd++; - out << ": handle=" << h << " (death cookie " << (void*)(long)c << ")"; + out << ": handle=" << h << " (death cookie " << (void*)(uint64_t)c << ")"; } break; case BC_DEAD_BINDER_DONE: { const int32_t c = *cmd++; - out << ": death cookie " << (void*)(long)c; + out << ": death cookie " << (void*)(uint64_t)c; } break; default: diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 35e642deb2..ca067e2d7f 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -221,7 +221,7 @@ sp<IBinder> ServiceManagerShim::getService(const String16& name) const const bool isVendorService = strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder") == 0; - const long timeout = 5000; + constexpr int64_t timeout = 5000; int64_t startTime = uptimeMillis(); // Vendor code can't access system properties if (!gSystemBootCompleted && !isVendorService) { @@ -234,7 +234,7 @@ sp<IBinder> ServiceManagerShim::getService(const String16& name) const #endif } // retry interval in millisecond; note that vendor services stay at 100ms - const long sleepTime = gSystemBootCompleted ? 1000 : 100; + const useconds_t sleepTime = gSystemBootCompleted ? 1000 : 100; ALOGI("Waiting for service '%s' on '%s'...", String8(name).string(), ProcessState::self()->getDriverName().c_str()); diff --git a/libs/binder/include/binder/Parcel.h b/libs/binder/include/binder/Parcel.h index 819df92a0e..ece25a0730 100644 --- a/libs/binder/include/binder/Parcel.h +++ b/libs/binder/include/binder/Parcel.h @@ -33,8 +33,10 @@ #include <binder/Parcelable.h> #ifdef BINDER_IPC_32BIT +//NOLINTNEXTLINE(google-runtime-int) b/173188702 typedef unsigned int binder_size_t; #else +//NOLINTNEXTLINE(google-runtime-int) b/173188702 typedef unsigned long long binder_size_t; #endif diff --git a/libs/binder/ndk/Android.bp b/libs/binder/ndk/Android.bp index cecc75904a..a57beeea85 100644 --- a/libs/binder/ndk/Android.bp +++ b/libs/binder/ndk/Android.bp @@ -98,6 +98,14 @@ cc_library { "30", ], }, + tidy: true, + tidy_flags: [ + // Only check our headers + "--header-filter=^.*frameworks/native/libs/binder/.*.h$", + ], + tidy_checks_as_errors: [ + "*", + ], } ndk_headers { diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp index 3e20e01501..f0d93c3f0c 100644 --- a/libs/binder/ndk/ibinder.cpp +++ b/libs/binder/ndk/ibinder.cpp @@ -367,7 +367,7 @@ void AIBinder_DeathRecipient::pruneDeadTransferEntriesLocked() { mDeathRecipients.end()); } -binder_status_t AIBinder_DeathRecipient::linkToDeath(sp<IBinder> binder, void* cookie) { +binder_status_t AIBinder_DeathRecipient::linkToDeath(const sp<IBinder>& binder, void* cookie) { CHECK(binder != nullptr); std::lock_guard<std::mutex> l(mDeathRecipientsMutex); @@ -386,7 +386,7 @@ binder_status_t AIBinder_DeathRecipient::linkToDeath(sp<IBinder> binder, void* c return STATUS_OK; } -binder_status_t AIBinder_DeathRecipient::unlinkToDeath(sp<IBinder> binder, void* cookie) { +binder_status_t AIBinder_DeathRecipient::unlinkToDeath(const sp<IBinder>& binder, void* cookie) { CHECK(binder != nullptr); std::lock_guard<std::mutex> l(mDeathRecipientsMutex); diff --git a/libs/binder/ndk/ibinder_internal.h b/libs/binder/ndk/ibinder_internal.h index f60112787d..25caf81971 100644 --- a/libs/binder/ndk/ibinder_internal.h +++ b/libs/binder/ndk/ibinder_internal.h @@ -161,8 +161,8 @@ struct AIBinder_DeathRecipient : ::android::RefBase { }; explicit AIBinder_DeathRecipient(AIBinder_DeathRecipient_onBinderDied onDied); - binder_status_t linkToDeath(::android::sp<::android::IBinder>, void* cookie); - binder_status_t unlinkToDeath(::android::sp<::android::IBinder> binder, void* cookie); + binder_status_t linkToDeath(const ::android::sp<::android::IBinder>&, void* cookie); + binder_status_t unlinkToDeath(const ::android::sp<::android::IBinder>& binder, void* cookie); private: // When the user of this API deletes a Bp object but not the death recipient, the |