summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2021-08-30 15:41:44 -0700
committerSteven Moreland <smoreland@google.com>2021-08-30 15:41:44 -0700
commit3ba4963f5baf1c9a3a461f1c6a0caa7fb65aa6db (patch)
treecfb72ea3ef2307971f0ffced712260aa8b19a689
parenta9edeed6affcf3b1b77989f1e0aa73220d31fe94 (diff)
downloadnative-3ba4963f5baf1c9a3a461f1c6a0caa7fb65aa6db.tar.gz
libbinder: uptimeMillis returns int64_t!
This was limiting device uptime to ~1 month. Certainly, devices should update more frequently, but that decision should not be because of ubsan! This is a partial copy of the change Ifa00c32ee184795b03e16b39ac70ff41ebf00331 here. Bug: 197336441 Test: TH Merged-In: Ifa00c32ee184795b03e16b39ac70ff41ebf00331 Change-Id: Ib9f3e63e968ac77f0f6ea6447d586db588e9dbe4
-rw-r--r--libs/binder/IServiceManager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/binder/IServiceManager.cpp b/libs/binder/IServiceManager.cpp
index 4896f68f06..034d5a4a24 100644
--- a/libs/binder/IServiceManager.cpp
+++ b/libs/binder/IServiceManager.cpp
@@ -148,7 +148,8 @@ public:
const bool isVendorService =
strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder") == 0;
- const long timeout = uptimeMillis() + 5000;
+ const long timeout = 5000;
+ int64_t startTime = uptimeMillis();
if (!gSystemBootCompleted && !isVendorService) {
// Vendor code can't access system properties
char bootCompleted[PROPERTY_VALUE_MAX];
@@ -159,7 +160,7 @@ public:
const long sleepTime = gSystemBootCompleted ? 1000 : 100;
int n = 0;
- while (uptimeMillis() < timeout) {
+ while (uptimeMillis() - startTime < timeout) {
n++;
if (isVendorService) {
ALOGI("Waiting for vendor service %s...", String8(name).string());