Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be40850e authored by Zhao Wei Liew's avatar Zhao Wei Liew Committed by Steve Kondik
Browse files

CMParts: Add performance profile settings

Add the perf profiles and battery saver mode.

Based on the original work by the following people:
 - Steve Kondik
 - Khalid Zubair
 - Danesh Mondegarian

Based on the work in the following Settings commits:
f73dfe3308a245bde42cd8ec1a330f6e021e1a3f
8bc96242ae39bc3ff8dd98e208c242fda3c625ea
bfefa433030c98a449b74e1538e4a9af04d6d76a
e1a196a2afcc534db42492b0133f3c36a7c26de5

Change-Id: I24542ae38daec48f099bab7c51271c638047ed32
parent 63d9c6db
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
-keep class org.cyanogenmod.cmparts.input.*
-keep class org.cyanogenmod.cmparts.livedisplay.*
-keep class org.cyanogenmod.cmparts.notificationlight.*
-keep class org.cyanogenmod.cmparts.power.*
-keep class org.cyanogenmod.cmparts.privacyguard.*
-keep class org.cyanogenmod.cmparts.profiles.*

+17 −0
Original line number Diff line number Diff line
@@ -257,4 +257,21 @@
        <item>2</item>
    </string-array>

    <!-- Auto power save mode: Allowable trigger threshold entries -->
    <string-array name="auto_power_save_entries" translatable="false">
        <item>Never</item>
        <item>5%</item>
        <item>15%</item>
        <item>25%</item>
    </string-array>

    <!-- Auto power save mode: Allowable trigger threshold levels.
         Similar to the battery_saver_trigger_values integer-array in Settings -->
    <string-array name="auto_power_save_values" translatable="false">
        <item>0</item>
        <item>5</item>
        <item>15</item>
        <item>25</item>
    </string-array>

</resources>
+12 −0
Original line number Diff line number Diff line
@@ -531,4 +531,16 @@
    <string name="status_bar_show_weather_title">Show weather</string>
    <string name="status_bar_show_weather_summary">Display the current temperature on the status bar</string>

    <!-- Power: Performance profiles -->
    <string name="perf_profile_settings_title">Battery profiles</string>
    <string name="perf_profile_settings_summary">Tweak your device\'s performance to suit your needs</string>
    <string name="perf_profile_title">Battery profile</string>
    <string name="perf_profile_fail_toast">The battery profile is currently unavailable</string>
    <string name="power_save_title">Power save mode</string>
    <string name="power_save_summary">Restrict device performance and background activity to save power</string>
    <string name="auto_power_save_title">Battery saver</string>
    <string name="auto_power_save_summary_on">Automatically enable power save mode at %d percent battery</string>
    <string name="auto_power_save_summary_off">Never enable power save mode automatically</string>
    <string name="app_perf_profiles_title">Enable per-app profiles</string>
    <string name="app_perf_profiles_summary">Automatically choose an appropriate battery profile for various apps</string>
</resources>
+6 −0
Original line number Diff line number Diff line
@@ -93,4 +93,10 @@
          android:fragment="org.cyanogenmod.cmparts.weather.WeatherServiceSettings"
          cm:xmlRes="@xml/weather_settings" />

    <part android:key="perf_profile_settings"
          android:title="@string/perf_profile_settings_title"
          android:summary="@string/perf_profile_settings_summary"
          android:fragment="org.cyanogenmod.cmparts.power.PerfProfileSettings"
          cm:xmlRes="@xml/perf_profile_settings" />

</parts-catalog>
+43 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The CyanogenMod Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="perf_profile_settings"
    android:title="@string/perf_profile_settings_title" >

    <ListPreference
        android:key="perf_profile"
        android:title="@string/perf_profile_title"
        android:persistent="false" />

    <SwitchPreference
        android:key="power_save"
        android:title="@string/power_save_title"
        android:summary="@string/power_save_summary"
        android:persistent="false" />

    <ListPreference
        android:key="auto_power_save"
        android:title="@string/auto_power_save_title"
        android:persistent="false" />

    <cyanogenmod.preference.CMSecureSettingSwitchPreference
        android:key="app_perf_profiles_enabled"
        android:title="@string/app_perf_profiles_title"
        android:summary="@string/app_perf_profiles_summary" />

</PreferenceScreen>
Loading