Add auto restriction preference

1. Add method in feature provider to check whether smart battery
is supported
2. Hook up above method to controllers
3. Add auto restriction preference
4. Add tests

Bug: 73002171
Test: RunSettingsRoboTests
Change-Id: Ic314f61ad52e9bedb629b308731cb968bb4b1773
This commit is contained in:
jackqdyulei
2018-03-06 10:28:29 -08:00
committed by jackqdyulei
parent d0bd7e7d46
commit ab0b0add0a
9 changed files with 242 additions and 5 deletions

View File

@@ -4898,6 +4898,11 @@
<item quantity="other">%1$d apps</item>
</plurals>
<!-- Title for auto restriction toggle -->
<string name="battery_auto_restriction_title">Restrict apps automatically</string>
<!-- Summary for auto restriction toggle -->
<string name="battery_auto_restriction_summary">Prevent apps from using extra battery in the background</string>
<!-- Title for force stop dialog [CHAR LIMIT=30] -->
<string name="dialog_stop_title">Stop app?</string>
<!-- Message body for force stop dialog [CHAR LIMIT=NONE] -->

View File

@@ -15,7 +15,9 @@
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto"
android:key="smart_battery_detail"
android:title="@string/smart_battery_manager_title">
@@ -32,6 +34,12 @@
android:title="@string/smart_battery_title"
android:summary="@string/smart_battery_summary"/>
<SwitchPreference
android:key="auto_restriction"
android:title="@string/battery_auto_restriction_title"
android:summary="@string/battery_auto_restriction_summary"
settings:controller="com.android.settings.fuelgauge.AutoRestrictionPreferenceController"/>
<Preference
android:key="restricted_app"
android:title="@string/restricted_app_title"/>