lshal: read binder stats from binderfs
If binderfs is mounted, lshal should read binder stats
from /dev/binderfs/binder_logs instead of debugfs.
Test: atest lshal_test, adb shell lshal
Change-Id: Id585cdcd71c0ab4346045a099c2e3d0ddffcecc0
diff --git a/cmds/lshal/ListCommand.cpp b/cmds/lshal/ListCommand.cpp
index a7ccf64..f426dbb 100644
--- a/cmds/lshal/ListCommand.cpp
+++ b/cmds/lshal/ListCommand.cpp
@@ -206,9 +206,12 @@
static bool scanBinderContext(pid_t pid,
const std::string &contextName,
std::function<void(const std::string&)> eachLine) {
- std::ifstream ifs("/d/binder/proc/" + std::to_string(pid));
+ std::ifstream ifs("/dev/binderfs/binder_logs/proc/" + std::to_string(pid));
if (!ifs.is_open()) {
- return false;
+ ifs.open("/d/binder/proc/" + std::to_string(pid));
+ if (!ifs.is_open()) {
+ return false;
+ }
}
static const std::regex kContextLine("^context (\\w+)$");