PerformanceManager : Ensure we clear calling identity

When going from perfmanager -> powermanager we need to clear the calling
identity otherwise you get :

Bad call: specified package android under uid 10031 but it is really 1000

CYNGNOS-786

Change-Id: Iacd310f56d6538b0f7a4779f89b4451f6a203c5b
This commit is contained in:
Danesh M 2016-02-16 18:01:06 -08:00 committed by Gerrit Code Review
parent 9c902f898e
commit 61afdc1fd7

View File

@ -189,11 +189,18 @@ public class PerformanceManagerService extends SystemService {
if (profile == PerformanceManager.PROFILE_POWER_SAVE) { if (profile == PerformanceManager.PROFILE_POWER_SAVE) {
// Handle the case where toggle power saver mode // Handle the case where toggle power saver mode
// failed // failed
long token = Binder.clearCallingIdentity();
try {
if (!mPm.setPowerSaveMode(true)) { if (!mPm.setPowerSaveMode(true)) {
return false; return false;
} }
} finally {
Binder.restoreCallingIdentity(token);
}
} else if (mCurrentProfile == PerformanceManager.PROFILE_POWER_SAVE) { } else if (mCurrentProfile == PerformanceManager.PROFILE_POWER_SAVE) {
long token = Binder.clearCallingIdentity();
mPm.setPowerSaveMode(false); mPm.setPowerSaveMode(false);
Binder.restoreCallingIdentity(token);
} }
} }