Merge "Update dump() for Aidl HALs." into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f2384c1b22
@@ -56,6 +56,7 @@ struct WVDrmFactory : public ::aidl::android::hardware::drm::BnDrmFactory {
|
|||||||
static std::string stringToHex(const std::string& input);
|
static std::string stringToHex(const std::string& input);
|
||||||
static void printCdmMetrics(int fd);
|
static void printCdmMetrics(int fd);
|
||||||
static void printCdmProperties(int fd);
|
static void printCdmProperties(int fd);
|
||||||
|
static void printUsage(int fd);
|
||||||
|
|
||||||
friend class WVDrmFactoryTestPeer;
|
friend class WVDrmFactoryTestPeer;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -251,6 +251,15 @@ void WVDrmFactory::printCdmProperties(int fd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WVDrmFactory::printUsage(int fd) {
|
||||||
|
dprintf(fd, "\nDefault to print all info if no arguments are used.\n");
|
||||||
|
dprintf(fd, "Optional arguments are:\n");
|
||||||
|
dprintf(fd, "\ta:print all info | m:cdm metrics | p:cdm properties\n");
|
||||||
|
dprintf(fd,
|
||||||
|
"Usage: adb shell dumpsys "
|
||||||
|
"android.hardware.drm::IDrmFactory/widevine [-a|-h|-m|-p]\n");
|
||||||
|
}
|
||||||
|
|
||||||
binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
||||||
uint32_t numArgs) {
|
uint32_t numArgs) {
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
@@ -258,31 +267,32 @@ binder_status_t WVDrmFactory::dump(int fd, const char** args,
|
|||||||
return STATUS_BAD_VALUE;
|
return STATUS_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dprintf(fd, "\nDefault to print all info if no arguments are used.\n");
|
|
||||||
dprintf(fd, "Optional arguments are:\n");
|
|
||||||
dprintf(fd, "\tm:cdm metrics | p:cdm properties\n");
|
|
||||||
dprintf(fd,
|
|
||||||
"Usage: adb shell lshal debug "
|
|
||||||
"android.hardware.drm@1.3::IDrmFactory/widevine [m|p]\n");
|
|
||||||
|
|
||||||
bool dumpCdmProperties, dumpCdmMetrics = false;
|
bool dumpCdmProperties, dumpCdmMetrics = false;
|
||||||
if (numArgs == 0) {
|
if (numArgs == 0) {
|
||||||
// default to print all info if no arguments are given
|
// default to print all info if no arguments are given
|
||||||
dumpCdmProperties = dumpCdmMetrics = true;
|
dumpCdmProperties = dumpCdmMetrics = true;
|
||||||
} else {
|
} else {
|
||||||
for (auto&& str : std::vector<std::string_view>{args, args + numArgs}) {
|
for (auto&& str : std::vector<std::string_view>{args, args + numArgs}) {
|
||||||
dprintf(fd, "args: %s\n", str.data());
|
|
||||||
string option = str.data();
|
string option = str.data();
|
||||||
if (option.find('m') != string::npos ||
|
if (option.find("-a") != string::npos ||
|
||||||
option.find('M') != string::npos) {
|
option.find("-A") != string::npos) {
|
||||||
|
dumpCdmProperties = dumpCdmMetrics = true;
|
||||||
|
} else if (option.find("-m") != string::npos ||
|
||||||
|
option.find("-M") != string::npos) {
|
||||||
dumpCdmMetrics = true;
|
dumpCdmMetrics = true;
|
||||||
}
|
} else if (option.find("-p") != string::npos ||
|
||||||
if (option.find('p') != string::npos ||
|
option.find("-P") != string::npos) {
|
||||||
option.find('P') != string::npos) {
|
|
||||||
dumpCdmProperties = true;
|
dumpCdmProperties = true;
|
||||||
|
} else if (option.find("-h") != string::npos ||
|
||||||
|
option.find("-H") != string::npos) {
|
||||||
|
printUsage(fd);
|
||||||
|
} else {
|
||||||
|
dprintf(fd, "Invalid arg: %s\n", option.c_str());
|
||||||
|
printUsage(fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dumpCdmMetrics) printCdmMetrics(fd);
|
if (dumpCdmMetrics) printCdmMetrics(fd);
|
||||||
if (dumpCdmProperties) printCdmProperties(fd);
|
if (dumpCdmProperties) printCdmProperties(fd);
|
||||||
fsync(fd);
|
fsync(fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user