Merge "PowerManagerService: open power HAL less aggressively" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
ebf8ae5f44
@@ -57,6 +57,7 @@ static struct {
|
|||||||
|
|
||||||
static jobject gPowerManagerServiceObj;
|
static jobject gPowerManagerServiceObj;
|
||||||
sp<IPower> gPowerHal = nullptr;
|
sp<IPower> gPowerHal = nullptr;
|
||||||
|
bool gPowerHalExists = true;
|
||||||
std::mutex gPowerHalMutex;
|
std::mutex gPowerHalMutex;
|
||||||
static nsecs_t gLastEventTime[USER_ACTIVITY_EVENT_LAST + 1];
|
static nsecs_t gLastEventTime[USER_ACTIVITY_EVENT_LAST + 1];
|
||||||
|
|
||||||
@@ -78,12 +79,13 @@ static bool checkAndClearExceptionFromCallback(JNIEnv* env, const char* methodNa
|
|||||||
// Check validity of current handle to the power HAL service, and call getService() if necessary.
|
// Check validity of current handle to the power HAL service, and call getService() if necessary.
|
||||||
// The caller must be holding gPowerHalMutex.
|
// The caller must be holding gPowerHalMutex.
|
||||||
bool getPowerHal() {
|
bool getPowerHal() {
|
||||||
if (gPowerHal == nullptr) {
|
if (gPowerHalExists && gPowerHal == nullptr) {
|
||||||
gPowerHal = IPower::getService();
|
gPowerHal = IPower::getService();
|
||||||
if (gPowerHal != nullptr) {
|
if (gPowerHal != nullptr) {
|
||||||
ALOGI("Loaded power HAL service");
|
ALOGI("Loaded power HAL service");
|
||||||
} else {
|
} else {
|
||||||
ALOGI("Couldn't load power HAL service");
|
ALOGI("Couldn't load power HAL service");
|
||||||
|
gPowerHalExists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return gPowerHal != nullptr;
|
return gPowerHal != nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user