Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aad4eac7 authored by menghanli's avatar menghanli
Browse files

Implement color correction quick settings tile service

1. Integrate color correction quick settings tile with SettingsProvider changes.
2. Handling long-pressed action for Color Correction Quick Settings
3. Config Color Correction Quick Settings tile to auto-added

Bug: 209888145
Test: manually test color correction quick settings tile actions
Test: atest QSFactoryImplTest ColorCorrectionTileTest
Change-Id: I2e461d4a92b90435175ecfd708dc8767ca6e6f41
parent c2dc611a
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -390,6 +390,21 @@ public final class Settings {
    public static final String ACTION_REDUCE_BRIGHT_COLORS_SETTINGS =
            "android.settings.REDUCE_BRIGHT_COLORS_SETTINGS";
    /**
     * Activity Action: Show settings to allow configuration of Color correction.
     * <p>
     * In some cases, a matching Activity may not exist, so ensure you
     * safeguard against this.
     * <p>
     * Input: Nothing.
     * <p>
     * Output: Nothing.
     * @hide
     */
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_COLOR_CORRECTION_SETTINGS =
            "com.android.settings.ACCESSIBILITY_COLOR_SPACE_SETTINGS";
    /**
     * Activity Action: Show settings to allow configuration of Color inversion.
     * <p>
+24 −0
Original line number Diff line number Diff line
<!--
    Copyright (C) 2022 The Android Open Source 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24">
    <path
        android:fillColor="#ffffff"
        android:pathData="M3,21v-4.75l8.95,-8.95 -1.45,-1.4 1.45,-1.4 1.9,1.9 3.1,-3.1q0.275,-0.275 0.7,-0.275 0.425,0 0.7,0.275l2.35,2.35q0.275,0.275 0.275,0.7 0,0.425 -0.275,0.7l-3.075,3.075 1.9,1.95L18.1,13.5l-1.4,-1.45L7.75,21zM5,19h1.95l8.3,-8.35 -1.9,-1.9L5,17.05z"/>
</vector>
+2 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,fgsmanager
        internet,bt,flashlight,dnd,alarm,airplane,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,fgsmanager,color_correction
    </string>

    <!-- The tiles to display in QuickSettings -->
@@ -97,6 +97,7 @@
         The syntax is setting-name:spec. If the tile is a TileService, the spec should be specified
         as custom(package/class). Relative class name is supported. -->
    <string-array name="config_quickSettingsAutoAdd" translatable="false">
        <item>accessibility_display_daltonizer_enabled:color_correction</item>
        <item>accessibility_display_inversion_enabled:inversion</item>
        <item>one_handed_mode_enabled:onehanded</item>
    </string-array>
+1 −0
Original line number Diff line number Diff line
@@ -632,6 +632,7 @@
    <!-- QuickSettings: Label for the toggle that controls whether display inversion is enabled. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_inversion_label">Color inversion</string>
    <!-- QuickSettings: Label for the toggle that controls whether display color correction is enabled. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_color_correction_label">Color correction</string>
    <!-- QuickSettings: Control panel: Label for button that navigates to settings. [CHAR LIMIT=NONE] -->
    <string name="quick_settings_more_settings">More settings</string>
    <!-- QuickSettings: Control panel: Label for button that navigates to user settings. [CHAR LIMIT=NONE] -->
+10 −0
Original line number Diff line number Diff line
@@ -142,6 +142,16 @@
        <item>On</item>
    </string-array>

    <!-- State names for color correction tile: unavailable, off, on.
         This subtitle is shown when the tile is in that particular state but does not set its own
         subtitle, so some of these may never appear on screen. They should still be translated as
         if they could appear. [CHAR LIMIT=32] -->
    <string-array name="tile_states_color_correction">
        <item>Unavailable</item>
        <item>Off</item>
        <item>On</item>
    </string-array>

    <!-- State names for (color) inversion tile: unavailable, off, on.
         This subtitle is shown when the tile is in that particular state but does not set its own
         subtitle, so some of these may never appear on screen. They should still be translated as
Loading