diff --git a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java index 9c6a44a..ba10e5e 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java @@ -180,6 +180,10 @@ public class PerformanceManagerService extends SystemService { "setPowerProfileInternal(profile=%d, fromUser=%b)", profile, fromUser)); } + if (mPm == null) { + Slog.e(TAG, "System is not ready, dropping profile request"); + return false; + } if (profile < 0 || profile > mNumProfiles) { Slog.e(TAG, "Invalid profile: " + profile); return false; @@ -248,6 +252,12 @@ public class PerformanceManagerService extends SystemService { } private void cpuBoostInternal(int duration) { + synchronized (PerformanceManagerService.this) { + if (mPm == null) { + Slog.e(TAG, "System is not ready, dropping cpu boost request"); + return; + } + } if (duration > 0 && duration <= MAX_CPU_BOOST_TIME) { // Don't send boosts if we're in another power profile if (mCurrentProfile == PerformanceManager.PROFILE_POWER_SAVE || @@ -325,6 +335,12 @@ public class PerformanceManagerService extends SystemService { @Override public void launchBoost(int pid, String packageName) { + synchronized (PerformanceManagerService.this) { + if (mPm == null) { + Slog.e(TAG, "System is not ready, dropping launch boost request"); + return; + } + } // Don't send boosts if we're in another power profile if (mCurrentProfile == PerformanceManager.PROFILE_POWER_SAVE || mCurrentProfile == PerformanceManager.PROFILE_HIGH_PERFORMANCE) {