20.0: Add "Smart Pixels" screen filter feature

never starts, missing something

de9aa33971
af0aa9c4c3

aa5684f586

not used
dbc6f643b9
50d3f972a9

Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
Tavi 2024-06-29 07:41:45 -04:00
parent d631c5dd63
commit c7c759afd4
No known key found for this signature in database
GPG Key ID: E599F62ECBAEAF2E
5 changed files with 1388 additions and 1 deletions

View File

@ -1030,7 +1030,7 @@ kernel/zuk/msm8996 cc57cb4ee3b7918b74d30604735d353b9a5fa23b
libcore 2a7d66adbcde1862f9295ae0a13f1751b193e4d7 libcore 2a7d66adbcde1862f9295ae0a13f1751b193e4d7
libnativehelper 49ecc5f1e97e810d27e2c6558abdde49e875349b libnativehelper 49ecc5f1e97e810d27e2c6558abdde49e875349b
lineage-sdk b0a28220c5d6d0d13d5a60da4a80538079721e30 lineage-sdk b0a28220c5d6d0d13d5a60da4a80538079721e30
lineage/scripts 1767a10e4e3b0a7dceb0f1c2b4d78825792d53f6 lineage/scripts 917a81e70ee73105c6f52eda9a9443becd7a8cdc
packages/apps/Aperture 5d68af56eb88d663c54f083b117ad9911daaf193 packages/apps/Aperture 5d68af56eb88d663c54f083b117ad9911daaf193
packages/apps/AudioFX 15e2a666d21551698ea0744996abcdc35e6c0cc1 packages/apps/AudioFX 15e2a666d21551698ea0744996abcdc35e6c0cc1
packages/apps/Backgrounds 3b5c676d5a2747e92b14a79707c0aa3a6339bd4f packages/apps/Backgrounds 3b5c676d5a2747e92b14a79707c0aa3a6339bd4f

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Pranav Vashi <neobuddy89@gmail.com>
Date: Sun, 7 Jul 2019 11:56:32 +0530
Subject: [PATCH] Fix long click intent for Smart Pixels tile [2/2]
Change-Id: Id6b5fffd814f035be1bb75d1434456e0c02aa97f
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
---
AndroidManifest.xml | 13 +++++++++++++
src/com/android/settings/Settings.java | 5 +++++
.../settings/core/gateway/SettingsGateway.java | 5 ++++-
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 86e73085a0..68787a7609 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -4573,6 +4573,19 @@
</intent-filter>
</activity>
+ <activity android:name=".Settings$SmartPixelsActivity"
+ android:label="@string/smart_pixels_title"
+ android:taskAffinity="com.android.settings"
+ android:exported="true"
+ android:parentActivityName="Settings">
+ <intent-filter android:priority="1">
+ <action android:name="android.settings.SMART_PIXELS_SETTINGS" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
+ android:value="com.android.settings.fuelgauge.batteryusage.SmartPixelsSettings" />
+ </activity>
+
<!-- This is the longest AndroidManifest.xml ever. -->
</application>
</manifest>
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 50ffdc720e..ae3cf86c29 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -448,4 +448,9 @@ public class Settings extends SettingsActivity {
* Activity for OneHandedSettings
*/
public static class OneHandedSettingsActivity extends SettingsActivity { /* empty */ }
+
+ /**
+ * Activity for SmartPixelsSettings
+ */
+ public static class SmartPixelsActivity extends SettingsActivity { /* empty */ }
}
diff --git a/src/com/android/settings/core/gateway/SettingsGateway.java b/src/com/android/settings/core/gateway/SettingsGateway.java
index dc746ce8e6..68952172d5 100644
--- a/src/com/android/settings/core/gateway/SettingsGateway.java
+++ b/src/com/android/settings/core/gateway/SettingsGateway.java
@@ -101,6 +101,7 @@ import com.android.settings.enterprise.EnterprisePrivacySettings;
import com.android.settings.fuelgauge.AdvancedPowerUsageDetail;
import com.android.settings.fuelgauge.batterysaver.BatterySaverScheduleSettings;
import com.android.settings.fuelgauge.batterysaver.BatterySaverSettings;
+import com.android.settings.fuelgauge.batterysaver.SmartPixelsSettings;
import com.android.settings.fuelgauge.batteryusage.PowerUsageSummary;
import com.android.settings.gestures.AssistGestureSettings;
import com.android.settings.gestures.ButtonNavigationSettingsFragment;
@@ -345,7 +346,8 @@ public class SettingsGateway {
MobileNetworkSettings.class.getName(),
AppLocaleDetails.class.getName(),
TurnScreenOnSettings.class.getName(),
- TurnScreenOnDetails.class.getName()
+ TurnScreenOnDetails.class.getName(),
+ SmartPixelsSettings.class.getName()
};
public static final String[] SETTINGS_FOR_RESTRICTED = {
@@ -388,5 +390,6 @@ public class SettingsGateway {
Settings.MyDeviceInfoActivity.class.getName(),
Settings.ModuleLicensesActivity.class.getName(),
UserBackupSettingsActivity.class.getName(),
+ Settings.SmartPixelsActivity.class.getName()
};
}

View File

@ -0,0 +1,246 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Adin Kwok <adin.kwok@carbonrom.org>
Date: Mon, 1 May 2023 13:44:31 +0800
Subject: [PATCH] Settings: Smart Pixels [2/2]
Change-Id: If67dec0722412ba12f13673dfc007673bef965b9
Signed-off-by: Anushek Prasal <anushekprasal@gmail.com>
---
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 @@
<item>100</item>
</integer-array>
+ <!-- Smart Pixels -->
+ <string-array name="smart_pixels_percent_strings" translatable="false">
+ <item>12</item>
+ <item>25</item>
+ <item>38</item>
+ <item>50</item>
+ <item>62</item>
+ <item>75</item>
+ <item>88</item>
+ </string-array>
+
+ <string-array name="smart_pixels_percent_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ </string-array>
+
+ <string-array name="smart_pixels_shift_times" translatable="false">
+ <item>@string/smart_pixels_shift_timeout_summary_15secs</item>
+ <item>@string/smart_pixels_shift_timeout_summary_30secs</item>
+ <item>@string/smart_pixels_shift_timeout_summary_1min</item>
+ <item>@string/smart_pixels_shift_timeout_summary_2mins</item>
+ <item>@string/smart_pixels_shift_timeout_summary_5mins</item>
+ <item>@string/smart_pixels_shift_timeout_summary_10mins</item>
+ <item>@string/smart_pixels_shift_timeout_summary_20mins</item>
+ <item>@string/smart_pixels_shift_timeout_summary_30mins</item>
+ <item>@string/smart_pixels_shift_timeout_summary_1hour</item>
+ </string-array>
+
+ <string-array name="smart_pixels_shift_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>7</item>
+ <item>8</item>
+ </string-array>
+
<!-- Process stats memory use details: labels for memory states -->
<string-array name="proc_stats_memory_states" >
<item>Normal</item>
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 @@
<string name="force_disable_supl_title">Force disable Secure User Plane Location (SUPL)</string>
<string name="force_disable_supl_summary">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)</string>
+
+ <!-- Smart Pixels -->
+ <string name="smart_pixels_warning_text">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.</string>
+ <string name="smart_pixels_title">Smart Pixels</string>
+ <string name="smart_pixels_summary">Save battery by shutting off extra pixels</string>
+ <string name="smart_pixels_enable_title">Enable Smart Pixels</string>
+ <string name="smart_pixels_on_power_save_title">Auto-enable on battery saver</string>
+ <string name="smart_pixels_on_power_save_summary">Enable automatically when battery saver is turned on</string>
+ <string name="smart_pixels_percent">Percent of pixels to disable</string>
+ <string name="smart_pixels_shift_title">Burn-in protection</string>
+ <string name="smart_pixels_shift_summary">Prevents burn-in on OLED devices by shifting pixels every so often</string>
+
+ <string name="smart_pixels_shift_timeout_summary_15secs">15 seconds</string>
+ <string name="smart_pixels_shift_timeout_summary_30secs">30 seconds</string>
+ <string name="smart_pixels_shift_timeout_summary_1min">1 minute</string>
+ <string name="smart_pixels_shift_timeout_summary_2mins">2 minutes</string>
+ <string name="smart_pixels_shift_timeout_summary_5mins">5 minutes</string>
+ <string name="smart_pixels_shift_timeout_summary_10mins">10 minutes</string>
+ <string name="smart_pixels_shift_timeout_summary_20mins">20 minutes</string>
+ <string name="smart_pixels_shift_timeout_summary_30mins">30 minutes</string>
+ <string name="smart_pixels_shift_timeout_summary_1hour">1 hour</string>
</resources>
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"/>
+ <Preference
+ android:key="smart_pixels"
+ android:order="99"
+ android:title="@string/smart_pixels_title"
+ android:summary="@string/smart_pixels_summary"
+ android:fragment="com.android.settings.fuelgauge.batterysaver.SmartPixelsSettings" />
+
<com.android.settingslib.widget.FooterPreference
android:order="100"
android:key="battery_saver_footer_preference"
diff --git a/res/xml/smart_pixels_settings.xml b/res/xml/smart_pixels_settings.xml
new file mode 100644
index 0000000000..90e71b171a
--- /dev/null
+++ b/res/xml/smart_pixels_settings.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+-->
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
+ android:title="@string/smart_pixels_title" >
+
+ <com.android.settingslib.widget.MainSwitchPreference
+ android:key="smart_pixels_enable"
+ android:title="@string/smart_pixels_enable_title"
+ android:defaultValue="false" />
+
+ <ListPreference
+ android:key="smart_pixels_pattern"
+ android:entries="@array/smart_pixels_percent_strings"
+ android:entryValues="@array/smart_pixels_percent_values"
+ android:defaultValue="5"
+ android:dependency="smart_pixels_enable"
+ android:title="@string/smart_pixels_percent"
+ android:dialogTitle="@string/smart_pixels_percent" />
+
+ <SwitchPreference
+ android:key="smart_pixels_on_power_save"
+ android:title="@string/smart_pixels_on_power_save_title"
+ android:summary="@string/smart_pixels_on_power_save_summary" />
+
+ <ListPreference
+ android:key="smart_pixels_shift_timeout"
+ android:entries="@array/smart_pixels_shift_times"
+ android:entryValues="@array/smart_pixels_shift_values"
+ android:defaultValue="4"
+ android:title="@string/smart_pixels_shift_title"
+ android:summary="@string/smart_pixels_shift_summary"
+ android:dialogTitle="@string/smart_pixels_shift_title" />
+
+ <com.android.settingslib.widget.FooterPreference
+ android:key="smart_pixels_footer"
+ android:selectable="false"
+ settings:searchable="false" />
+</PreferenceScreen>
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;
+ }
+}
+

View File

@ -182,6 +182,7 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0039-package_hooks.patch"; #Add
applyPatch "$DOS_PATCHES/android_frameworks_base/0040-euicc-restrictions.patch"; #Integrate Google's EuiccSupportPixel package (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0040-euicc-restrictions.patch"; #Integrate Google's EuiccSupportPixel package (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0041-tile_restrictions.patch"; #SystemUI: Require unlocking to use sensitive QS tiles (GrapheneOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0041-tile_restrictions.patch"; #SystemUI: Require unlocking to use sensitive QS tiles (GrapheneOS)
applyPatch "$DOS_PATCHES/android_frameworks_base/0042-minimal_screenshot_exif.patch"; #Put bare minimum metadata in screenshots (CalyxOS) applyPatch "$DOS_PATCHES/android_frameworks_base/0042-minimal_screenshot_exif.patch"; #Put bare minimum metadata in screenshots (CalyxOS)
#applyPatch "$DOS_PATCHES/android_frameworks_base/0043-Smart_Pixels.patch"; #Smart Pixels (various)
applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0008-No_Crash_GSF.patch"; #Don't crash apps that depend on missing Gservices provider (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_frameworks_base/0008-No_Crash_GSF.patch"; #Don't crash apps that depend on missing Gservices provider (GrapheneOS)
hardenLocationConf services/core/java/com/android/server/location/gnss/gps_debug.conf; #Harden the default GPS config hardenLocationConf services/core/java/com/android/server/location/gnss/gps_debug.conf; #Harden the default GPS config
sed -i 's/DEFAULT_USE_COMPACTION = false;/DEFAULT_USE_COMPACTION = true;/' services/core/java/com/android/server/am/CachedAppOptimizer.java; #Enable app compaction by default (GrapheneOS) sed -i 's/DEFAULT_USE_COMPACTION = false;/DEFAULT_USE_COMPACTION = true;/' services/core/java/com/android/server/am/CachedAppOptimizer.java; #Enable app compaction by default (GrapheneOS)
@ -322,6 +323,8 @@ applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0015-SUPL_Toggle.patch";
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0016-microG_Toggle.patch"; #Add a toggle for microG enablement (heavily based off of a GrapheneOS patch) applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0016-microG_Toggle.patch"; #Add a toggle for microG enablement (heavily based off of a GrapheneOS patch)
if [ "$DOS_DEBLOBBER_REMOVE_EUICC_FULL" = false ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch"; fi; #Add a toggle for OpenEUICC enablement (heavily based off of a GrapheneOS patch) if [ "$DOS_DEBLOBBER_REMOVE_EUICC_FULL" = false ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0017-OpenEUICC_Toggle.patch"; fi; #Add a toggle for OpenEUICC enablement (heavily based off of a GrapheneOS patch)
if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0018-CC2_Toggle.patch"; fi; #Add a toggle for CarrierConfig2 enablement (heavily based off of a GrapheneOS patch) if [ -d "$DOS_BUILD_BASE"/vendor/divested-carriersettings ]; then applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0018-CC2_Toggle.patch"; fi; #Add a toggle for CarrierConfig2 enablement (heavily based off of a GrapheneOS patch)
#applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0019-Smart_Pixels.patch"; #Smart Pixels (CarbonROM/various)
#applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0019-Smart_Pixels-a1.patch"; #Fix long click intent for Smart Pixels tile (crDroid/various)
applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Settings/0001-disable_apps.patch"; #Add an ability to disable non-system apps from the "App info" screen (GrapheneOS) applyPatch "$DOS_PATCHES_COMMON/android_packages_apps_Settings/0001-disable_apps.patch"; #Add an ability to disable non-system apps from the "App info" screen (GrapheneOS)
fi; fi;