diff options
author | Adnan Begovic <adnan@cyngn.com> | 2016-03-07 11:49:52 -0800 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2016-03-08 09:24:34 -0800 |
commit | b4eafda7de11276522946d13e5860652aacccd4c (patch) | |
tree | 5e3a59391df818e0e05e9edf188b58c74389c417 /cm | |
parent | 7ed4fcaf8e51bfa2d8c3d1a0ca16c9250eac271d (diff) | |
download | vendor_cmsdk-b4eafda7de11276522946d13e5860652aacccd4c.zip vendor_cmsdk-b4eafda7de11276522946d13e5860652aacccd4c.tar.gz vendor_cmsdk-b4eafda7de11276522946d13e5860652aacccd4c.tar.bz2 |
cmsdk: Add PerformanceManager tests, Change target permission.
Since PerformanceManager is strictly a CyanogenMod construct,
it doesn't make sense to enforce the interfaces with an android
specific permission (even though the implementation is delegated
to power manager). To keep consistency with the other api's,
modify the enforcing permission to a cm specific declaration.
Also add test cases for the PerformanceManager public interfaces.
Change-Id: I430b69dbee73bf94bb60932d1942ab97e3ba193e
Diffstat (limited to 'cm')
-rw-r--r-- | cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java | 6 | ||||
-rw-r--r-- | cm/res/AndroidManifest.xml | 33 | ||||
-rw-r--r-- | cm/res/res/values/strings.xml | 4 |
3 files changed, 28 insertions, 15 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 d4e8403..4b03ba0 100644 --- a/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java +++ b/cm/lib/main/java/org/cyanogenmod/platform/internal/PerformanceManagerService.java @@ -218,12 +218,14 @@ public class PerformanceManagerService extends SystemService { return false; } - mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DEVICE_POWER, null); + // Enforce the performance access permission declared by cm's res package + mContext.enforceCallingOrSelfPermission( + cyanogenmod.platform.Manifest.permission.PERFORMANCE_ACCESS, null); long token = Binder.clearCallingIdentity(); mCurrentProfile = profile; - + mHandler.removeMessages(MSG_CPU_BOOST); mHandler.removeMessages(MSG_LAUNCH_BOOST); mHandler.sendMessage( diff --git a/cm/res/AndroidManifest.xml b/cm/res/AndroidManifest.xml index b5e6f74..eb4ee81 100644 --- a/cm/res/AndroidManifest.xml +++ b/cm/res/AndroidManifest.xml @@ -133,10 +133,10 @@ <!-- Permission for adding/removing applications to protected apps <p>Not for use by third-party applications. --> <permission - android:name="cyanogenmod.permission.PROTECTED_APP" - android:label="@string/permlab_protectedApp" - android:description="@string/permdesc_protectedApp" - android:protectionLevel="signature|privileged" /> + android:name="cyanogenmod.permission.PROTECTED_APP" + android:label="@string/permlab_protectedApp" + android:description="@string/permdesc_protectedApp" + android:protectionLevel="signature|privileged" /> <!-- Allows an application to be used as a third party keyguard --> <permission android:name="android.permission.THIRD_PARTY_KEYGUARD" @@ -146,24 +146,31 @@ <!-- Allows an application to use ThemeManager --> <permission android:name="cyanogenmod.permission.ACCESS_THEME_MANAGER" - android:label="@string/permlab_accessThemeService" - android:description="@string/permdesc_accessThemeService" - android:protectionLevel="normal" /> + android:label="@string/permlab_accessThemeService" + android:description="@string/permdesc_accessThemeService" + android:protectionLevel="normal" /> <!-- Allows an application to read the current theme configuration and get information about the various themes currently installed --> <permission android:name="cyanogenmod.permission.READ_THEMES" - android:label="@string/permlab_readThemes" - android:description="@string/permdesc_readThemesDesc" - android:protectionLevel="normal" /> + android:label="@string/permlab_readThemes" + android:description="@string/permdesc_readThemesDesc" + android:protectionLevel="normal" /> <!-- Allows an application to write the current theme configuration and write information about the various themes currently installed. Changing themes should be done through the service ACCESS_THEME_MANAGER --> <permission android:name="cyanogenmod.permission.WRITE_THEMES" - android:label="@string/permlab_writeThemes" - android:description="@string/permdesc_writeThemesDesc" - android:protectionLevel="normal" /> + android:label="@string/permlab_writeThemes" + android:description="@string/permdesc_writeThemesDesc" + android:protectionLevel="normal" /> + + <!-- Allows low-level access to performance management. + <p>Not for use by third-party applications. --> + <permission android:name="cyanogenmod.permission.PERFORMANCE_ACCESS" + android:label="@string/permlab_perfAccess" + android:description="@string/permdesc_perfAccessDesc" + android:protectionLevel="signature|privileged" /> <application android:process="system" android:persistent="true" diff --git a/cm/res/res/values/strings.xml b/cm/res/res/values/strings.xml index 6feeb3f..6f981d3 100644 --- a/cm/res/res/values/strings.xml +++ b/cm/res/res/values/strings.xml @@ -161,4 +161,8 @@ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. --> <string name="permdesc_writeThemesDesc">Allows the app to insert new themes and modify which theme you have applied.</string> + <!-- Performance manager permission title --> + <string name="permlab_perfAccess">access performance manager</string> + <!-- Performance manager permission description --> + <string name="permlab_perfAccessDesc">Allows an app to access the performance service. Should never be needed for normal apps</string> </resources> |