From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Adin Kwok Date: Mon, 1 May 2023 13:44:31 +0800 Subject: [PATCH] Settings: Smart Pixels [2/2] Change-Id: If67dec0722412ba12f13673dfc007673bef965b9 Signed-off-by: Anushek Prasal --- res/values/arrays.xml | 45 ++++++++++++++ res/values/strings.xml | 21 +++++++ res/xml/battery_saver_settings.xml | 7 +++ res/xml/smart_pixels_settings.xml | 54 +++++++++++++++++ .../batterysaver/SmartPixelsSettings.java | 59 +++++++++++++++++++ 5 files changed, 186 insertions(+) create mode 100644 res/xml/smart_pixels_settings.xml create mode 100644 src/com/android/settings/fuelgauge/batterysaver/SmartPixelsSettings.java diff --git a/res/values/arrays.xml b/res/values/arrays.xml index bf3b7eb343..7725c5306e 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -1291,6 +1291,51 @@ 100 + + + 12 + 25 + 38 + 50 + 62 + 75 + 88 + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + + + + @string/smart_pixels_shift_timeout_summary_15secs + @string/smart_pixels_shift_timeout_summary_30secs + @string/smart_pixels_shift_timeout_summary_1min + @string/smart_pixels_shift_timeout_summary_2mins + @string/smart_pixels_shift_timeout_summary_5mins + @string/smart_pixels_shift_timeout_summary_10mins + @string/smart_pixels_shift_timeout_summary_20mins + @string/smart_pixels_shift_timeout_summary_30mins + @string/smart_pixels_shift_timeout_summary_1hour + + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + Normal diff --git a/res/values/strings.xml b/res/values/strings.xml index 2543ef0677..55937bafe2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -14617,4 +14617,25 @@ Force disable Secure User Plane Location (SUPL) Always disable SUPL assisted location support regardless of carrier configuration or emergency call status (does not disable control plane A-GNSS and DivestOS does not send IMSI to the SUPL) + + + Smart Pixels is a power saving feature. It turns off pixels to reduce power consumption. Depending on how many pixels you decide to turn off, you could see improvement in battery life. Note that in some cases it can result in unresponsive areas on touch screen. + Smart Pixels + Save battery by shutting off extra pixels + Enable Smart Pixels + Auto-enable on battery saver + Enable automatically when battery saver is turned on + Percent of pixels to disable + Burn-in protection + Prevents burn-in on OLED devices by shifting pixels every so often + + 15 seconds + 30 seconds + 1 minute + 2 minutes + 5 minutes + 10 minutes + 20 minutes + 30 minutes + 1 hour diff --git a/res/xml/battery_saver_settings.xml b/res/xml/battery_saver_settings.xml index 52b8b1acb9..df6fc998e4 100644 --- a/res/xml/battery_saver_settings.xml +++ b/res/xml/battery_saver_settings.xml @@ -42,6 +42,13 @@ settings:keywords="@string/keywords_battery_saver_sticky" settings:controller="com.android.settings.fuelgauge.batterysaver.BatterySaverStickyPreferenceController"/> + + + + + + + + + + + + + + + diff --git a/src/com/android/settings/fuelgauge/batterysaver/SmartPixelsSettings.java b/src/com/android/settings/fuelgauge/batterysaver/SmartPixelsSettings.java new file mode 100644 index 0000000000..e34ec3c049 --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterysaver/SmartPixelsSettings.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2023 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. + */ + +package com.android.settings.fuelgauge.batterysaver; + +import android.app.settings.SettingsEnums; +import android.content.Context; +import android.content.ContentResolver; +import android.content.res.Resources; +import android.net.Uri; +import android.os.Bundle; +import android.os.Handler; +import android.os.UserHandle; +import android.provider.Settings; + +import androidx.preference.ListPreference; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; +import androidx.preference.Preference.OnPreferenceChangeListener; +import androidx.preference.SwitchPreference; + +import com.android.internal.logging.nano.MetricsProto; +import com.android.settings.R; +import com.android.settings.SettingsPreferenceFragment; + +public class SmartPixelsSettings extends SettingsPreferenceFragment { + + private static final String TAG = "SmartPixels"; + + private static final String SMART_PIXELS_FOOTER = "smart_pixels_footer"; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.smart_pixels_settings); + + findPreference(SMART_PIXELS_FOOTER).setTitle(R.string.smart_pixels_warning_text); + } + + @Override + public int getMetricsCategory() { + return SettingsEnums.OPEN_BATTERY_SAVER; + } +} +