summaryrefslogtreecommitdiff
path: root/cmds/dumpsys/dumpsys.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-05-24 22:58:37 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2021-05-24 22:58:37 +0000
commit3658c3bcc01fe42a39a27a123d990c106d9bc29a (patch)
treecb1d83e83726024f562440fe83661c6bf9612952 /cmds/dumpsys/dumpsys.cpp
parent3f711658f05b38fc9ca2b80f00877b499ffcad23 (diff)
parent71296be69be79afade98c08bd6c567071de768da (diff)
Merge "Expose binder stability for debugging in dumpsys" am: 71296be69b
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1712769 Change-Id: I9fbc90101babd007ffa722dae54ec380d2768a98
Diffstat (limited to 'cmds/dumpsys/dumpsys.cpp')
-rw-r--r--cmds/dumpsys/dumpsys.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/cmds/dumpsys/dumpsys.cpp b/cmds/dumpsys/dumpsys.cpp
index ba1c449dbf..83a52b85a3 100644
--- a/cmds/dumpsys/dumpsys.cpp
+++ b/cmds/dumpsys/dumpsys.cpp
@@ -24,6 +24,7 @@
#include <android-base/unique_fd.h>
#include <binder/Parcel.h>
#include <binder/ProcessState.h>
+#include <binder/Stability.h>
#include <binder/TextOutput.h>
#include <binderdebug/BinderDebug.h>
#include <serviceutils/PriorityDumper.h>
@@ -69,12 +70,13 @@ static void usage() {
" -t TIMEOUT_SEC: TIMEOUT to use in seconds instead of default 10 seconds\n"
" -T TIMEOUT_MS: TIMEOUT to use in milliseconds instead of default 10 seconds\n"
" --pid: dump PID instead of usual dump\n"
- " --thread: dump thread usage instead of usual dump\n"
" --proto: filter services that support dumping data in proto format. Dumps\n"
" will be in proto format.\n"
" --priority LEVEL: filter services based on specified priority\n"
" LEVEL must be one of CRITICAL | HIGH | NORMAL\n"
" --skip SERVICES: dumps all services but SERVICES (comma-separated list)\n"
+ " --stability: dump binder stability information instead of usual dump\n"
+ " --thread: dump thread usage instead of usual dump\n"
" SERVICE [ARGS]: dumps only service SERVICE, optionally passing ARGS to it\n");
}
@@ -128,12 +130,13 @@ int Dumpsys::main(int argc, char* const argv[]) {
Type type = Type::DUMP;
int timeoutArgMs = 10000;
int priorityFlags = IServiceManager::DUMP_FLAG_PRIORITY_ALL;
- static struct option longOptions[] = {{"thread", no_argument, 0, 0},
+ static struct option longOptions[] = {{"help", no_argument, 0, 0},
{"pid", no_argument, 0, 0},
{"priority", required_argument, 0, 0},
{"proto", no_argument, 0, 0},
{"skip", no_argument, 0, 0},
- {"help", no_argument, 0, 0},
+ {"stability", no_argument, 0, 0},
+ {"thread", no_argument, 0, 0},
{0, 0, 0, 0}};
// Must reset optind, otherwise subsequent calls will fail (wouldn't happen on main.cpp, but
@@ -167,6 +170,8 @@ int Dumpsys::main(int argc, char* const argv[]) {
}
} else if (!strcmp(longOptions[optionIndex].name, "pid")) {
type = Type::PID;
+ } else if (!strcmp(longOptions[optionIndex].name, "stability")) {
+ type = Type::STABILITY;
} else if (!strcmp(longOptions[optionIndex].name, "thread")) {
type = Type::THREAD;
}
@@ -335,6 +340,11 @@ static status_t dumpPidToFd(const sp<IBinder>& service, const unique_fd& fd) {
return OK;
}
+static status_t dumpStabilityToFd(const sp<IBinder>& service, const unique_fd& fd) {
+ WriteStringToFd(internal::Stability::debugToString(service) + "\n", fd);
+ return OK;
+}
+
static status_t dumpThreadsToFd(const sp<IBinder>& service, const unique_fd& fd) {
pid_t pid;
status_t status = service->getDebugPid(&pid);
@@ -382,6 +392,9 @@ status_t Dumpsys::startDumpThread(Type type, const String16& serviceName,
case Type::PID:
err = dumpPidToFd(service, remote_end);
break;
+ case Type::STABILITY:
+ err = dumpStabilityToFd(service, remote_end);
+ break;
case Type::THREAD:
err = dumpThreadsToFd(service, remote_end);
break;