Cherish: Introduce automated Sleep Mode [3/3]

Inspierd by Havoc-OS

https://github.com/Havoc-OS/android_packages_apps_ConfigCenter/commit/f8f0c586

Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
SKULSHADY
2021-08-07 08:52:07 +09:00
committed by Hưng Phan
parent 9bc17d726b
commit 2ee9aec4f9
6 changed files with 580 additions and 0 deletions

View File

@@ -1373,4 +1373,21 @@
<item>3</item>
<item>4</item>
</string-array>
<!-- Sleep Mode -->
<string-array name="sleep_mode_auto_mode_entries">
<item>@string/night_display_auto_mode_never</item>
<item>@string/night_display_auto_mode_twilight</item>
<item>@string/sleep_mode_schedule_mixed_sunset</item>
<item>@string/sleep_mode_schedule_mixed_sunrise</item>
<item>@string/night_display_auto_mode_custom</item>
</string-array>
<string-array name="sleep_mode_auto_mode_values" translatable="false">
<item>0</item>
<item>1</item>
<item>3</item>
<item>4</item>
<item>2</item>
</string-array>
</resources>

View File

@@ -1341,4 +1341,27 @@
<!-- Radio informations -->
<string name="radio_info_title">Radio info</string>
<!-- Sleep Mode -->
<string name="sleep_mode_title">Sleep Mode</string>
<string name="sleep_mode_schedule_sunset">Sunset</string>
<string name="sleep_mode_schedule_sunrise">Sunrise</string>
<string name="sleep_mode_schedule_mixed_sunset">Turns on from sunset to a custom time</string>
<string name="sleep_mode_schedule_mixed_sunrise">Turns on from a custom time to sunrise</string>
<string name="sleep_mode_toggles_title">Toggles</string>
<string name="sleep_mode_wifi_toggle_title">Turn off Wi-Fi</string>
<string name="sleep_mode_wifi_toggle_summary">Disable Wi-Fi when Sleep mode is turned on</string>
<string name="sleep_mode_bluetooth_toggle_title">Turn off Bluetooth</string>
<string name="sleep_mode_bluetooth_toggle_summary">Disable Bluetooth when Sleep mode is turned on</string>
<string name="sleep_mode_cellular_toggle_title">Turn off Mobile data</string>
<string name="sleep_mode_cellular_toggle_summary">Disable Mobile data when Sleep mode is turned on</string>
<string name="sleep_mode_location_toggle_title">Turn off Location</string>
<string name="sleep_mode_location_toggle_summary">Disable Location when Sleep mode is turned on</string>
<string name="sleep_mode_sensors_toggle_title">Turn off Sensors</string>
<string name="sleep_mode_sensors_toggle_summary">Disable Sensors when Sleep mode is turned on</string>
<string name="sleep_mode_aod_toggle_title">Turn off AOD</string>
<string name="sleep_mode_aod_toggle_summary">Disable Always on display when Sleep mode is turned on</string>
<string name="sleep_mode_aggressive_toggle_title">Turn on Aggressive Battery</string>
<string name="sleep_mode_aggressive_toggle_summary">Enable Aggressive idle and standby when Sleep mode is turned on</string>
<string name="sleep_mode_display_text">Sleep mode allows you to disable certain services to help save battery and silence your phone while you sleep.</string>
</resources>

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 Havoc-OS
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"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/sleep_mode_title">
<DropDownPreference
android:key="sleep_mode_auto_mode"
android:title="@string/night_display_auto_mode_title"
android:entries="@array/sleep_mode_auto_mode_entries"
android:entryValues="@array/sleep_mode_auto_mode_values"
android:persistent="false" />
<Preference
android:key="sleep_mode_auto_since"
android:title="@string/night_display_start_time_title" />
<Preference
android:key="sleep_mode_auto_till"
android:title="@string/night_display_end_time_title" />
<PreferenceCategory
android:key="sleep_mode_toggles"
android:title="@string/sleep_mode_toggles_title">
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_wifi_toggle"
android:title="@string/sleep_mode_wifi_toggle_title"
android:summary="@string/sleep_mode_wifi_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_bluetooth_toggle"
android:title="@string/sleep_mode_bluetooth_toggle_title"
android:summary="@string/sleep_mode_bluetooth_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_cellular_toggle"
android:title="@string/sleep_mode_cellular_toggle_title"
android:summary="@string/sleep_mode_cellular_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_location_toggle"
android:title="@string/sleep_mode_location_toggle_title"
android:summary="@string/sleep_mode_location_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_sensors_toggle"
android:title="@string/sleep_mode_sensors_toggle_title"
android:summary="@string/sleep_mode_sensors_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_aod_toggle"
android:title="@string/sleep_mode_aod_toggle_title"
android:summary="@string/sleep_mode_aod_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingSwitchPreference
android:key="sleep_mode_aggressive_toggle"
android:title="@string/sleep_mode_aggressive_toggle_title"
android:summary="@string/sleep_mode_aggressive_toggle_summary"
android:defaultValue="true" />
<com.cherish.settings.preferences.SecureSettingListPreference
android:key="sleep_mode_ringer_mode"
android:title="@string/gaming_mode_ringer_title"
android:entries="@array/gaming_mode_ringer_entries"
android:entryValues="@array/gaming_mode_ringer_values"
android:defaultValue="0"
android:summary="%s" />
</PreferenceCategory>
<com.android.settingslib.widget.LayoutPreference
android:key="sleep_mode_button"
android:title="@string/sleep_mode_title"
android:selectable="false"
android:layout="@layout/sleep_mode_activation_button"
settings:allowDividerAbove="true"
settings:allowDividerBelow="true" />
<com.android.settingslib.widget.FooterPreference
android:key="sleep_mode_footer"
android:title="@string/sleep_mode_display_text"
android:selectable="false"
settings:searchable="false"/>
</PreferenceScreen>