diff options
-rw-r--r-- | cmds/dumpstate/dumpstate.cpp | 14 | ||||
-rw-r--r-- | cmds/servicemanager/ServiceManager.cpp | 45 | ||||
-rw-r--r-- | cmds/servicemanager/ServiceManager.h | 2 | ||||
-rw-r--r-- | libs/binder/ndk/Android.bp | 4 | ||||
-rw-r--r-- | libs/nativewindow/Android.bp | 3 | ||||
-rw-r--r-- | opengl/libs/Android.bp | 17 | ||||
-rw-r--r-- | vulkan/libvulkan/Android.bp | 3 |
7 files changed, 72 insertions, 16 deletions
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp index 6dea91bc2b..4f1020c7ad 100644 --- a/cmds/dumpstate/dumpstate.cpp +++ b/cmds/dumpstate/dumpstate.cpp @@ -183,6 +183,7 @@ void add_mountinfo(); #define PACKAGE_DEX_USE_LIST "/data/system/package-dex-usage.list" #define SYSTEM_TRACE_SNAPSHOT "/data/misc/perfetto-traces/bugreport/systrace.pftrace" #define CGROUPFS_DIR "/sys/fs/cgroup" +#define SDK_EXT_INFO "/apex/com.android.sdkext/bin/derive_sdk" // TODO(narayan): Since this information has to be kept in sync // with tombstoned, we should just put it in a common header. @@ -765,7 +766,7 @@ uint64_t Dumpstate::ConsentCallback::getElapsedTimeMs() const { } void Dumpstate::PrintHeader() const { - std::string build, fingerprint, radio, bootloader, network; + std::string build, fingerprint, radio, bootloader, network, sdkversion; char date[80]; build = android::base::GetProperty("ro.build.display.id", "(unknown)"); @@ -773,6 +774,7 @@ void Dumpstate::PrintHeader() const { radio = android::base::GetProperty("gsm.version.baseband", "(unknown)"); bootloader = android::base::GetProperty("ro.bootloader", "(unknown)"); network = android::base::GetProperty("gsm.operator.alpha", "(unknown)"); + sdkversion = android::base::GetProperty("ro.build.version.sdk", "(unknown)"); strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&now_)); printf("========================================================\n"); @@ -790,9 +792,10 @@ void Dumpstate::PrintHeader() const { if (module_metadata_version != 0) { printf("Module Metadata version: %" PRId64 "\n", module_metadata_version); } - printf("SDK extension versions [r=%s s=%s]\n", - android::base::GetProperty("build.version.extensions.r", "-").c_str(), - android::base::GetProperty("build.version.extensions.s", "-").c_str()); + printf("Android SDK version: %s\n", sdkversion.c_str()); + printf("SDK extensions: "); + RunCommandToFd(STDOUT_FILENO, "", {SDK_EXT_INFO, "--header"}, + CommandOptions::WithTimeout(1).Always().DropRoot().Build()); printf("Kernel: "); DumpFileToFd(STDOUT_FILENO, "", "/proc/version"); @@ -1859,6 +1862,9 @@ Dumpstate::RunStatus Dumpstate::DumpstateDefaultAfterCritical() { DumpFile("PSI memory", "/proc/pressure/memory"); DumpFile("PSI io", "/proc/pressure/io"); + RunCommand("SDK EXTENSIONS", {SDK_EXT_INFO, "--dump"}, + CommandOptions::WithTimeout(10).Always().DropRoot().Build()); + if (dump_pool_) { RETURN_IF_USER_DENIED_CONSENT(); WaitForTask(std::move(dump_traces)); diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp index 07273835f9..a99ccae2f1 100644 --- a/cmds/servicemanager/ServiceManager.cpp +++ b/cmds/servicemanager/ServiceManager.cpp @@ -326,16 +326,41 @@ Status ServiceManager::addService(const std::string& name, const sp<IBinder>& bi return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE, "linkToDeath failure"); } + auto it = mNameToService.find(name); + if (it != mNameToService.end()) { + const Service& existing = it->second; + + // We could do better than this because if the other service dies, it + // may not have an entry here. However, this case is unlikely. We are + // only trying to detect when two different services are accidentally installed. + + if (existing.ctx.uid != ctx.uid) { + LOG(WARNING) << "Service '" << name << "' originally registered from UID " + << existing.ctx.uid << " but it is now being registered from UID " + << ctx.uid << ". Multiple instances installed?"; + } + + if (existing.ctx.sid != ctx.sid) { + LOG(WARNING) << "Service '" << name << "' originally registered from SID " + << existing.ctx.sid << " but it is now being registered from SID " + << ctx.sid << ". Multiple instances installed?"; + } + + LOG(INFO) << "Service '" << name << "' originally registered from PID " + << existing.ctx.debugPid << " but it is being registered again from PID " + << ctx.debugPid + << ". Bad state? Late death notification? Multiple instances installed?"; + } + // Overwrite the old service if it exists - mNameToService[name] = Service { - .binder = binder, - .allowIsolated = allowIsolated, - .dumpPriority = dumpPriority, - .debugPid = ctx.debugPid, + mNameToService[name] = Service{ + .binder = binder, + .allowIsolated = allowIsolated, + .dumpPriority = dumpPriority, + .ctx = ctx, }; - auto it = mNameToRegistrationCallback.find(name); - if (it != mNameToRegistrationCallback.end()) { + if (auto it = mNameToRegistrationCallback.find(name); it != mNameToRegistrationCallback.end()) { for (const sp<IServiceCallback>& cb : it->second) { mNameToService[name].guaranteeClient = true; // permission checked in registerForNotifications @@ -571,7 +596,7 @@ Status ServiceManager::registerClientCallback(const std::string& name, const sp< return Status::fromExceptionCode(Status::EX_ILLEGAL_ARGUMENT); } - if (serviceIt->second.debugPid != IPCThreadState::self()->getCallingPid()) { + if (serviceIt->second.ctx.debugPid != IPCThreadState::self()->getCallingPid()) { LOG(WARNING) << "Only a server can register for client callbacks (for " << name << ")"; return Status::fromExceptionCode(Status::EX_UNSUPPORTED_OPERATION); } @@ -707,7 +732,7 @@ Status ServiceManager::tryUnregisterService(const std::string& name, const sp<IB return Status::fromExceptionCode(Status::EX_ILLEGAL_STATE); } - if (serviceIt->second.debugPid != IPCThreadState::self()->getCallingPid()) { + if (serviceIt->second.ctx.debugPid != IPCThreadState::self()->getCallingPid()) { LOG(WARNING) << "Only a server can unregister itself (for " << name << ")"; return Status::fromExceptionCode(Status::EX_UNSUPPORTED_OPERATION); } @@ -754,7 +779,7 @@ Status ServiceManager::getServiceDebugInfo(std::vector<ServiceDebugInfo>* outRet for (auto const& [name, service] : mNameToService) { ServiceDebugInfo info; info.name = name; - info.debugPid = service.debugPid; + info.debugPid = service.ctx.debugPid; outReturn->push_back(std::move(info)); } diff --git a/cmds/servicemanager/ServiceManager.h b/cmds/servicemanager/ServiceManager.h index c6db697a89..07b79f80ac 100644 --- a/cmds/servicemanager/ServiceManager.h +++ b/cmds/servicemanager/ServiceManager.h @@ -74,7 +74,7 @@ private: int32_t dumpPriority; bool hasClients = false; // notifications sent on true -> false. bool guaranteeClient = false; // forces the client check to true - pid_t debugPid = 0; // the process in which this service runs + Access::CallingContext ctx; // process that originally registers this // the number of clients of the service, including servicemanager itself ssize_t getNodeStrongRefCount(); diff --git a/libs/binder/ndk/Android.bp b/libs/binder/ndk/Android.bp index 33d28e65c5..8ae7537486 100644 --- a/libs/binder/ndk/Android.bp +++ b/libs/binder/ndk/Android.bp @@ -182,4 +182,8 @@ ndk_library { name: "libbinder_ndk", symbol_file: "libbinder_ndk.map.txt", first_version: "29", + export_header_libs: [ + "libbinder_ndk_headers", + "libbinder_ndk_helper_headers", + ], } diff --git a/libs/nativewindow/Android.bp b/libs/nativewindow/Android.bp index dd07319791..d7db6bd174 100644 --- a/libs/nativewindow/Android.bp +++ b/libs/nativewindow/Android.bp @@ -61,6 +61,9 @@ ndk_library { // Android O first_version: "26", + export_header_libs: [ + "libnativewindow_ndk_headers", + ], } cc_library { diff --git a/opengl/libs/Android.bp b/opengl/libs/Android.bp index 2237d2d123..62cf2555ca 100644 --- a/opengl/libs/Android.bp +++ b/opengl/libs/Android.bp @@ -12,7 +12,10 @@ cc_library { name: "libETC1", srcs: ["ETC1/etc1.cpp"], host_supported: true, - cflags: ["-Wall", "-Werror"], + cflags: [ + "-Wall", + "-Werror", + ], target: { android: { @@ -37,6 +40,9 @@ ndk_library { symbol_file: "libEGL.map.txt", first_version: "9", unversioned_until: "current", + export_header_libs: [ + "libEGL_headers", + ], } ndk_library { @@ -44,6 +50,9 @@ ndk_library { symbol_file: "libGLESv1_CM.map.txt", first_version: "9", unversioned_until: "current", + export_header_libs: [ + "libGLESv1_CM_headers", + ], } ndk_library { @@ -51,6 +60,9 @@ ndk_library { symbol_file: "libGLESv2.map.txt", first_version: "9", unversioned_until: "current", + export_header_libs: [ + "libGLESv2_headers", + ], } ndk_library { @@ -58,6 +70,9 @@ ndk_library { symbol_file: "libGLESv3.map.txt", first_version: "18", unversioned_until: "current", + export_header_libs: [ + "libGLESv3_headers", + ], } cc_defaults { diff --git a/vulkan/libvulkan/Android.bp b/vulkan/libvulkan/Android.bp index 5719b5cf61..a87f82fcbd 100644 --- a/vulkan/libvulkan/Android.bp +++ b/vulkan/libvulkan/Android.bp @@ -27,6 +27,9 @@ ndk_library { symbol_file: "libvulkan.map.txt", first_version: "24", unversioned_until: "current", + export_header_libs: [ + "ndk_vulkan_headers", + ], } cc_library_shared { |