summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-19 03:10:17 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-03-19 03:10:17 +0000
commit559fcefc990bb382c88ed81fd3047b9cfa7ba7a7 (patch)
tree89bb0f4034a6627c7170cbcaeeeb34a01fffe0e5
parentaf6a7821c55855d57e1f1018290973fbf52b8dc6 (diff)
parent3c76b21da05c5bd31f2fd841de5d0557063fd5ea (diff)
downloadinterfaces-559fcefc990bb382c88ed81fd3047b9cfa7ba7a7.tar.gz
Snap for 8323531 from 3c76b21da05c5bd31f2fd841de5d0557063fd5ea to tm-release
Change-Id: Icd3e1a13d5934ec0e4d20ec2a031e3b99764432c
-rw-r--r--suspend/1.0/default/WakeLockEntryList.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/suspend/1.0/default/WakeLockEntryList.cpp b/suspend/1.0/default/WakeLockEntryList.cpp
index d0bb1ce..a5b1de5 100644
--- a/suspend/1.0/default/WakeLockEntryList.cpp
+++ b/suspend/1.0/default/WakeLockEntryList.cpp
@@ -18,10 +18,15 @@
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/parseint.h>
+#include <android-base/stringprintf.h>
#include <iomanip>
+using android::base::ParseInt;
using android::base::ReadFdToString;
+using android::base::Readlink;
+using android::base::StringPrintf;
namespace android {
namespace system {
@@ -258,7 +263,17 @@ WakeLockInfo WakeLockEntryList::createKernelEntry(const std::string& kwlId) cons
continue;
}
- int64_t statVal = std::stoll(valStr);
+ int64_t statVal;
+ if (!ParseInt(valStr, &statVal)) {
+ std::string path;
+ if (Readlink(StringPrintf("/proc/self/fd/%d", statFd.get()), &path)) {
+ LOG(ERROR) << "Unexpected format for wakelock stat value (" << valStr
+ << ") from file: " << path;
+ } else {
+ LOG(ERROR) << "Unexpected format for wakelock stat value (" << valStr << ")";
+ }
+ continue;
+ }
if (statName == "active_count") {
info.activeCount = statVal;