Loading libs/binder/IServiceManager.cpp +26 −10 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <binder/IPermissionController.h> #endif #include <binder/Parcel.h> #include <cutils/properties.h> #include <utils/String8.h> #include <utils/SystemClock.h> #include <utils/CallStack.h> Loading Loading @@ -142,20 +143,35 @@ public: virtual sp<IBinder> getService(const String16& name) const { unsigned n; for (n = 0; n < 5; n++){ if (n > 0) { if (!strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder")) { sp<IBinder> svc = checkService(name); if (svc != NULL) return svc; const bool isVendorService = strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder") == 0; const long timeout = uptimeMillis() + 5000; if (!gSystemBootCompleted) { char bootCompleted[PROPERTY_VALUE_MAX]; property_get("sys.boot_completed", bootCompleted, "0"); gSystemBootCompleted = strcmp(bootCompleted, "1") == 0 ? true : false; } // retry interval in millisecond. const long sleepTime = gSystemBootCompleted ? 1000 : 100; int n = 0; while (uptimeMillis() < timeout) { n++; if (isVendorService) { ALOGI("Waiting for vendor service %s...", String8(name).string()); CallStack stack(LOG_TAG); } else { } else if (n%10 == 0) { ALOGI("Waiting for service %s...", String8(name).string()); } sleep(1); } usleep(1000*sleepTime); sp<IBinder> svc = checkService(name); if (svc != NULL) return svc; } ALOGW("Service %s didn't start. Returning NULL", String8(name).string()); return NULL; } Loading libs/binder/Static.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,6 @@ sp<IServiceManager> gDefaultServiceManager; #ifndef __ANDROID_VNDK__ sp<IPermissionController> gPermissionController; #endif bool gSystemBootCompleted = false; } // namespace android libs/binder/include/private/binder/Static.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,5 +41,6 @@ extern sp<IServiceManager> gDefaultServiceManager; #ifndef __ANDROID_VNDK__ extern sp<IPermissionController> gPermissionController; #endif extern bool gSystemBootCompleted; } // namespace android Loading
libs/binder/IServiceManager.cpp +26 −10 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <binder/IPermissionController.h> #endif #include <binder/Parcel.h> #include <cutils/properties.h> #include <utils/String8.h> #include <utils/SystemClock.h> #include <utils/CallStack.h> Loading Loading @@ -142,20 +143,35 @@ public: virtual sp<IBinder> getService(const String16& name) const { unsigned n; for (n = 0; n < 5; n++){ if (n > 0) { if (!strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder")) { sp<IBinder> svc = checkService(name); if (svc != NULL) return svc; const bool isVendorService = strcmp(ProcessState::self()->getDriverName().c_str(), "/dev/vndbinder") == 0; const long timeout = uptimeMillis() + 5000; if (!gSystemBootCompleted) { char bootCompleted[PROPERTY_VALUE_MAX]; property_get("sys.boot_completed", bootCompleted, "0"); gSystemBootCompleted = strcmp(bootCompleted, "1") == 0 ? true : false; } // retry interval in millisecond. const long sleepTime = gSystemBootCompleted ? 1000 : 100; int n = 0; while (uptimeMillis() < timeout) { n++; if (isVendorService) { ALOGI("Waiting for vendor service %s...", String8(name).string()); CallStack stack(LOG_TAG); } else { } else if (n%10 == 0) { ALOGI("Waiting for service %s...", String8(name).string()); } sleep(1); } usleep(1000*sleepTime); sp<IBinder> svc = checkService(name); if (svc != NULL) return svc; } ALOGW("Service %s didn't start. Returning NULL", String8(name).string()); return NULL; } Loading
libs/binder/Static.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -97,5 +97,6 @@ sp<IServiceManager> gDefaultServiceManager; #ifndef __ANDROID_VNDK__ sp<IPermissionController> gPermissionController; #endif bool gSystemBootCompleted = false; } // namespace android
libs/binder/include/private/binder/Static.h +1 −0 Original line number Diff line number Diff line Loading @@ -41,5 +41,6 @@ extern sp<IServiceManager> gDefaultServiceManager; #ifndef __ANDROID_VNDK__ extern sp<IPermissionController> gPermissionController; #endif extern bool gSystemBootCompleted; } // namespace android