diff options
author | 2023-08-25 18:26:10 +0000 | |
---|---|---|
committer | 2023-08-25 18:26:10 +0000 | |
commit | 7e5716d5fd5c844e2920d5bf76df843a459269a7 (patch) | |
tree | 672180c59a1f07a9c371a904b20803eae0102bc1 | |
parent | 48c2f3e161b5dca194833e5e54acad141437c9a3 (diff) | |
parent | 13da0f9a0f2d5fcb70418fcdceb0d184313d7f48 (diff) |
Merge "Use String8/16 c_str [binder]" into main am: a79915269d am: 13da0f9a0f
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2704458
Change-Id: Id556a973fcdfbc8b6fae559148c0616625ab25bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | libs/binder/BpBinder.cpp | 4 | ||||
-rw-r--r-- | libs/binder/IActivityManager.cpp | 4 | ||||
-rw-r--r-- | libs/binder/IServiceManager.cpp | 14 | ||||
-rw-r--r-- | libs/binder/MemoryDealer.cpp | 2 | ||||
-rw-r--r-- | libs/binder/Parcel.cpp | 12 | ||||
-rw-r--r-- | libs/binder/PermissionCache.cpp | 5 | ||||
-rw-r--r-- | libs/binder/ProcessState.cpp | 6 | ||||
-rw-r--r-- | libs/binder/RecordedTransaction.cpp | 2 | ||||
-rw-r--r-- | libs/binder/include/binder/TextOutput.h | 2 | ||||
-rw-r--r-- | libs/fakeservicemanager/FakeServiceManager.cpp | 2 |
10 files changed, 26 insertions, 27 deletions
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp index 8d9955dd6b..589df9aceb 100644 --- a/libs/binder/BpBinder.cpp +++ b/libs/binder/BpBinder.cpp @@ -261,7 +261,7 @@ std::optional<int32_t> BpBinder::getDebugBinderHandle() const { bool BpBinder::isDescriptorCached() const { Mutex::Autolock _l(mLock); - return mDescriptorCache.string() != kDescriptorUninit.string(); + return mDescriptorCache.c_str() != kDescriptorUninit.c_str(); } const String16& BpBinder::getInterfaceDescriptor() const @@ -279,7 +279,7 @@ const String16& BpBinder::getInterfaceDescriptor() const Mutex::Autolock _l(mLock); // mDescriptorCache could have been assigned while the lock was // released. - if (mDescriptorCache.string() == kDescriptorUninit.string()) mDescriptorCache = res; + if (mDescriptorCache.c_str() == kDescriptorUninit.c_str()) mDescriptorCache = res; } } diff --git a/libs/binder/IActivityManager.cpp b/libs/binder/IActivityManager.cpp index f2b4a6ef37..28975618e1 100644 --- a/libs/binder/IActivityManager.cpp +++ b/libs/binder/IActivityManager.cpp @@ -52,8 +52,8 @@ public: } } else { // An exception was thrown back; fall through to return failure - ALOGD("openContentUri(%s) caught exception %d\n", - String8(stringUri).string(), exceptionCode); + ALOGD("openContentUri(%s) caught exception %d\n", String8(stringUri).c_str(), + exceptionCode); } } return fd; diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp index 2408307459..6034f2b4ca 100644 --- a/libs/binder/IServiceManager.cpp +++ b/libs/binder/IServiceManager.cpp @@ -216,8 +216,8 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, bool logP if (res) { if (startTime != 0) { ALOGI("Check passed after %d seconds for %s from uid=%d pid=%d", - (int)((uptimeMillis()-startTime)/1000), - String8(permission).string(), uid, pid); + (int)((uptimeMillis() - startTime) / 1000), String8(permission).c_str(), + uid, pid); } return res; } @@ -225,7 +225,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, bool logP // Is this a permission failure, or did the controller go away? if (IInterface::asBinder(pc)->isBinderAlive()) { if (logPermissionFailure) { - ALOGW("Permission failure: %s from uid=%d pid=%d", String8(permission).string(), + ALOGW("Permission failure: %s from uid=%d pid=%d", String8(permission).c_str(), uid, pid); } return false; @@ -246,7 +246,7 @@ bool checkPermission(const String16& permission, pid_t pid, uid_t uid, bool logP if (startTime == 0) { startTime = uptimeMillis(); ALOGI("Waiting to check permission %s from uid=%d pid=%d", - String8(permission).string(), uid, pid); + String8(permission).c_str(), uid, pid); } sleep(1); } else { @@ -295,7 +295,7 @@ sp<IBinder> ServiceManagerShim::getService(const String16& name) const // retry interval in millisecond; note that vendor services stay at 100ms const useconds_t sleepTime = gSystemBootCompleted ? 1000 : 100; - ALOGI("Waiting for service '%s' on '%s'...", String8(name).string(), + ALOGI("Waiting for service '%s' on '%s'...", String8(name).c_str(), ProcessState::self()->getDriverName().c_str()); int n = 0; @@ -306,12 +306,12 @@ sp<IBinder> ServiceManagerShim::getService(const String16& name) const sp<IBinder> svc = checkService(name); if (svc != nullptr) { ALOGI("Waiting for service '%s' on '%s' successful after waiting %" PRIi64 "ms", - String8(name).string(), ProcessState::self()->getDriverName().c_str(), + String8(name).c_str(), ProcessState::self()->getDriverName().c_str(), uptimeMillis() - startTime); return svc; } } - ALOGW("Service %s didn't start. Returning NULL", String8(name).string()); + ALOGW("Service %s didn't start. Returning NULL", String8(name).c_str()); return nullptr; } diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp index 03553f36e9..5b1cb7ea56 100644 --- a/libs/binder/MemoryDealer.cpp +++ b/libs/binder/MemoryDealer.cpp @@ -428,7 +428,7 @@ void SimpleBestFitAllocator::dump_l(const char* what) const { String8 result; dump_l(result, what); - ALOGD("%s", result.string()); + ALOGD("%s", result.c_str()); } void SimpleBestFitAllocator::dump(String8& result, diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 9b685f9145..5b34efc257 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -854,7 +854,7 @@ constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T'); // Write RPC headers. (previously just the interface token) status_t Parcel::writeInterfaceToken(const String16& interface) { - return writeInterfaceToken(interface.string(), interface.size()); + return writeInterfaceToken(interface.c_str(), interface.size()); } status_t Parcel::writeInterfaceToken(const char16_t* str, size_t len) { @@ -918,7 +918,7 @@ bool Parcel::checkInterface(IBinder* binder) const bool Parcel::enforceInterface(const String16& interface, IPCThreadState* threadState) const { - return enforceInterface(interface.string(), interface.size(), threadState); + return enforceInterface(interface.c_str(), interface.size(), threadState); } bool Parcel::enforceInterface(const char16_t* interface, @@ -977,8 +977,8 @@ bool Parcel::enforceInterface(const char16_t* interface, return true; } else { ALOGW("**** enforceInterface() expected '%s' but read '%s'", - String8(interface, len).string(), - String8(parcel_interface, parcel_interface_len).string()); + String8(interface, len).c_str(), + String8(parcel_interface, parcel_interface_len).c_str()); return false; } } @@ -1376,7 +1376,7 @@ status_t Parcel::writeCString(const char* str) status_t Parcel::writeString8(const String8& str) { - return writeString8(str.string(), str.size()); + return writeString8(str.c_str(), str.size()); } status_t Parcel::writeString8(const char* str, size_t len) @@ -1399,7 +1399,7 @@ status_t Parcel::writeString8(const char* str, size_t len) status_t Parcel::writeString16(const String16& str) { - return writeString16(str.string(), str.size()); + return writeString16(str.c_str(), str.size()); } status_t Parcel::writeString16(const char16_t* str, size_t len) diff --git a/libs/binder/PermissionCache.cpp b/libs/binder/PermissionCache.cpp index 670fd55da3..658686d2db 100644 --- a/libs/binder/PermissionCache.cpp +++ b/libs/binder/PermissionCache.cpp @@ -101,9 +101,8 @@ bool PermissionCache::checkPermission( nsecs_t t = -systemTime(); granted = android::checkPermission(permission, pid, uid); t += systemTime(); - ALOGD("checking %s for uid=%d => %s (%d us)", - String8(permission).string(), uid, - granted?"granted":"denied", (int)ns2us(t)); + ALOGD("checking %s for uid=%d => %s (%d us)", String8(permission).c_str(), uid, + granted ? "granted" : "denied", (int)ns2us(t)); pc.cache(permission, uid, granted); } return granted; diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 02b0447304..8ec4af9945 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -401,9 +401,9 @@ void ProcessState::spawnPooledThread(bool isMain) { if (mThreadPoolStarted) { String8 name = makeBinderThreadName(); - ALOGV("Spawning new pooled thread, name=%s\n", name.string()); + ALOGV("Spawning new pooled thread, name=%s\n", name.c_str()); sp<Thread> t = sp<PoolThread>::make(isMain); - t->run(name.string()); + t->run(name.c_str()); pthread_mutex_lock(&mThreadCountLock); mKernelStartedThreads++; pthread_mutex_unlock(&mThreadCountLock); @@ -505,7 +505,7 @@ status_t ProcessState::enableOnewaySpamDetection(bool enable) { } void ProcessState::giveThreadPoolName() { - androidSetThreadName( makeBinderThreadName().string() ); + androidSetThreadName(makeBinderThreadName().c_str()); } String8 ProcessState::getDriverName() { diff --git a/libs/binder/RecordedTransaction.cpp b/libs/binder/RecordedTransaction.cpp index 44a9e3befa..324670633f 100644 --- a/libs/binder/RecordedTransaction.cpp +++ b/libs/binder/RecordedTransaction.cpp @@ -124,7 +124,7 @@ std::optional<RecordedTransaction> RecordedTransaction::fromDetails( static_cast<int32_t>(timestamp.tv_nsec), 0}; - t.mData.mInterfaceName = std::string(String8(interfaceName).string()); + t.mData.mInterfaceName = std::string(String8(interfaceName).c_str()); if (interfaceName.size() != t.mData.mInterfaceName.size()) { LOG(ERROR) << "Interface Name is not valid. Contains characters that aren't single byte " "utf-8."; diff --git a/libs/binder/include/binder/TextOutput.h b/libs/binder/include/binder/TextOutput.h index eb98042c42..50158c3072 100644 --- a/libs/binder/include/binder/TextOutput.h +++ b/libs/binder/include/binder/TextOutput.h @@ -147,7 +147,7 @@ inline TextOutput& operator<<(TextOutput& to, const bool &val) inline TextOutput& operator<<(TextOutput& to, const String16& val) { - to << String8(val).string(); + to << String8(val).c_str(); return to; } diff --git a/libs/fakeservicemanager/FakeServiceManager.cpp b/libs/fakeservicemanager/FakeServiceManager.cpp index 241c866558..ae242f32a3 100644 --- a/libs/fakeservicemanager/FakeServiceManager.cpp +++ b/libs/fakeservicemanager/FakeServiceManager.cpp @@ -84,7 +84,7 @@ Vector<String16> FakeServiceManager::getDeclaredInstances(const String16& name) for (const auto& [registeredName, service] : mNameToService) { (void) service; if (registeredName.startsWith(prefix)) { - out.add(String16(registeredName.string() + prefix.size())); + out.add(String16(registeredName.c_str() + prefix.size())); } } return out; |