diff options
author | 2024-05-21 15:06:29 -0700 | |
---|---|---|
committer | 2024-06-27 12:04:32 -0700 | |
commit | 1d46f58320055b7aad551b92827bf3405258f25e (patch) | |
tree | c32caea58d088c49f3a1a51d8b880717fb9694d1 /libs/binder/ActivityManager.cpp | |
parent | 5e1cbe06681051d7e121364b36469acbdb24fdbe (diff) |
Migrate from libutils SystemClock.h to std::chrono
Bug: 341997808
Test: mma
Change-Id: Ib4d60eeaaac73566cc79d473f6551e9abd20e69a
Diffstat (limited to 'libs/binder/ActivityManager.cpp')
-rw-r--r-- | libs/binder/ActivityManager.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/libs/binder/ActivityManager.cpp b/libs/binder/ActivityManager.cpp index 526427663b..98349c6ab3 100644 --- a/libs/binder/ActivityManager.cpp +++ b/libs/binder/ActivityManager.cpp @@ -23,10 +23,10 @@ #include <binder/IServiceManager.h> #include <binder/ProcessState.h> -#include <utils/SystemClock.h> - namespace android { +using namespace std::chrono_literals; + ActivityManager::ActivityManager() { } @@ -43,15 +43,16 @@ sp<IActivityManager> ActivityManager::getService() } } else { ALOGI("Thread pool not started. Polling for activity service."); - int64_t startTime = 0; + auto startTime = std::chrono::steady_clock::now().min(); while (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->checkService(String16("activity")); if (binder == nullptr) { // Wait for the activity service to come back... - if (startTime == 0) { - startTime = uptimeMillis(); + if (startTime == startTime.min()) { + startTime = std::chrono::steady_clock::now(); ALOGI("Waiting for activity service"); - } else if ((uptimeMillis() - startTime) > 1000000) { + } else if (std::chrono::steady_clock::now() - startTime > 1000s) { + // TODO(b/342453147): timeout of 1000s = 16min and 40s doesn't seem intended ALOGW("Waiting too long for activity service, giving up"); service = nullptr; break; |