Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f80907af2d | |||
|
|
afc3274f46 | ||
|
|
47d8740bd5 | ||
|
|
e0f2441316 | ||
|
|
c811849ab5 | ||
|
|
70da7a554e | ||
|
|
50fa51cd17 | ||
|
|
c53f9af382 | ||
|
|
458ef94a1d | ||
|
|
0b3a6a1cb0 | ||
|
|
dd524f9294 | ||
|
|
cac222a0b0 | ||
|
|
44fe9b8f7e | ||
|
|
02edf931db | ||
|
|
bc3be39190 | ||
|
|
714b2e0abb | ||
|
|
565d76f073 | ||
|
|
6e068591f5 | ||
|
|
db8a7a8f95 |
@@ -45,6 +45,84 @@
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<!-- VoLTE Icon Type -->
|
||||
<string-array name="volte_icon_type_entries" translatable="false">
|
||||
<item>@string/volte_icon_off</item>
|
||||
<item>@string/volte_icon_dynamic</item>
|
||||
<item>@string/volte_icon_vo</item>
|
||||
<item>@string/volte_icon_volte</item>
|
||||
<item>@string/volte_icon_oos</item>
|
||||
<item>@string/volte_icon_hd</item>
|
||||
<item>@string/volte_icon_miui</item>
|
||||
<item>@string/volte_icon_emui</item>
|
||||
<item>@string/volte_icon_margaritov2</item>
|
||||
<item>@string/volte_icon_margaritov</item>
|
||||
<item>@string/volte_icon_vivo</item>
|
||||
<item>@string/volte_icon_aris</item>
|
||||
<item>@string/volte_icon_beast</item>
|
||||
<item>@string/volte_icon_ios</item>
|
||||
<item>@string/volte_icon_lr</item>
|
||||
<item>@string/volte_icon_realme</item>
|
||||
<item>@string/volte_icon_typeA</item>
|
||||
<item>@string/volte_icon_typeB</item>
|
||||
<item>@string/volte_icon_typeC</item>
|
||||
<item>@string/volte_icon_typeD</item>
|
||||
<item>@string/volte_icon_typeE</item>
|
||||
<item>@string/volte_icon_vcircle</item>
|
||||
<item>@string/volte_icon_vimeo</item>
|
||||
<item>@string/volte_icon_volit</item>
|
||||
<item>@string/volte_icon_zirco</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="volte_icon_type_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>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
<item>13</item>
|
||||
<item>14</item>
|
||||
<item>15</item>
|
||||
<item>16</item>
|
||||
<item>17</item>
|
||||
<item>18</item>
|
||||
<item>19</item>
|
||||
<item>20</item>
|
||||
<item>21</item>
|
||||
<item>22</item>
|
||||
<item>23</item>
|
||||
<item>24</item>
|
||||
<item>25</item>
|
||||
<item>26</item>
|
||||
</string-array>
|
||||
|
||||
<!-- VoWiFi Icon Type -->
|
||||
<string-array name="vowifi_icon_type_entries" translatable="false">
|
||||
<item>@string/vowifi_icon_off</item>
|
||||
<item>@string/vowifi_icon_dynamic</item>
|
||||
<item>@string/vowifi_icon_asus</item>
|
||||
<item>@string/vowifi_icon_oneplus</item>
|
||||
<item>@string/vowifi_icon_moto</item>
|
||||
<item>@string/vowifi_icon_emui</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="vowifi_icon_type_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Battery -->
|
||||
<string-array name="status_bar_battery_percent_entries" translatable="false">
|
||||
<item>@string/status_bar_battery_percentage_default</item>
|
||||
@@ -106,7 +184,7 @@
|
||||
</string-array>
|
||||
|
||||
<!-- QS battery style -->
|
||||
<string-array name="qs_battery_style_entries" translatable="false">
|
||||
<!-- <string-array name="qs_battery_style_entries" translatable="false">
|
||||
<item>@string/qs_use_status_bar_battery_style</item>
|
||||
<item>@string/status_bar_battery_style_icon_portrait</item>
|
||||
<item>@string/status_bar_battery_style_icon_rlandscape</item>
|
||||
@@ -150,7 +228,7 @@
|
||||
<item>9</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</string-array>
|
||||
</string-array> -->
|
||||
|
||||
<!-- Quick Settings brightness slider -->
|
||||
<string-array name="qs_show_brightness_slider_entries" translatable="false">
|
||||
@@ -456,12 +534,14 @@
|
||||
<item>@string/pulse_color_accent</item>
|
||||
<item>@string/pulse_color_custom</item>
|
||||
<item>@string/pulse_color_lava_lamp</item>
|
||||
pulse_color_lava_lamp
|
||||
</string-array>
|
||||
|
||||
<string-array name="pulse_color_mode_values" translatable="false">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="qs_tile_animation_duration_values" translatable="false">
|
||||
@@ -507,27 +587,6 @@
|
||||
<item>7</item>
|
||||
</string-array>
|
||||
|
||||
<!-- App lock timeout -->
|
||||
<string-array name="app_lock_timeout_entries">
|
||||
<item>5 seconds</item>
|
||||
<item>10 seconds</item>
|
||||
<item>30 seconds</item>
|
||||
<item>1 minute</item>
|
||||
<item>5 minutes</item>
|
||||
<item>10 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="app_lock_timeout_values" translatable="false">
|
||||
<item>5000</item>
|
||||
<item>10000</item>
|
||||
<item>30000</item>
|
||||
<item>60000</item>
|
||||
<item>300000</item>
|
||||
<item>600000</item>
|
||||
<item>1800000</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Ambient light -->
|
||||
<string-array name="pulse_ambient_light_color_mode_entries">
|
||||
<item>@string/pulse_ambient_light_color_mode_notification</item>
|
||||
@@ -622,4 +681,122 @@
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</string-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/custom_timeout_summary_15secs</item>
|
||||
<item>@string/custom_timeout_summary_30secs</item>
|
||||
<item>@string/custom_timeout_summary_1min</item>
|
||||
<item>@string/custom_timeout_summary_2mins</item>
|
||||
<item>@string/custom_timeout_summary_5mins</item>
|
||||
<item>@string/custom_timeout_summary_10mins</item>
|
||||
<item>@string/custom_timeout_summary_20mins</item>
|
||||
<item>@string/custom_timeout_summary_30mins</item>
|
||||
<item>@string/custom_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>
|
||||
|
||||
<!-- Status bar chip styles-->
|
||||
<string-array name="statusbar_clock_chip_entries" translatable="false">
|
||||
<item>@string/disabled</item>
|
||||
<item>@string/solid_accent</item>
|
||||
<item>@string/outline</item>
|
||||
<item>@string/solid_accent_gradient</item>
|
||||
<item>@string/solid_gradient</item>
|
||||
<item>@string/solid_gradient_corner</item>
|
||||
<item>@string/solid_gradient_void</item>
|
||||
<item>@string/solid_gradient_neumorph</item>
|
||||
<item>@string/solid_gradient_stroke</item>
|
||||
<item>@string/solid_accent_transperent</item>
|
||||
<item>@string/solid_gradient_light</item>
|
||||
<item>@string/solid_gradient_shape</item>
|
||||
<item>@string/solid_gradient_void_light</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="statusbar_clock_chip_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>
|
||||
<item>9</item>
|
||||
<item>10</item>
|
||||
<item>11</item>
|
||||
<item>12</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Monet theme styles -->
|
||||
<string-array name="theme_style_entries">
|
||||
<item>@string/theme_style_tonal_spot</item>
|
||||
<item>@string/theme_style_vibrant</item>
|
||||
<item>@string/theme_style_expressive</item>
|
||||
<item>@string/theme_style_spritz</item>
|
||||
<item>@string/theme_style_rainbow</item>
|
||||
<item>@string/theme_style_fruit_salad</item>
|
||||
<item>@string/theme_style_muted</item>
|
||||
<item>@string/theme_style_content</item>
|
||||
<item>@string/theme_style_monochromatic</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="theme_style_values" translatable="false">
|
||||
<item>TONAL_SPOT</item>
|
||||
<item>VIBRANT</item>
|
||||
<item>EXPRESSIVE</item>
|
||||
<item>SPRITZ</item>
|
||||
<item>RAINBOW</item>
|
||||
<item>FRUIT_SALAD</item>
|
||||
<item>MUTED</item>
|
||||
<item>CONTENT</item>
|
||||
<item>MONOCHROMATIC</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Monet color sources -->
|
||||
<string-array name="color_source_entries">
|
||||
<item>@string/color_source_both</item>
|
||||
<item>@string/color_source_home</item>
|
||||
<item>@string/color_source_lock</item>
|
||||
<item>@string/color_source_preset</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="color_source_values" translatable="false">
|
||||
<item>both</item>
|
||||
<item>home_wallpaper</item>
|
||||
<item>lock_wallpaper</item>
|
||||
<item>preset</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
@@ -102,8 +102,12 @@
|
||||
<string name="santoni_maintainer">EvilAnsh</string>
|
||||
<string name="device_ysl">Xiaomi Redmi S2</string>
|
||||
<string name="ysl_maintainer">Iris</string>
|
||||
<string name="device_grus">Xiaomi Mi 9 SE</string>
|
||||
<string name="grus_maintainer">Toyohama</string>
|
||||
|
||||
<!-- Realme Device maintainers -->
|
||||
<string name="device_RMX3461">Realme 9 SE 5g</string>
|
||||
<string name="RMX3461_maintainer">Dhruv00</string>
|
||||
<string name="device_RMX1971">Realme 5 Pro</string>
|
||||
<string name="RMX1971_maintainer">Samba Siva Rao K</string>
|
||||
<string name="device_RMX1901">Realme RMX1901</string>
|
||||
@@ -146,7 +150,7 @@
|
||||
<string name="device_lemonades">Oneplus 9R</string>
|
||||
<string name="lemonades_maintainer">Viper_1057 or Amsal1</string>
|
||||
<string name="device_avicii">Oneplus Nord</string>
|
||||
<string name="avicii_maintainer">Snippetguy</string>
|
||||
<string name="avicii_maintainer">PSavarMattas</string>
|
||||
|
||||
<!-- Lenovo Device maintainers -->
|
||||
<string name="device_jd2019">Lenovo Z5s</string>
|
||||
@@ -155,4 +159,9 @@
|
||||
<!-- Motorola Device maintainers -->
|
||||
<string name="device_chef">Motorola One Power</string>
|
||||
<string name="chef_maintainer">Rushi Ranpise</string>
|
||||
|
||||
<!-- Samsung Device maintainers -->
|
||||
<string name="samsung_devices">Samsung</string>
|
||||
<string name="device_s10_n10_series">Galaxy S10 / Galaxy N10 Series</string>
|
||||
<string name="s10_n10_series_maintainer">FrEeRuNnEr4EvEr</string>
|
||||
</resources>
|
||||
|
||||
@@ -254,6 +254,44 @@
|
||||
<string name="lockscreen_albumart_filter_grayblur">Grayscale and blurred</string>
|
||||
<string name="lockscreen_albumart_filter_blur_radius_title">Blur amount for lockscreen media artwork</string>
|
||||
|
||||
<!-- Show VoLTE icon on statusbar -->
|
||||
<string name="volte_icon_style_title">Select VoLTE/HD Icon</string>
|
||||
<string name="volte_icon_off">Off</string>
|
||||
<string name="volte_icon_dynamic">Dynamic VOLTE Icons</string>
|
||||
<string name="volte_icon_vo">Vo Only Icon</string>
|
||||
<string name="volte_icon_volte">VoLTE Icon</string>
|
||||
<string name="volte_icon_oos">VoLTE OOS Icon</string>
|
||||
<string name="volte_icon_hd">HD Icon</string>
|
||||
<string name="volte_icon_miui">MIUI 11 Icon</string>
|
||||
<string name="volte_icon_emui">EMUI Icon</string>
|
||||
<string name="volte_icon_margaritov">HD Filled Icon</string>
|
||||
<string name="volte_icon_margaritov2">Margaritov VoLTE Icon</string>
|
||||
<string name="volte_icon_vivo">Vivo Icon</string>
|
||||
<string name="volte_icon_aris">Aris Icon</string>
|
||||
<string name="volte_icon_beast">Aww Icon</string>
|
||||
<string name="volte_icon_ios">Ios Icon</string>
|
||||
<string name="volte_icon_lr">Livenge Icon</string>
|
||||
<string name="volte_icon_realme">Realme Icon</string>
|
||||
<string name="volte_icon_typeA">Mild Icon</string>
|
||||
<string name="volte_icon_typeB">Filth Icon</string>
|
||||
<string name="volte_icon_typeC">Mue Icon</string>
|
||||
<string name="volte_icon_typeD">Sus Icon</string>
|
||||
<string name="volte_icon_typeE">Acherus Icon</string>
|
||||
<string name="volte_icon_vcircle">Circle Icon</string>
|
||||
<string name="volte_icon_vimeo">Vimeo Icon</string>
|
||||
<string name="volte_icon_volit">Volit Icon</string>
|
||||
<string name="volte_icon_zirco">Ziroc Icon</string>
|
||||
|
||||
<!-- VoWiFi icon -->
|
||||
<string name="vowifi_icon_title">VoWiFi Icon</string>
|
||||
<string name="vowifi_icon_summary">Display VoWiFi icon when available</string>
|
||||
<string name="vowifi_icon_off">Off</string>
|
||||
<string name="vowifi_icon_dynamic">Dynamic VoWiFi Icon</string>
|
||||
<string name="vowifi_icon_asus">Asus VoWiFi Icon</string>
|
||||
<string name="vowifi_icon_oneplus">OnePlus VoWiFi Icon</string>
|
||||
<string name="vowifi_icon_moto">Moto VoWiFi Icons</string>
|
||||
<string name="vowifi_icon_emui">EMUI Icons</string>
|
||||
|
||||
<!-- Statusbar Battery -->
|
||||
<string name="battery_style_title">Battery icon style</string>
|
||||
<string name="battery_style_summary">Customize battery icons, hide or show percentage</string>
|
||||
@@ -295,6 +333,18 @@
|
||||
<!-- Statusbar Clock background chip -->
|
||||
<string name="statusbar_clock_chip_title">Background chip</string>
|
||||
<string name="statusbar_clock_chip_summary">Display accented chip behind clock</string>
|
||||
<string name="solid_accent">Solid color accent</string>
|
||||
<string name="outline">Outline</string>
|
||||
<string name="solid_accent_gradient">Solid color accent gradient</string>
|
||||
<string name="solid_gradient">Solid Gradient side</string>
|
||||
<string name="solid_gradient_corner">Solid accent gradient sharp</string>
|
||||
<string name="solid_gradient_void">Gradient Void</string>
|
||||
<string name="solid_gradient_neumorph">Neumorph gradient</string>
|
||||
<string name="solid_gradient_stroke">Sharp gradient stroke</string>
|
||||
<string name="solid_accent_transperent">Accent transperent</string>
|
||||
<string name="solid_gradient_light">Gradient light</string>
|
||||
<string name="solid_gradient_shape">Sharp gradient corner</string>
|
||||
<string name="solid_gradient_void_light">Gradient Void light</string>
|
||||
|
||||
<!-- Quick Settings brightness slider -->
|
||||
<string name="qs_show_brightness_slider_title">Brightness slider</string>
|
||||
@@ -579,35 +629,11 @@
|
||||
<string name="qs_clock_title">Clock</string>
|
||||
<string name="qs_clock_summary">Display clock in quick status bar header</string>
|
||||
|
||||
<!-- QS date -->
|
||||
<string name="qs_date_title">Date</string>
|
||||
<string name="qs_date_summary">Display date in quick status bar header</string>
|
||||
|
||||
<!-- Footer -->
|
||||
<string name="qs_footer_category">QS Footer</string>
|
||||
<string name="qs_footer_datausage_title">Data usage</string>
|
||||
<string name="qs_footer_datausage_summary">Display data usage summary in quick settings footer</string>
|
||||
|
||||
<!-- App lock -->
|
||||
<string name="app_lock_title">App lock</string>
|
||||
<string name="app_lock_summary">Apps will require fingerprint authentication to launch</string>
|
||||
<string name="app_lock_authentication_dialog_title">Unlock</string>
|
||||
<string name="enable_debugging">Enable debugging</string>
|
||||
<string name="disable_debugging">Disable debugging</string>
|
||||
<string name="app_lock_packages_title">Protected apps</string>
|
||||
<string name="app_lock_packages_summary">Select the apps to protect with biometrics or device credentials</string>
|
||||
<string name="app_lock_timeout_title">Auto lock timeout</string>
|
||||
<string name="app_lock_timeout_summary">Duration of time after which an unlocked app in background should be locked</string>
|
||||
<string name="app_lock_notifications_title">Redact notifications</string>
|
||||
<string name="app_lock_notifications_summary">
|
||||
Notification content will be hidden and collapsed for selected apps when they are locked.
|
||||
Heads up notifications will be automatically disabled.
|
||||
</string>
|
||||
<string name="app_lock_notifications_disabled_summary">Protect an application first</string>
|
||||
<string name="app_lock_biometrics_allowed_title">Enable biometrics for unlocking</string>
|
||||
<string name="app_lock_footer_text">Bubbles will be automatically dismissed after timeout</string>
|
||||
<string name="enable_protection">Enable protection</string>
|
||||
|
||||
<!-- Quick settings styling -->
|
||||
<string name="qs_styles_title">Combined QS Element Styles</string>
|
||||
<string name="qs_outline">Outline</string>
|
||||
@@ -715,6 +741,7 @@
|
||||
<string name="pulse_legacy_mode_advanced_category">Fading blocks mode settings</string>
|
||||
<string name="pulse_custom_fudge_factor">Sanity level</string>
|
||||
<string name="pulse_lavalamp_speed_title">Lava lamp speed</string>
|
||||
<string name="pulse_color_auto">Album</string>
|
||||
<string name="pulse_solid_units_count">Solid lines count</string>
|
||||
<string name="pulse_solid_units_opacity">Solid lines opacity</string>
|
||||
<string name="pulse_solid_units_rounded_title">Rounded corners</string>
|
||||
@@ -825,4 +852,52 @@
|
||||
<string name="fprint_error_vib_summary">Vibrate on error fingerprint authentication</string>
|
||||
<string name="fprint_success_vib_title">Fingerprint authentication vibration</string>
|
||||
<string name="fprint_success_vib_summary">Vibrate on successful fingerprint authentication</string>
|
||||
|
||||
<!-- Smart Pixels -->
|
||||
<string name="smart_pixels_warning_text">Smart pixels is a power saving feature. 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_enable_summary">Shut off pixels to reduce power consumption</string>
|
||||
<string name="smart_pixels_on_power_save_title">Auto-enable on battery saver</string>
|
||||
<string name="smart_pixels_on_power_save_summary">Enable Smart Pixels when battery saver is enabled</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>
|
||||
|
||||
<!-- Combined signal icons in status bar -->
|
||||
<string name="combined_status_bar_signal_icons_title">Combined signal icons</string>
|
||||
<string name="combined_status_bar_signal_icons_summary">Enable combined signal icons\n(WARNING: a soft reboot will occur upon enabling combined signal icons)</string>
|
||||
|
||||
<!-- Monet settings -->
|
||||
<string name="monet_settings_title">Monet theming</string>
|
||||
<string name="monet_settings_sammary">A few extra settings to customize monet engine</string>
|
||||
<string name="theme_style_title">Theme style</string>
|
||||
<string name="theme_style_tonal_spot">Tonal Spot (Default)</string>
|
||||
<string name="theme_style_vibrant">Vibrant</string>
|
||||
<string name="theme_style_expressive">Exspressive</string>
|
||||
<string name="theme_style_spritz">Spritz</string>
|
||||
<string name="theme_style_rainbow">Rainbow</string>
|
||||
<string name="theme_style_fruit_salad">Fruit Salad</string>
|
||||
<string name="theme_style_muted">Muted</string>
|
||||
<string name="theme_style_content">Content</string>
|
||||
<string name="theme_style_monochromatic">Monochromatic</string>
|
||||
<string name="color_source_title">Color source</string>
|
||||
<string name="color_source_both">Both (Default)</string>
|
||||
<string name="color_source_home">Home wallpaper</string>
|
||||
<string name="color_source_lock">Lock wallpaper</string>
|
||||
<string name="color_source_preset">Preset</string>
|
||||
<string name="accent_color_title">Accent Color</string>
|
||||
<string name="accent_color_summary">Override default accent color</string>
|
||||
<string name="accent_background_title">Accent background</string>
|
||||
<string name="accent_background_summary">Choose a different accent color for background</string>
|
||||
<string name="bg_color_title">Background Color</string>
|
||||
<string name="bg_color_summary">Override default background accent color</string>
|
||||
<string name="luminance_factor_title">Luminance</string>
|
||||
<string name="luminance_factor_summary">Higher values produce brighter colors</string>
|
||||
<string name="chroma_factor_title">Chroma</string>
|
||||
<string name="chroma_factor_summary">Higher values produce stronger colors</string>
|
||||
<string name="tint_background_title">Tint Background</string>
|
||||
<string name="tint_background_summary">Make Luminance and Chroma selection affect background colors as well</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 FlamingoOS 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.
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
<!-- App Lock -->
|
||||
<plurals name="app_lock_summary">
|
||||
<item quantity="one"><xliff:g example="1" id="Number of applications">%1$d</xliff:g> application is protected</item>
|
||||
<item quantity="other"><xliff:g example="10" id="Number of applications">%1$d</xliff:g> applications are protected</item>
|
||||
</plurals>
|
||||
|
||||
</resources>
|
||||
@@ -1,39 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 CherishOS 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"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/app_lock_title">
|
||||
|
||||
<Preference
|
||||
android:key="app_lock_packages"
|
||||
android:title="@string/app_lock_packages_title"
|
||||
android:summary="@string/app_lock_packages_summary"
|
||||
android:fragment="com.cherish.settings.security.applock.AppLockPackageListFragment" />
|
||||
|
||||
<ListPreference
|
||||
android:key="app_lock_timeout"
|
||||
android:title="@string/app_lock_timeout_title"
|
||||
android:summary="@string/app_lock_timeout_summary"
|
||||
android:entries="@array/app_lock_timeout_entries"
|
||||
android:entryValues="@array/app_lock_timeout_values"
|
||||
android:defaultValue="0"
|
||||
android:persistent="false"
|
||||
settings:controller="com.cherish.settings.security.applock.AppLockTimeoutPreferenceController" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="app_lock_biometrics_allowed"
|
||||
android:title="@string/app_lock_biometrics_allowed_title"
|
||||
android:persistent="false"
|
||||
settings:controller="com.cherish.settings.security.applock.AppLockBiometricPreferenceController" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 FlamingoOS 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"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/app_lock_packages_title">
|
||||
</PreferenceScreen>
|
||||
@@ -353,6 +353,15 @@
|
||||
android:data="https://t.me/bruh_its_your_brother" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:title="@string/grus_maintainer"
|
||||
android:summary="@string/device_grus"
|
||||
android:icon="@drawable/ic_devs_phone" >
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://t.me/Tkiliay" />
|
||||
</Preference>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
@@ -465,6 +474,15 @@
|
||||
android:data="https://t.me/EvilAnsh" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:title="@string/RMX3461_maintainer"
|
||||
android:summary="@string/device_RMX3461"
|
||||
android:icon="@drawable/ic_devs_phone">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://t.me/DRvP00" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:title="@string/RMX1971_maintainer"
|
||||
android:summary="@string/device_RMX1971"
|
||||
@@ -581,4 +599,18 @@
|
||||
android:data="https://t.me/Iris041" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="samsung_devices"
|
||||
android:title="@string/samsung_devices" >
|
||||
|
||||
<Preference
|
||||
android:title="@string/s10_n10_series_maintainer"
|
||||
android:summary="@string/device_s10_n10_series"
|
||||
android:icon="@drawable/ic_devs_phone" >
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://t.me/FreeRunner4ever" />
|
||||
</Preference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 FlamingoOS 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"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:title="@string/app_lock_title">
|
||||
|
||||
<Preference
|
||||
android:key="app_lock_packages"
|
||||
android:title="@string/app_lock_packages_title"
|
||||
android:summary="@string/app_lock_packages_summary"
|
||||
android:fragment="com.cherish.settings.security.applock.AppLockPackageListFragment" />
|
||||
|
||||
<ListPreference
|
||||
android:key="app_lock_timeout"
|
||||
android:title="@string/app_lock_timeout_title"
|
||||
android:summary="@string/app_lock_timeout_summary"
|
||||
android:entries="@array/app_lock_timeout_entries"
|
||||
android:entryValues="@array/app_lock_timeout_values"
|
||||
android:defaultValue="0"
|
||||
android:persistent="false"
|
||||
settings:controller="com.cherish.settings.security.applock.AppLockTimeoutPreferenceController" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="app_lock_biometrics_allowed"
|
||||
android:title="@string/app_lock_biometrics_allowed_title"
|
||||
android:persistent="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -116,12 +116,12 @@
|
||||
android:summary="@string/pulse_settings_summary"
|
||||
android:fragment="com.cherish.settings.fragments.sound.PulseSettings" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
||||
<!-- <com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="ls_media_filter_blur_radius"
|
||||
android:title="@string/lockscreen_albumart_filter_blur_radius_title"
|
||||
android:defaultValue="10"
|
||||
android:max="25"
|
||||
settings:min="1" />
|
||||
settings:min="1" /> -->
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@
|
||||
android:summary="@string/smart_charging_summary"
|
||||
android:fragment="com.cherish.settings.fragments.SmartCharging"/>
|
||||
|
||||
<!-- Smart Pixels -->
|
||||
<Preference
|
||||
android:key="app_lock"
|
||||
android:title="@string/app_lock_title"
|
||||
android:summary="@string/app_lock_summary"
|
||||
android:fragment="com.cherish.settings.security.applock.AppLockSettingsFragment"
|
||||
settings:controller="com.cherish.settings.security.applock.AppLockSettingsPreferenceController" />
|
||||
android:key="smart_pixels"
|
||||
android:title="@string/smart_pixels_title"
|
||||
android:summary="@string/smart_pixels_summary"
|
||||
android:fragment="com.cherish.settings.fragments.SmartPixels" />
|
||||
|
||||
<!-- Unlock FPS for specific games -->
|
||||
<SwitchPreference
|
||||
|
||||
@@ -38,21 +38,6 @@
|
||||
android:entryValues="@array/quick_pulldown_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="qs_header_clock_size"
|
||||
android:title="@string/clock_font_size_title"
|
||||
android:max="27"
|
||||
settings:min="10"
|
||||
settings:interval="1"
|
||||
android:defaultValue="14"
|
||||
settings:units="@string/unit_pixels" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="show_qs_date"
|
||||
android:title="@string/qs_date_title"
|
||||
android:summary="@string/qs_date_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
56
res/xml/cherish_settings_smart_pixels.xml
Normal file
56
res/xml/cherish_settings_smart_pixels.xml
Normal file
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2018-2022 crDroid Android 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"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
|
||||
android:title="@string/smart_pixels_title" >
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="smart_pixels_enable"
|
||||
android:title="@string/smart_pixels_enable_title"
|
||||
android:summary="@string/smart_pixels_enable_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
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" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
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"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
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>
|
||||
@@ -57,15 +57,6 @@
|
||||
android:entryValues="@array/status_bar_am_pm_values"
|
||||
android:defaultValue="2" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSeekBarPreference
|
||||
android:key="status_bar_clock_size"
|
||||
android:title="@string/clock_font_size_title"
|
||||
android:max="20"
|
||||
settings:min="4"
|
||||
settings:interval="1"
|
||||
android:defaultValue="14"
|
||||
settings:units="@string/unit_pixels" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
android:key="status_bar_clock_date_display"
|
||||
android:title="@string/status_bar_date_title"
|
||||
|
||||
@@ -27,11 +27,13 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
android:key="statusbar_clock_chip"
|
||||
android:title="@string/statusbar_clock_chip_title"
|
||||
android:summary="@string/statusbar_clock_chip_summary"
|
||||
android:defaultValue="false" />
|
||||
android:entries="@array/statusbar_clock_chip_entries"
|
||||
android:entryValues="@array/statusbar_clock_chip_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<Preference
|
||||
android:key="network_traffic_settings"
|
||||
@@ -78,6 +80,28 @@
|
||||
android:summary="@string/data_disabled_icon_summary"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemPropertySwitchPreference
|
||||
android:key="persist.sys.flags.combined_signal_icons"
|
||||
android:title="@string/combined_status_bar_signal_icons_title"
|
||||
android:summary="@string/combined_status_bar_signal_icons_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
android:key="volte_icon_style"
|
||||
android:title="@string/volte_icon_style_title"
|
||||
android:entries="@array/volte_icon_type_entries"
|
||||
android:entryValues="@array/volte_icon_type_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="1"/>
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
android:key="vowifi_icon_style"
|
||||
android:title="@string/vowifi_icon_title"
|
||||
android:entries="@array/vowifi_icon_type_entries"
|
||||
android:entryValues="@array/vowifi_icon_type_values"
|
||||
android:summary="%s"
|
||||
android:defaultValue="1"/>
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingSwitchPreference
|
||||
android:key="use_old_mobiletype"
|
||||
android:title="@string/use_old_mobiletype_title"
|
||||
|
||||
@@ -60,6 +60,13 @@
|
||||
android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
|
||||
settings:controller="com.android.settings.display.DarkUIPreferenceController" />
|
||||
|
||||
<!-- Monet settings -->
|
||||
<Preference
|
||||
android:key="monet_settings"
|
||||
android:title="@string/monet_settings_title"
|
||||
android:summary="@string/monet_settings_sammary"
|
||||
android:fragment="com.cherish.settings.fragments.MonetSettings" />
|
||||
|
||||
<Preference
|
||||
android:key="android.theme.customization.lockscreen_clock_font"
|
||||
android:title="@string/theme_customization_lock_clock_title"
|
||||
|
||||
79
res/xml/monet_settings.xml
Normal file
79
res/xml/monet_settings.xml
Normal file
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2022 Yet Another AOSP 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:title="@string/monet_settings_title"
|
||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
||||
|
||||
<ListPreference
|
||||
android:key="theme_style"
|
||||
android:title="@string/theme_style_title"
|
||||
android:entries="@array/theme_style_entries"
|
||||
android:entryValues="@array/theme_style_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<ListPreference
|
||||
android:key="color_source"
|
||||
android:title="@string/color_source_title"
|
||||
android:entries="@array/color_source_entries"
|
||||
android:entryValues="@array/color_source_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
<net.margaritov.preference.colorpicker.ColorPickerPreference
|
||||
android:key="accent_color"
|
||||
android:title="@string/accent_color_title"
|
||||
android:summary="@string/accent_color_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="accent_background"
|
||||
android:title="@string/accent_background_title"
|
||||
android:summary="@string/accent_background_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<net.margaritov.preference.colorpicker.ColorPickerPreference
|
||||
android:key="bg_color"
|
||||
android:title="@string/bg_color_title"
|
||||
android:summary="@string/bg_color_summary" />
|
||||
|
||||
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||
android:key="luminance_factor"
|
||||
android:title="@string/luminance_factor_title"
|
||||
android:summary="@string/luminance_factor_summary"
|
||||
android:max="100"
|
||||
settings:min="-95"
|
||||
settings:interval="5"
|
||||
settings:defaultValue="0"
|
||||
settings:units="%"
|
||||
settings:showSign="true" />
|
||||
|
||||
<com.cherish.settings.preferences.CustomSeekBarPreference
|
||||
android:key="chroma_factor"
|
||||
android:title="@string/chroma_factor_title"
|
||||
android:summary="@string/chroma_factor_summary"
|
||||
android:max="100"
|
||||
settings:min="-95"
|
||||
settings:interval="5"
|
||||
settings:defaultValue="0"
|
||||
settings:units="%"
|
||||
settings:showSign="true" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="tint_background"
|
||||
android:title="@string/tint_background_title"
|
||||
android:summary="@string/tint_background_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
</PreferenceScreen>
|
||||
@@ -46,7 +46,7 @@
|
||||
</PreferenceCategory>
|
||||
|
||||
<!-- QS panel battery customizations -->
|
||||
<PreferenceCategory
|
||||
<!-- <PreferenceCategory
|
||||
android:title="@string/qs_battery_category_title">
|
||||
|
||||
<com.cherish.settings.preferences.SystemSettingListPreference
|
||||
@@ -63,6 +63,6 @@
|
||||
android:entryValues="@array/status_bar_battery_percent_values"
|
||||
android:defaultValue="2" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceCategory> -->
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings
|
||||
|
||||
import android.content.Context
|
||||
import android.widget.Switch
|
||||
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
|
||||
import com.android.settings.R
|
||||
import com.android.settings.core.TogglePreferenceController
|
||||
import com.android.settingslib.widget.MainSwitchPreference
|
||||
import com.android.settingslib.widget.OnMainSwitchChangeListener
|
||||
|
||||
abstract class CherishTogglePreferenceController(
|
||||
context: Context,
|
||||
key: String,
|
||||
) : TogglePreferenceController(context, key),
|
||||
OnMainSwitchChangeListener {
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
val preference = screen.findPreference<Preference>(preferenceKey) ?: return
|
||||
if (preference is MainSwitchPreference) {
|
||||
preference.addOnSwitchChangeListener(this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSwitchChanged(switchView: Switch, isChecked: Boolean) {
|
||||
setChecked(isChecked)
|
||||
}
|
||||
|
||||
override fun getSliceHighlightMenuRes() = R.string.menu_key_cherish
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import com.android.settingslib.search.SearchIndexable;
|
||||
import android.provider.SearchIndexableResource;
|
||||
|
||||
import com.cherish.settings.fragments.SmartCharging;
|
||||
import com.cherish.settings.fragments.SmartPixels;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -53,10 +54,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
private static final String SYS_PHOTOS_SPOOF = "persist.sys.pixelprops.gphotos";
|
||||
|
||||
private static final String SMART_CHARGING = "smart_charging";
|
||||
private static final String SMART_PIXELS = "smart_pixels";
|
||||
|
||||
private SwitchPreference mGamesSpoof;
|
||||
private SwitchPreference mPhotosSpoof;
|
||||
private Preference mSmartCharging;
|
||||
private Preference mSmartPixels;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
@@ -82,6 +85,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
if (!mSmartChargingSupported)
|
||||
prefScreen.removePreference(mSmartCharging);
|
||||
|
||||
mSmartPixels = (Preference) prefScreen.findPreference(SMART_PIXELS);
|
||||
boolean mSmartPixelsSupported = getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_supportSmartPixels);
|
||||
if (!mSmartPixelsSupported)
|
||||
prefScreen.removePreference(mSmartPixels);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,8 +121,12 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
|
||||
boolean mSmartChargingSupported = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_smartChargingAvailable);
|
||||
boolean mSmartPixelsSupported = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_supportSmartPixels);
|
||||
if (!mSmartChargingSupported)
|
||||
keys.add(SMART_CHARGING);
|
||||
if (!mSmartPixelsSupported)
|
||||
keys.add(SMART_PIXELS);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
350
src/com/cherish/settings/fragments/MonetSettings.java
Normal file
350
src/com/cherish/settings/fragments/MonetSettings.java
Normal file
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Yet Another AOSP 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.
|
||||
*/
|
||||
package com.cherish.settings.fragments;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.os.Bundle;
|
||||
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.SettingsPreferenceFragment;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.R;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import net.margaritov.preference.colorpicker.ColorPickerPreference;
|
||||
import com.cherish.settings.preferences.CustomSeekBarPreference;
|
||||
|
||||
import java.lang.CharSequence;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@SearchIndexable
|
||||
public class MonetSettings extends SettingsPreferenceFragment implements
|
||||
OnPreferenceChangeListener {
|
||||
|
||||
private static final String OVERLAY_CATEGORY_ACCENT_COLOR =
|
||||
"android.theme.customization.accent_color";
|
||||
private static final String OVERLAY_CATEGORY_SYSTEM_PALETTE =
|
||||
"android.theme.customization.system_palette";
|
||||
private static final String OVERLAY_CATEGORY_THEME_STYLE =
|
||||
"android.theme.customization.theme_style";
|
||||
private static final String OVERLAY_CATEGORY_BG_COLOR =
|
||||
"android.theme.customization.bg_color";
|
||||
private static final String OVERLAY_COLOR_SOURCE =
|
||||
"android.theme.customization.color_source";
|
||||
private static final String OVERLAY_COLOR_BOTH =
|
||||
"android.theme.customization.color_both";
|
||||
private static final String OVERLAY_LUMINANCE_FACTOR =
|
||||
"android.theme.customization.luminance_factor";
|
||||
private static final String OVERLAY_CHROMA_FACTOR =
|
||||
"android.theme.customization.chroma_factor";
|
||||
private static final String OVERLAY_TINT_BACKGROUND =
|
||||
"android.theme.customization.tint_background";
|
||||
private static final String COLOR_SOURCE_PRESET = "preset";
|
||||
private static final String COLOR_SOURCE_HOME = "home_wallpaper";
|
||||
private static final String COLOR_SOURCE_LOCK = "lock_wallpaper";
|
||||
|
||||
private static final String PREF_THEME_STYLE = "theme_style";
|
||||
private static final String PREF_COLOR_SOURCE = "color_source";
|
||||
private static final String PREF_ACCENT_COLOR = "accent_color";
|
||||
private static final String PREF_ACCENT_BACKGROUND = "accent_background";
|
||||
private static final String PREF_BG_COLOR = "bg_color";
|
||||
private static final String PREF_LUMINANCE_FACTOR = "luminance_factor";
|
||||
private static final String PREF_CHROMA_FACTOR = "chroma_factor";
|
||||
private static final String PREF_TINT_BACKGROUND = "tint_background";
|
||||
|
||||
private ListPreference mThemeStylePref;
|
||||
private ListPreference mColorSourcePref;
|
||||
private ColorPickerPreference mAccentColorPref;
|
||||
private SwitchPreference mAccentBackgroundPref;
|
||||
private ColorPickerPreference mBgColorPref;
|
||||
private CustomSeekBarPreference mLuminancePref;
|
||||
private CustomSeekBarPreference mChromaPref;
|
||||
private SwitchPreference mTintBackgroundPref;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
addPreferencesFromResource(R.xml.monet_settings);
|
||||
|
||||
mThemeStylePref = findPreference(PREF_THEME_STYLE);
|
||||
mColorSourcePref = findPreference(PREF_COLOR_SOURCE);
|
||||
mAccentColorPref = findPreference(PREF_ACCENT_COLOR);
|
||||
mAccentBackgroundPref = findPreference(PREF_ACCENT_BACKGROUND);
|
||||
mBgColorPref = findPreference(PREF_BG_COLOR);
|
||||
mLuminancePref = findPreference(PREF_LUMINANCE_FACTOR);
|
||||
mChromaPref = findPreference(PREF_CHROMA_FACTOR);
|
||||
mTintBackgroundPref = findPreference(PREF_TINT_BACKGROUND);
|
||||
|
||||
updatePreferences();
|
||||
|
||||
mThemeStylePref.setOnPreferenceChangeListener(this);
|
||||
mColorSourcePref.setOnPreferenceChangeListener(this);
|
||||
mAccentColorPref.setOnPreferenceChangeListener(this);
|
||||
mAccentBackgroundPref.setOnPreferenceChangeListener(this);
|
||||
mBgColorPref.setOnPreferenceChangeListener(this);
|
||||
mLuminancePref.setOnPreferenceChangeListener(this);
|
||||
mChromaPref.setOnPreferenceChangeListener(this);
|
||||
mTintBackgroundPref.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updatePreferences();
|
||||
}
|
||||
|
||||
private void updatePreferences() {
|
||||
final String overlayPackageJson = Settings.Secure.getStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
UserHandle.USER_CURRENT);
|
||||
if (overlayPackageJson != null && !overlayPackageJson.isEmpty()) {
|
||||
try {
|
||||
final JSONObject object = new JSONObject(overlayPackageJson);
|
||||
final String style = object.optString(OVERLAY_CATEGORY_THEME_STYLE, null);
|
||||
final String source = object.optString(OVERLAY_COLOR_SOURCE, null);
|
||||
final String color = object.optString(OVERLAY_CATEGORY_SYSTEM_PALETTE, null);
|
||||
final int bgColor = object.optInt(OVERLAY_CATEGORY_BG_COLOR);
|
||||
final boolean both = object.optInt(OVERLAY_COLOR_BOTH, 0) == 1;
|
||||
final boolean tintBG = object.optInt(OVERLAY_TINT_BACKGROUND, 0) == 1;
|
||||
final float lumin = (float) object.optDouble(OVERLAY_LUMINANCE_FACTOR, 1d);
|
||||
final float chroma = (float) object.optDouble(OVERLAY_CHROMA_FACTOR, 1d);
|
||||
// style handling
|
||||
boolean styleUpdated = false;
|
||||
if (style != null && !style.isEmpty()) {
|
||||
for (CharSequence value : mThemeStylePref.getEntryValues()) {
|
||||
if (value.toString().equals(style)) {
|
||||
styleUpdated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (styleUpdated) {
|
||||
updateListByValue(mThemeStylePref, style);
|
||||
}
|
||||
}
|
||||
if (!styleUpdated) {
|
||||
updateListByValue(mThemeStylePref,
|
||||
mThemeStylePref.getEntryValues()[0].toString());
|
||||
}
|
||||
// color handling
|
||||
final String sourceVal = (source == null || source.isEmpty() ||
|
||||
(source.equals(COLOR_SOURCE_HOME) && both)) ? "both" : source;
|
||||
updateListByValue(mColorSourcePref, sourceVal);
|
||||
final boolean enabled = updateAccentEnablement(sourceVal);
|
||||
if (enabled && color != null && !color.isEmpty()) {
|
||||
mAccentColorPref.setNewPreviewColor(
|
||||
ColorPickerPreference.convertToColorInt(color));
|
||||
}
|
||||
final boolean bgEnabled = enabled && bgColor != 0;
|
||||
if (bgEnabled) {
|
||||
mBgColorPref.setNewPreviewColor(bgColor);
|
||||
} else if (!enabled) {
|
||||
mAccentBackgroundPref.setEnabled(false);
|
||||
}
|
||||
mAccentBackgroundPref.setChecked(bgEnabled);
|
||||
mBgColorPref.setEnabled(bgEnabled);
|
||||
// etc
|
||||
int luminV = 0;
|
||||
if (lumin > 1d) luminV = Math.round((lumin - 1f) * 100f);
|
||||
else if (lumin < 1d) luminV = -1 * Math.round((1f - lumin) * 100f);
|
||||
mLuminancePref.setValue(luminV);
|
||||
int chromaV = 0;
|
||||
if (chroma > 1d) chromaV = Math.round((chroma - 1f) * 100f);
|
||||
else if (chroma < 1d) chromaV = -1 * Math.round((1f - chroma) * 100f);
|
||||
mChromaPref.setValue(chromaV);
|
||||
mTintBackgroundPref.setChecked(tintBG);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final ContentResolver resolver = getActivity().getContentResolver();
|
||||
if (preference == mThemeStylePref) {
|
||||
String value = (String) newValue;
|
||||
setStyleValue(value);
|
||||
updateListByValue(mThemeStylePref, value, false);
|
||||
return true;
|
||||
} else if (preference == mColorSourcePref) {
|
||||
String value = (String) newValue;
|
||||
setSourceValue(value);
|
||||
updateListByValue(mColorSourcePref, value, false);
|
||||
updateAccentEnablement(value);
|
||||
return true;
|
||||
} else if (preference == mAccentColorPref) {
|
||||
int value = (Integer) newValue;
|
||||
setColorValue(value);
|
||||
return true;
|
||||
} else if (preference == mAccentBackgroundPref) {
|
||||
boolean value = (Boolean) newValue;
|
||||
if (!value) setBgColorValue(0);
|
||||
mBgColorPref.setEnabled(value);
|
||||
return true;
|
||||
} else if (preference == mBgColorPref) {
|
||||
int value = (Integer) newValue;
|
||||
setBgColorValue(value);
|
||||
return true;
|
||||
} else if (preference == mLuminancePref) {
|
||||
int value = (Integer) newValue;
|
||||
setLuminanceValue(value);
|
||||
return true;
|
||||
} else if (preference == mChromaPref) {
|
||||
int value = (Integer) newValue;
|
||||
setChromaValue(value);
|
||||
return true;
|
||||
} else if (preference == mTintBackgroundPref) {
|
||||
boolean value = (Boolean) newValue;
|
||||
setTintBackgroundValue(value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateListByValue(ListPreference pref, String value) {
|
||||
updateListByValue(pref, value, true);
|
||||
}
|
||||
|
||||
private void updateListByValue(ListPreference pref, String value, boolean set) {
|
||||
if (set) pref.setValue(value);
|
||||
final int index = pref.findIndexOfValue(value);
|
||||
pref.setSummary(pref.getEntries()[index]);
|
||||
}
|
||||
|
||||
private boolean updateAccentEnablement(String source) {
|
||||
final boolean shouldEnable = source != null && source.equals(COLOR_SOURCE_PRESET);
|
||||
mAccentColorPref.setEnabled(shouldEnable);
|
||||
mAccentBackgroundPref.setEnabled(shouldEnable);
|
||||
if (!shouldEnable) {
|
||||
mBgColorPref.setEnabled(false);
|
||||
mAccentBackgroundPref.setEnabled(false);
|
||||
mAccentBackgroundPref.setChecked(false);
|
||||
}
|
||||
return shouldEnable;
|
||||
}
|
||||
|
||||
private JSONObject getSettingsJson() throws JSONException {
|
||||
final String overlayPackageJson = Settings.Secure.getStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
UserHandle.USER_CURRENT);
|
||||
JSONObject object;
|
||||
if (overlayPackageJson == null || overlayPackageJson.isEmpty())
|
||||
return new JSONObject();
|
||||
return new JSONObject(overlayPackageJson);
|
||||
}
|
||||
|
||||
private void putSettingsJson(JSONObject object) {
|
||||
Settings.Secure.putStringForUser(
|
||||
getActivity().getContentResolver(),
|
||||
Settings.Secure.THEME_CUSTOMIZATION_OVERLAY_PACKAGES,
|
||||
object.toString(), UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
private void setStyleValue(String style) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
object.putOpt(OVERLAY_CATEGORY_THEME_STYLE, style);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setSourceValue(String source) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (source.equals("both")) {
|
||||
object.putOpt(OVERLAY_COLOR_BOTH, 1);
|
||||
object.putOpt(OVERLAY_COLOR_SOURCE, COLOR_SOURCE_HOME);
|
||||
} else {
|
||||
object.remove(OVERLAY_COLOR_BOTH);
|
||||
object.putOpt(OVERLAY_COLOR_SOURCE, source);
|
||||
}
|
||||
if (!source.equals(COLOR_SOURCE_PRESET)) {
|
||||
object.remove(OVERLAY_CATEGORY_ACCENT_COLOR);
|
||||
object.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
}
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setColorValue(int color) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
final String rgbColor = ColorPickerPreference.convertToRGB(color).replace("#", "");
|
||||
object.putOpt(OVERLAY_CATEGORY_ACCENT_COLOR, rgbColor);
|
||||
object.putOpt(OVERLAY_CATEGORY_SYSTEM_PALETTE, rgbColor);
|
||||
object.putOpt(OVERLAY_COLOR_SOURCE, COLOR_SOURCE_PRESET);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setBgColorValue(int color) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (color != 0) object.putOpt(OVERLAY_CATEGORY_BG_COLOR, color);
|
||||
else object.remove(OVERLAY_CATEGORY_BG_COLOR);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setLuminanceValue(int lumin) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (lumin == 0)
|
||||
object.remove(OVERLAY_LUMINANCE_FACTOR);
|
||||
else
|
||||
object.putOpt(OVERLAY_LUMINANCE_FACTOR, 1d + ((double) lumin / 100d));
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setChromaValue(int chroma) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (chroma == 0)
|
||||
object.remove(OVERLAY_CHROMA_FACTOR);
|
||||
else
|
||||
object.putOpt(OVERLAY_CHROMA_FACTOR, 1d + ((double) chroma / 100d));
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
private void setTintBackgroundValue(boolean tint) {
|
||||
try {
|
||||
JSONObject object = getSettingsJson();
|
||||
if (!tint) object.remove(OVERLAY_TINT_BACKGROUND);
|
||||
else object.putOpt(OVERLAY_TINT_BACKGROUND, 1);
|
||||
putSettingsJson(object);
|
||||
} catch (JSONException | IllegalArgumentException ignored) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.monet_settings);
|
||||
}
|
||||
57
src/com/cherish/settings/fragments/SmartPixels.java
Normal file
57
src/com/cherish/settings/fragments/SmartPixels.java
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 crDroid Android 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.fragments;
|
||||
|
||||
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 SmartPixels 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.cherish_settings_smart_pixels);
|
||||
|
||||
findPreference(SMART_PIXELS_FOOTER).setTitle(R.string.smart_pixels_warning_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsProto.MetricsEvent.CHERISH_SETTINGS;
|
||||
}
|
||||
}
|
||||
@@ -109,10 +109,6 @@ public class StatusBarBattery extends SettingsPreferenceFragment
|
||||
Settings.System.STATUS_BAR_SHOW_BATTERY_PERCENT, 0, UserHandle.USER_CURRENT);
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.STATUS_BAR_BATTERY_TEXT_CHARGING, 1, UserHandle.USER_CURRENT);
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.QS_BATTERY_STYLE, -1, UserHandle.USER_CURRENT);
|
||||
Settings.System.putIntForUser(resolver,
|
||||
Settings.System.QS_SHOW_BATTERY_PERCENT, 2, UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,16 @@ import java.util.Collections;
|
||||
|
||||
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
|
||||
public class StatusBarSettings extends SettingsPreferenceFragment implements
|
||||
OnPreferenceChangeListener {
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private static final String VOLTE_ICON_STYLE = "volte_icon_style";
|
||||
private static final String VOWIFI_ICON_STYLE = "vowifi_icon_style";
|
||||
|
||||
private Preference mCombinedSignalIcons;
|
||||
|
||||
private SystemSettingListPreference mVolteIconStyle;
|
||||
private SystemSettingListPreference mVowifiIconStyle;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
@@ -56,11 +65,43 @@ public class StatusBarSettings extends SettingsPreferenceFragment implements
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
|
||||
PreferenceScreen prefSet = getPreferenceScreen();
|
||||
mVowifiIconStyle = (SystemSettingListPreference) findPreference(VOWIFI_ICON_STYLE);
|
||||
mVolteIconStyle = (SystemSettingListPreference) findPreference(VOLTE_ICON_STYLE);
|
||||
|
||||
int vowifiIconStyle = Settings.System.getInt(getActivity().getContentResolver(),
|
||||
Settings.System.VOWIFI_ICON_STYLE, 1);
|
||||
mVowifiIconStyle.setValue(String.valueOf(vowifiIconStyle));
|
||||
mVowifiIconStyle.setOnPreferenceChangeListener(this);
|
||||
if (vowifiIconStyle == 0) {
|
||||
mVolteIconStyle.setEnabled(true);
|
||||
} else {
|
||||
mVolteIconStyle.setEnabled(false);
|
||||
}
|
||||
|
||||
mCombinedSignalIcons = findPreference("persist.sys.flags.combined_signal_icons");
|
||||
mCombinedSignalIcons.setOnPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object objValue) {
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
ContentResolver resolver = getActivity().getContentResolver();
|
||||
if (preference == mVowifiIconStyle) {
|
||||
int vowifiIconStyle = Integer.parseInt(((String) newValue).toString());
|
||||
Settings.System.putInt(resolver,
|
||||
Settings.System.VOWIFI_ICON_STYLE, vowifiIconStyle);
|
||||
mVowifiIconStyle.setValue(String.valueOf(vowifiIconStyle));
|
||||
if (vowifiIconStyle == 0) {
|
||||
mVolteIconStyle.setEnabled(true);
|
||||
} else {
|
||||
mVolteIconStyle.setEnabled(false);
|
||||
}
|
||||
return true;
|
||||
} else if (preference == mCombinedSignalIcons) {
|
||||
boolean value = (Boolean) newValue;
|
||||
Settings.Secure.putIntForUser(getContentResolver(),
|
||||
Settings.Secure.ENABLE_COMBINED_SIGNAL_ICONS, value ? 1 : 0, UserHandle.USER_CURRENT);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Project Kaleidoscope
|
||||
*
|
||||
* 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.cherish.settings.preferences;
|
||||
|
||||
import android.os.SystemProperties;
|
||||
import android.preference.PreferenceDataStore;
|
||||
|
||||
public class SystemPropertiesStore extends androidx.preference.PreferenceDataStore
|
||||
implements PreferenceDataStore {
|
||||
|
||||
public SystemPropertiesStore() {
|
||||
}
|
||||
|
||||
public boolean getBoolean(String key, boolean defValue) {
|
||||
return SystemProperties.getBoolean(key, defValue);
|
||||
}
|
||||
|
||||
public int getInt(String key, int defValue) {
|
||||
return SystemProperties.getInt(key, defValue);
|
||||
}
|
||||
|
||||
public long getLong(String key, long defValue) {
|
||||
return SystemProperties.getLong(key, defValue);
|
||||
}
|
||||
|
||||
public String getString(String key, String defValue) {
|
||||
return SystemProperties.get(key, defValue);
|
||||
}
|
||||
|
||||
public void putBoolean(String key, boolean value) {
|
||||
putString(key, value ? "1" : "0");
|
||||
}
|
||||
|
||||
public void putInt(String key, int value) {
|
||||
putString(key, Integer.toString(value));
|
||||
}
|
||||
|
||||
public void putLong(String key, long value) {
|
||||
putString(key, Long.toString(value));
|
||||
}
|
||||
|
||||
public void putString(String key, String value) {
|
||||
SystemProperties.set(key, value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The CyanogenMod Project
|
||||
* Copyright (C) 2017 AICP
|
||||
* Copyright (C) 2022 Project Kaleidoscope
|
||||
*
|
||||
* 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.cherish.settings.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
public class SystemPropertySwitchPreference extends SwitchPreference {
|
||||
|
||||
public SystemPropertySwitchPreference(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
setPreferenceDataStore(new SystemPropertiesStore());
|
||||
}
|
||||
|
||||
public SystemPropertySwitchPreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
setPreferenceDataStore(new SystemPropertiesStore());
|
||||
}
|
||||
|
||||
public SystemPropertySwitchPreference(Context context) {
|
||||
super(context);
|
||||
setPreferenceDataStore(new SystemPropertiesStore());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
|
||||
// This is what default TwoStatePreference implementation is doing without respecting
|
||||
// real default value:
|
||||
//setChecked(restoreValue ? getPersistedBoolean(mChecked)
|
||||
// : (Boolean) defaultValue);
|
||||
// Instead, we better do
|
||||
setChecked(restoreValue ? getPersistedBoolean((Boolean) defaultValue)
|
||||
: (Boolean) defaultValue);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 cherishOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
import android.hardware.biometrics.BiometricManager
|
||||
import android.hardware.biometrics.BiometricManager.Authenticators.BIOMETRIC_STRONG
|
||||
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
|
||||
import com.cherish.settings.CherishTogglePreferenceController
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private const val KEY = "app_lock_biometrics_allowed"
|
||||
|
||||
class AppLockBiometricPreferenceController(
|
||||
context: Context,
|
||||
private val coroutineScope: CoroutineScope
|
||||
) : CherishTogglePreferenceController(context, KEY) {
|
||||
|
||||
private val appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
private val biometricManager = context.getSystemService(BiometricManager::class.java)
|
||||
|
||||
private var preference: Preference? = null
|
||||
private var isBiometricsAllowed = false
|
||||
|
||||
init {
|
||||
coroutineScope.launch {
|
||||
isBiometricsAllowed = withContext(Dispatchers.Default) {
|
||||
appLockManager.isBiometricsAllowed()
|
||||
}
|
||||
preference?.let {
|
||||
updateState(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus(): Int {
|
||||
val result = biometricManager.canAuthenticate(BIOMETRIC_STRONG)
|
||||
return if (result == BiometricManager.BIOMETRIC_SUCCESS) AVAILABLE else CONDITIONALLY_UNAVAILABLE
|
||||
}
|
||||
|
||||
override fun isChecked() = isBiometricsAllowed
|
||||
|
||||
override fun setChecked(checked: Boolean): Boolean {
|
||||
if (isBiometricsAllowed == checked) return false
|
||||
isBiometricsAllowed = checked
|
||||
coroutineScope.launch(Dispatchers.Default) {
|
||||
appLockManager.setBiometricsAllowed(isBiometricsAllowed)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
preference = screen.findPreference(preferenceKey)
|
||||
}
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2014 The Android Open Source Project
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.hardware.biometrics.BiometricConstants
|
||||
import android.hardware.biometrics.BiometricManager.Authenticators
|
||||
import android.hardware.biometrics.BiometricPrompt
|
||||
import android.hardware.biometrics.BiometricPrompt.AuthenticationCallback
|
||||
import android.hardware.biometrics.PromptInfo
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.UserHandle.USER_NULL
|
||||
import android.os.UserManager
|
||||
import android.util.Log
|
||||
import android.view.WindowManager
|
||||
|
||||
import androidx.fragment.app.commit
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils
|
||||
import com.android.settings.R
|
||||
import com.android.settings.password.BiometricFragment
|
||||
import com.android.settings.password.ConfirmDeviceCredentialUtils
|
||||
|
||||
class AppLockCredentialActivity : FragmentActivity() {
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
private lateinit var lockPatternUtils: LockPatternUtils
|
||||
private lateinit var userManager: UserManager
|
||||
private lateinit var appLockManager: AppLockManager
|
||||
|
||||
private var packageName: String? = null
|
||||
private var title: String? = null
|
||||
private var userId: Int = USER_NULL
|
||||
private var biometricFragment: BiometricFragment? = null
|
||||
private var goingToBackground = false
|
||||
private var waitingForBiometricCallback = false
|
||||
|
||||
private val authenticationCallback = object : AuthenticationCallback() {
|
||||
override fun onAuthenticationError(errorCode: Int, errString: CharSequence) {
|
||||
if (!goingToBackground) {
|
||||
waitingForBiometricCallback = false
|
||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
||||
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
||||
finish()
|
||||
}
|
||||
} else if (waitingForBiometricCallback) { // goingToBackground is true
|
||||
waitingForBiometricCallback = false
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
|
||||
waitingForBiometricCallback = false
|
||||
appLockManager.unlockPackage(packageName)
|
||||
ConfirmDeviceCredentialUtils.checkForPendingIntent(this@AppLockCredentialActivity)
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
waitingForBiometricCallback = false
|
||||
}
|
||||
|
||||
override fun onSystemEvent(event: Int) {
|
||||
if (event == BiometricConstants.BIOMETRIC_SYSTEM_EVENT_EARLY_USER_CANCEL) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
window.apply {
|
||||
addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
statusBarColor = Color.TRANSPARENT
|
||||
}
|
||||
|
||||
appLockManager = getSystemService(AppLockManager::class.java)
|
||||
userManager = UserManager.get(this)
|
||||
lockPatternUtils = LockPatternUtils(this)
|
||||
|
||||
packageName = intent.getStringExtra(Intent.EXTRA_PACKAGE_NAME)
|
||||
if (packageName == null) {
|
||||
Log.e(TAG, "Failed to get package name, aborting unlock")
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
title = intent.getStringExtra(AppLockManager.EXTRA_PACKAGE_LABEL)
|
||||
|
||||
userId = intent.getIntExtra(Intent.EXTRA_USER_ID, USER_NULL)
|
||||
if (userId == USER_NULL) {
|
||||
Log.e(TAG, "Invalid user id, aborting")
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
val biometricsAllowed = intent.getBooleanExtra(
|
||||
AppLockManager.EXTRA_ALLOW_BIOMETRICS,
|
||||
AppLockManager.DEFAULT_BIOMETRICS_ALLOWED
|
||||
)
|
||||
var authenticators = Authenticators.DEVICE_CREDENTIAL
|
||||
if (biometricsAllowed) {
|
||||
authenticators = authenticators or Authenticators.BIOMETRIC_STRONG
|
||||
}
|
||||
|
||||
val promptInfo = PromptInfo().also {
|
||||
it.title = getString(com.android.internal.R.string.unlock_application, title)
|
||||
it.isDisallowBiometricsIfPolicyExists = true
|
||||
it.authenticators = authenticators
|
||||
}
|
||||
|
||||
if (isBiometricAllowed()) {
|
||||
// Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
|
||||
// onAuthenticationError and do the right thing automatically.
|
||||
showBiometricPrompt(promptInfo)
|
||||
waitingForBiometricCallback = true
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
override protected fun onStart() {
|
||||
super.onStart()
|
||||
// Translucent activity that is "visible", so it doesn't complain about finish()
|
||||
// not being called before onResume().
|
||||
setVisible(true)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
if (!isChangingConfigurations()) {
|
||||
goingToBackground = true
|
||||
if (!waitingForBiometricCallback) {
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
goingToBackground = false
|
||||
}
|
||||
}
|
||||
|
||||
// User could be locked while Effective user is unlocked even though the effective owns the
|
||||
// credential. Otherwise, biometric can't unlock fbe/keystore through
|
||||
// verifyTiedProfileChallenge. In such case, we also wanna show the user message that
|
||||
// biometric is disabled due to device restart.
|
||||
private fun isStrongAuthRequired() =
|
||||
!lockPatternUtils.isBiometricAllowedForUser(userId) ||
|
||||
!userManager.isUserUnlocked(userId)
|
||||
|
||||
private fun isBiometricAllowed() =
|
||||
!isStrongAuthRequired() && !lockPatternUtils.hasPendingEscrowToken(userId)
|
||||
|
||||
private fun showBiometricPrompt(promptInfo: PromptInfo) {
|
||||
biometricFragment = supportFragmentManager.findFragmentByTag(TAG_BIOMETRIC_FRAGMENT)
|
||||
as? BiometricFragment
|
||||
var newFragment = false
|
||||
if (biometricFragment == null) {
|
||||
biometricFragment = BiometricFragment.newInstance(promptInfo)
|
||||
newFragment = true
|
||||
}
|
||||
biometricFragment?.also {
|
||||
it.setCallbacks({
|
||||
handler.post(it)
|
||||
}, authenticationCallback)
|
||||
it.setUser(userId)
|
||||
}
|
||||
if (newFragment) {
|
||||
biometricFragment?.let {
|
||||
supportFragmentManager.commit {
|
||||
add(it, TAG_BIOMETRIC_FRAGMENT)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AppLockCredentialActivity"
|
||||
private const val TAG_BIOMETRIC_FRAGMENT = "fragment"
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
|
||||
import com.cherish.settings.CherishTogglePreferenceController
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private const val KEY = "redact_notifications"
|
||||
|
||||
class AppLockNotificationRedactionPC(
|
||||
context: Context,
|
||||
private val packageName: String,
|
||||
private val coroutineScope: CoroutineScope
|
||||
) : CherishTogglePreferenceController(context, KEY) {
|
||||
|
||||
private val appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
private var shouldRedactNotification = false
|
||||
private var preference: Preference? = null
|
||||
|
||||
init {
|
||||
coroutineScope.launch {
|
||||
shouldRedactNotification = withContext(Dispatchers.Default) {
|
||||
appLockManager.packageData.find {
|
||||
it.packageName == packageName
|
||||
}?.shouldRedactNotification == true
|
||||
}
|
||||
preference?.let {
|
||||
updateState(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus() = AVAILABLE
|
||||
|
||||
override fun isChecked() = shouldRedactNotification
|
||||
|
||||
override fun setChecked(checked: Boolean): Boolean {
|
||||
if (shouldRedactNotification == checked) return false
|
||||
shouldRedactNotification = checked
|
||||
coroutineScope.launch(Dispatchers.Default) {
|
||||
appLockManager.setShouldRedactNotification(packageName, checked)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
preference = screen.findPreference(preferenceKey)
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
||||
import com.android.settings.R
|
||||
import com.android.settings.widget.EntityHeaderController
|
||||
import com.android.settingslib.core.AbstractPreferenceController
|
||||
import com.android.settingslib.widget.LayoutPreference
|
||||
import com.cherish.settings.fragments.CherishDashboardFragment
|
||||
|
||||
private val TAG = AppLockPackageConfigFragment::class.simpleName
|
||||
private const val KEY_HEADER = "header_view"
|
||||
|
||||
class AppLockPackageConfigFragment : CherishDashboardFragment() {
|
||||
|
||||
private lateinit var pm: PackageManager
|
||||
private lateinit var packageInfo: PackageInfo
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
pm = context.packageManager
|
||||
packageInfo = arguments?.getParcelable(PACKAGE_INFO, PackageInfo::class.java)!!
|
||||
super.onAttach(context)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey)
|
||||
val header = preferenceScreen.findPreference<LayoutPreference>(KEY_HEADER)
|
||||
EntityHeaderController.newInstance(
|
||||
requireActivity(),
|
||||
this,
|
||||
header?.findViewById(R.id.entity_header)
|
||||
).setRecyclerView(listView, settingsLifecycle)
|
||||
.setPackageName(packageInfo.packageName)
|
||||
.setButtonActions(
|
||||
EntityHeaderController.ActionType.ACTION_NONE,
|
||||
EntityHeaderController.ActionType.ACTION_NONE
|
||||
)
|
||||
.bindHeaderButtons()
|
||||
.setLabel(getLabel(packageInfo))
|
||||
.setIcon(getIcon(packageInfo))
|
||||
.done(requireActivity(), false /* rebindActions */)
|
||||
}
|
||||
|
||||
private fun getLabel(packageInfo: PackageInfo) =
|
||||
packageInfo.applicationInfo.loadLabel(pm).toString()
|
||||
|
||||
private fun getIcon(packageInfo: PackageInfo) =
|
||||
packageInfo.applicationInfo.loadIcon(pm)
|
||||
|
||||
override protected fun createPreferenceControllers(
|
||||
context: Context
|
||||
) : List<AbstractPreferenceController> = listOf(
|
||||
AppLockPackageProtectionPC(context, packageInfo.packageName, lifecycleScope),
|
||||
AppLockNotificationRedactionPC(context, packageInfo.packageName, lifecycleScope),
|
||||
)
|
||||
|
||||
override protected fun getPreferenceScreenResId() = R.xml.app_lock_package_config_settings
|
||||
|
||||
override protected fun getLogTag() = TAG
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageInfo
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.pm.PackageManager.PackageInfoFlags
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.forEach
|
||||
|
||||
import com.android.settings.R
|
||||
import com.android.settings.core.SubSettingLauncher
|
||||
import com.android.settingslib.PrimarySwitchPreference
|
||||
import com.android.settingslib.widget.TwoTargetPreference.ICON_SIZE_SMALL
|
||||
import com.cherish.settings.fragments.CherishDashboardFragment
|
||||
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private val TAG = AppLockPackageListFragment::class.simpleName
|
||||
internal const val PACKAGE_INFO = "package_info"
|
||||
|
||||
class AppLockPackageListFragment : CherishDashboardFragment() {
|
||||
|
||||
private lateinit var appLockManager: AppLockManager
|
||||
private lateinit var pm: PackageManager
|
||||
private lateinit var whiteListedPackages: Array<String>
|
||||
|
||||
override fun onAttach(context: Context) {
|
||||
super.onAttach(context)
|
||||
appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
pm = context.packageManager
|
||||
whiteListedPackages = resources.getStringArray(
|
||||
com.android.internal.R.array.config_appLockAllowedSystemApps)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey)
|
||||
lifecycleScope.launch {
|
||||
val selectedPackages = getSelectedPackages()
|
||||
val preferences = withContext(Dispatchers.Default) {
|
||||
pm.getInstalledPackages(
|
||||
PackageInfoFlags.of(PackageManager.MATCH_ALL.toLong())
|
||||
).filter {
|
||||
!it.applicationInfo.isSystemApp() || whiteListedPackages.contains(it.packageName)
|
||||
}.sortedWith { first, second ->
|
||||
getLabel(first).compareTo(getLabel(second))
|
||||
}
|
||||
}.map { packageInfo ->
|
||||
createPreference(packageInfo, selectedPackages.contains(packageInfo.packageName))
|
||||
}
|
||||
preferenceScreen?.let {
|
||||
preferences.forEach { pref ->
|
||||
it.addPreference(pref)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
lifecycleScope.launch {
|
||||
val selectedPackages = getSelectedPackages()
|
||||
preferenceScreen?.forEach {
|
||||
if (it is PrimarySwitchPreference) {
|
||||
it.isChecked = selectedPackages.contains(it.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getSelectedPackages(): Set<String> {
|
||||
return withContext(Dispatchers.IO) {
|
||||
appLockManager.packageData.map { it.packageName }.toSet()
|
||||
}
|
||||
}
|
||||
|
||||
private fun getLabel(packageInfo: PackageInfo) =
|
||||
packageInfo.applicationInfo.loadLabel(pm).toString()
|
||||
|
||||
private fun createPreference(packageInfo: PackageInfo, isProtected: Boolean): Preference {
|
||||
val label = getLabel(packageInfo)
|
||||
return PrimarySwitchPreference(requireContext()).apply {
|
||||
key = packageInfo.packageName
|
||||
title = label
|
||||
icon = packageInfo.applicationInfo.loadIcon(pm)
|
||||
setIconSize(ICON_SIZE_SMALL)
|
||||
isChecked = isProtected
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
if (newValue as Boolean) {
|
||||
appLockManager.addPackage(packageInfo.packageName)
|
||||
} else {
|
||||
appLockManager.removePackage(packageInfo.packageName)
|
||||
}
|
||||
}
|
||||
return@setOnPreferenceChangeListener true
|
||||
}
|
||||
setOnPreferenceClickListener {
|
||||
SubSettingLauncher(requireContext())
|
||||
.setDestination(AppLockPackageConfigFragment::class.qualifiedName)
|
||||
.setSourceMetricsCategory(metricsCategory)
|
||||
.setTitleText(label)
|
||||
.setArguments(
|
||||
Bundle(1).apply {
|
||||
putParcelable(PACKAGE_INFO, packageInfo)
|
||||
}
|
||||
)
|
||||
.launch()
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override protected fun getPreferenceScreenResId() = R.xml.app_lock_package_list_settings
|
||||
|
||||
override protected fun getLogTag() = TAG
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
|
||||
import com.cherish.settings.CherishTogglePreferenceController
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
private const val KEY = "main_switch"
|
||||
|
||||
class AppLockPackageProtectionPC(
|
||||
context: Context,
|
||||
private val packageName: String,
|
||||
private val coroutineScope: CoroutineScope
|
||||
) : CherishTogglePreferenceController(context, KEY) {
|
||||
|
||||
private val appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
private var isProtected = false
|
||||
private var preference: Preference? = null
|
||||
|
||||
init {
|
||||
coroutineScope.launch {
|
||||
isProtected = withContext(Dispatchers.Default) {
|
||||
appLockManager.packageData.any {
|
||||
it.packageName == packageName
|
||||
}
|
||||
}
|
||||
preference?.let {
|
||||
updateState(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus() = AVAILABLE
|
||||
|
||||
override fun isChecked() = isProtected
|
||||
|
||||
override fun setChecked(checked: Boolean): Boolean {
|
||||
if (isProtected == checked) return false
|
||||
isProtected = checked
|
||||
coroutineScope.launch(Dispatchers.Default) {
|
||||
if (isProtected) {
|
||||
appLockManager.addPackage(packageName)
|
||||
} else {
|
||||
appLockManager.removePackage(packageName)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
preference = screen.findPreference(preferenceKey)
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.content.Context
|
||||
import android.os.SystemProperties
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
|
||||
import com.android.settings.R
|
||||
import com.android.settings.search.BaseSearchIndexProvider
|
||||
import com.android.settingslib.core.AbstractPreferenceController
|
||||
import com.android.settingslib.search.SearchIndexable
|
||||
import com.cherish.settings.fragments.CherishDashboardFragment
|
||||
|
||||
@SearchIndexable
|
||||
class AppLockSettingsFragment : CherishDashboardFragment(),
|
||||
MenuItem.OnMenuItemClickListener {
|
||||
|
||||
private var debugEnabled = SystemProperties.get(DEBUG_PROPERTY, null) == LEVEL_DEBUG
|
||||
private var handledClick = false
|
||||
|
||||
override protected fun getPreferenceScreenResId() = R.xml.cherish_settings_app_lock
|
||||
|
||||
override protected fun getLogTag() = TAG
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, menuInflater: MenuInflater) {
|
||||
super.onCreateOptionsMenu(menu, menuInflater)
|
||||
menu.add(
|
||||
0 /* groupId */,
|
||||
MENU_ITEM_DEBUG_ID,
|
||||
0 /* order */,
|
||||
getDebugMenuItemTitle(),
|
||||
).setOnMenuItemClickListener(this)
|
||||
}
|
||||
|
||||
private fun getDebugMenuItemTitle(): Int =
|
||||
if (debugEnabled) R.string.disable_debugging else R.string.enable_debugging
|
||||
|
||||
override fun onMenuItemClick(item: MenuItem): Boolean {
|
||||
if (item.itemId == MENU_ITEM_DEBUG_ID) {
|
||||
debugEnabled = !debugEnabled
|
||||
SystemProperties.set(DEBUG_PROPERTY, if (debugEnabled) LEVEL_DEBUG else null)
|
||||
item.setTitle(getDebugMenuItemTitle())
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
override protected fun createPreferenceControllers(
|
||||
context: Context
|
||||
) : List<AbstractPreferenceController> = listOf(
|
||||
AppLockBiometricPreferenceController(context, lifecycleScope)
|
||||
)
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AppLockSettingsFragment"
|
||||
|
||||
private const val DEBUG_PROPERTY = "log.tag.AppLockManagerService"
|
||||
private const val LEVEL_DEBUG = "DEBUG"
|
||||
private const val MENU_ITEM_DEBUG_ID = 101
|
||||
|
||||
@JvmField
|
||||
val SEARCH_INDEX_DATA_PROVIDER = BaseSearchIndexProvider(R.xml.cherish_settings_app_lock)
|
||||
}
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.UserHandle
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts.StartActivityForResult
|
||||
import androidx.lifecycle.Lifecycle.Event
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceScreen
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils
|
||||
import com.android.settings.R
|
||||
import com.android.settings.core.SubSettingLauncher
|
||||
import com.android.settings.dashboard.DashboardFragment
|
||||
import com.android.settings.password.ConfirmDeviceCredentialActivity
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle
|
||||
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType.TRANSITION_SLIDE
|
||||
import com.android.settings.core.BasePreferenceController
|
||||
|
||||
import com.android.settings.SettingsActivity
|
||||
import com.android.settings.core.SettingsBaseActivity
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider
|
||||
|
||||
class AppLockSettingsPreferenceController(
|
||||
context: Context,
|
||||
preferenceKey: String,
|
||||
lifecycle: Lifecycle?,
|
||||
private val host: DashboardFragment?
|
||||
) : BasePreferenceController(context, preferenceKey),
|
||||
LifecycleEventObserver {
|
||||
|
||||
private val lockPatternUtils = LockPatternUtils(context)
|
||||
private val appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
private var preference: Preference? = null
|
||||
private val securityPromptLauncher: ActivityResultLauncher<Intent>?
|
||||
|
||||
init {
|
||||
lifecycle?.addObserver(this)
|
||||
securityPromptLauncher = host?.registerForActivityResult(
|
||||
StartActivityForResult()
|
||||
) {
|
||||
if (it?.resultCode == Activity.RESULT_OK) {
|
||||
val intent = SubSettingLauncher(mContext)
|
||||
.setDestination(AppLockSettingsFragment::class.qualifiedName)
|
||||
.setSourceMetricsCategory(host.metricsCategory)
|
||||
.setTransitionType(TRANSITION_SLIDE)
|
||||
.toIntent()
|
||||
intent.setClass(mContext, AppLockSubSettings::class.java)
|
||||
mContext.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus() =
|
||||
if (lockPatternUtils.isSecure(UserHandle.myUserId()))
|
||||
AVAILABLE
|
||||
else
|
||||
DISABLED_DEPENDENT_SETTING
|
||||
|
||||
override fun onStateChanged(owner: LifecycleOwner, event: Event) {
|
||||
if (event == Event.ON_START) {
|
||||
preference?.let {
|
||||
updateState(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
super.displayPreference(screen)
|
||||
preference = screen.findPreference(preferenceKey)
|
||||
}
|
||||
|
||||
override fun updateState(preference: Preference) {
|
||||
preference.apply {
|
||||
if (getAvailabilityStatus() == AVAILABLE) {
|
||||
setEnabled(true)
|
||||
summary = getSummaryForListSize(appLockManager.packageData.size)
|
||||
} else {
|
||||
setEnabled(false)
|
||||
summary = mContext.getString(R.string.disabled_because_no_backup_security)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSummaryForListSize(size: Int): CharSequence? =
|
||||
if (size == 0) {
|
||||
null
|
||||
} else {
|
||||
mContext.resources.getQuantityString(R.plurals.app_lock_summary, size, size)
|
||||
}
|
||||
|
||||
override fun handlePreferenceTreeClick(preference: Preference): Boolean {
|
||||
if (preference.key == preferenceKey && securityPromptLauncher != null) {
|
||||
securityPromptLauncher.launch(
|
||||
ConfirmDeviceCredentialActivity.createIntent(
|
||||
mContext.getString(R.string.app_lock_authentication_dialog_title),
|
||||
null /* details */,
|
||||
)
|
||||
)
|
||||
return true
|
||||
}
|
||||
return super.handlePreferenceTreeClick(preference)
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import com.android.settings.SettingsActivity
|
||||
|
||||
class AppLockSubSettings : SettingsActivity() {
|
||||
|
||||
override protected fun isValidFragment(fragmentName: String): Boolean {
|
||||
return AppLockSettingsFragment::class.qualifiedName == fragmentName
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 FlamingoOS 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.
|
||||
*/
|
||||
|
||||
package com.cherish.settings.security.applock
|
||||
|
||||
import android.app.AppLockManager
|
||||
import android.content.Context
|
||||
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
|
||||
import com.android.settings.core.BasePreferenceController
|
||||
|
||||
class AppLockTimeoutPreferenceController(
|
||||
context: Context,
|
||||
key: String,
|
||||
) : BasePreferenceController(context, key),
|
||||
Preference.OnPreferenceChangeListener {
|
||||
|
||||
private val appLockManager = context.getSystemService(AppLockManager::class.java)
|
||||
|
||||
override fun getAvailabilityStatus() = AVAILABLE
|
||||
|
||||
override fun updateState(preference: Preference) {
|
||||
(preference as ListPreference).value = appLockManager.timeout.takeIf {
|
||||
it != -1L
|
||||
}?.toString()
|
||||
}
|
||||
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
|
||||
appLockManager.timeout = (newValue as String).toLong()
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user