Loading libs/binder/ActivityManager.cpp +26 −16 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <binder/ActivityManager.h> #include <binder/Binder.h> #include <binder/IServiceManager.h> #include <binder/ProcessState.h> #include <utils/SystemClock.h> Loading @@ -33,8 +34,16 @@ ActivityManager::ActivityManager() sp<IActivityManager> ActivityManager::getService() { std::lock_guard<Mutex> scoped_lock(mLock); int64_t startTime = 0; sp<IActivityManager> service = mService; if (ProcessState::self()->isThreadPoolStarted()) { if (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->waitForService(String16("activity")); service = interface_cast<IActivityManager>(binder); mService = service; } } else { ALOGI("Thread pool not started. Polling for activity service."); int64_t startTime = 0; while (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->checkService(String16("activity")); if (binder == nullptr) { Loading @@ -53,7 +62,8 @@ sp<IActivityManager> ActivityManager::getService() mService = service; } } return service; } return mService; } int ActivityManager::openContentUri(const String16& stringUri) Loading Loading
libs/binder/ActivityManager.cpp +26 −16 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <binder/ActivityManager.h> #include <binder/Binder.h> #include <binder/IServiceManager.h> #include <binder/ProcessState.h> #include <utils/SystemClock.h> Loading @@ -33,8 +34,16 @@ ActivityManager::ActivityManager() sp<IActivityManager> ActivityManager::getService() { std::lock_guard<Mutex> scoped_lock(mLock); int64_t startTime = 0; sp<IActivityManager> service = mService; if (ProcessState::self()->isThreadPoolStarted()) { if (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->waitForService(String16("activity")); service = interface_cast<IActivityManager>(binder); mService = service; } } else { ALOGI("Thread pool not started. Polling for activity service."); int64_t startTime = 0; while (service == nullptr || !IInterface::asBinder(service)->isBinderAlive()) { sp<IBinder> binder = defaultServiceManager()->checkService(String16("activity")); if (binder == nullptr) { Loading @@ -53,7 +62,8 @@ sp<IActivityManager> ActivityManager::getService() mService = service; } } return service; } return mService; } int ActivityManager::openContentUri(const String16& stringUri) Loading