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) {
// Handle the case where toggle power saver mode
// failed
if (!mPm.setPowerSaveMode(true)) {
return false;
long token = Binder.clearCallingIdentity();
try {
if (!mPm.setPowerSaveMode(true)) {
return false;
}
} finally {
Binder.restoreCallingIdentity(token);
}
} else if (mCurrentProfile == PerformanceManager.PROFILE_POWER_SAVE) {
long token = Binder.clearCallingIdentity();
mPm.setPowerSaveMode(false);
Binder.restoreCallingIdentity(token);
}
}