aboutsummaryrefslogtreecommitdiffstats
path: root/cm
diff options
context:
space:
mode:
authorKhalid Zubair <kzubair@cyngn.com>2015-11-24 09:57:46 -0800
committerScott Mertz <scott@cyngn.com>2015-11-25 12:52:40 -0800
commit4a964c508ee2c225408bddeecd99081223061a0f (patch)
tree0767c9e44a5249ede47334a63a3be8e47b720d50 /cm
parent37b590928fc324a3b2dfba83cba6993855885b2b (diff)
downloadvendor_cmsdk-4a964c508ee2c225408bddeecd99081223061a0f.zip
vendor_cmsdk-4a964c508ee2c225408bddeecd99081223061a0f.tar.gz
vendor_cmsdk-4a964c508ee2c225408bddeecd99081223061a0f.tar.bz2
perf: Add PerformanceManager.getProfileHasAppProfiles API
Add an API to query PerformanceManager if a perf profile supports app-profiles. Change-Id: I51d958343624ab085de0352ac182cb05308e0da4
Diffstat (limited to 'cm')
-rw-r--r--cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java21
1 files changed, 19 insertions, 2 deletions
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 92a2322..85dc7c6 100644
--- a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java
+++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java
@@ -142,6 +142,19 @@ public class PerformanceManagerService extends SystemService {
CMSettings.Secure.APP_PERFORMANCE_PROFILES_ENABLED, 1) == 1);
}
+ private boolean getProfileHasAppProfilesInternal(int profile) {
+ if (profile < 0 || profile > mNumProfiles) {
+ Slog.e(TAG, "Invalid profile: " + profile);
+ return false;
+ }
+
+ if (profile == PerformanceManager.PROFILE_BALANCED) {
+ return mPatterns != null;
+ }
+
+ return false;
+ }
+
/**
* Get the profile saved by the user
*/
@@ -238,8 +251,7 @@ public class PerformanceManagerService extends SystemService {
} else {
profile = getUserProfile();
// use app specific rules if profile is balanced
- if (hasAppProfiles() &&
- profile == PerformanceManager.PROFILE_BALANCED) {
+ if (hasAppProfiles() && getProfileHasAppProfilesInternal(profile)) {
profile = getProfileForActivity(mCurrentActivityName);
}
}
@@ -274,6 +286,11 @@ public class PerformanceManagerService extends SystemService {
public int getNumberOfProfiles() {
return mNumProfiles;
}
+
+ @Override
+ public boolean getProfileHasAppProfiles(int profile) {
+ return getProfileHasAppProfilesInternal(profile);
+ }
};
private final class LocalService implements PerformanceManagerInternal {