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

Commit ce946a63 authored by Danny Lin's avatar Danny Lin Committed by Nishith Khanna
Browse files

SystemUI: Add dual-tone light and dark themes for QS

Google's dual-tone QS design where the notification panel has a
semantically higher elevation adds depth to the notification+QS shade,
and we don't necessarily have to give it up just because our QS has
light and dark themes.

To preserve the dual-tone effect, use a darker background color for the
QS section:

Light:
    Notifications: neutral1 20 (surface_light)
    Notification panel: neutral1 50 (light BG)
    QS background: neutral1 100 (darker light BG / surface_header_light)
    Inactive QS tiles: neutral1 20 (surface_light)

Dark:
    Notifications: neutral1 800 (surface_dark)
    Notification panel: neutral1 900 (dark BG)
    QS background: neutral1 950 (surface_header_dark_sysui modulated to L* 5)
    Inactive QS tiles: neutral1 800 (surface_dark)

The dark QS background could be neutral1 0 (black) like it was before,
but I don't think it looks as good because it can't be tinted based on
the active wallpaper and thus stands out from other colors.

Unfortunately, Google's current CAM16-based modulation causes hue shifts
in extreme light and dark shades (e.g. L* = 98 / 5), but we'll fix this
by generating and overlaying modulated surface colors in our
ThemeOverlayController implementation.

Demo screenshots: https://twitter.com/kdrag0n/status/1445922541218922496



Change-Id: Icdc4957ecb4e0201377351f1a3e1c6928d6b3955
Signed-off-by: default avatarPainKiller3 <ninadpatil100@gmail.com>
Signed-off-by: default avatarSaalim Quadri <danascape@gmail.com>
parent 243c300b
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2021 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:color="@color/system_neutral1_500" android:lStar="5" />
</selector>
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
        <item name="colorSecondary">@color/secondary_device_default_settings</item>
        <item name="colorAccent">@color/accent_device_default_dark</item>
        <item name="colorError">@color/error_color_device_default_dark</item>
        <item name="colorSurfaceHeader">@color/surface_header_dark_sysui</item>
        <item name="colorControlNormal">?attr/textColorPrimary</item>
        <item name="alertDialogTheme">@style/Theme.DeviceDefault.Dialog.Alert</item>
        <item name="forceDarkAllowed">false</item>
+11 −1
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.internal.util.function.TriConsumer;
import com.android.keyguard.BouncerPanelExpansionCalculator;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.settingslib.Utils;
import com.android.systemui.Dumpable;
import com.android.systemui.Flags;
import com.android.systemui.animation.ShadeInterpolation;
@@ -247,6 +248,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
    private final KeyguardInteractor mKeyguardInteractor;

    private GradientColors mColors;
    private GradientColors mBehindColors;
    private boolean mNeedsDrawableColorUpdate;

    private float mAdditionalScrimBehindAlphaKeyguard = 0f;
@@ -415,6 +417,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
        mKeyguardTransitionInteractor = keyguardTransitionInteractor;
        mKeyguardInteractor = keyguardInteractor;
        mMainDispatcher = mainDispatcher;
        mBehindColors = new GradientColors();
    }

    /**
@@ -1265,7 +1268,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
                    && !mBlankScreen;

            mScrimInFront.setColors(mColors, animateScrimInFront);
            mScrimBehind.setColors(mColors, animateBehindScrim);
            mScrimBehind.setColors(mBehindColors, animateBehindScrim);
            mNotificationsScrim.setColors(mColors, animateScrimNotifications);

            dispatchBackScrimState(mScrimBehind.getViewAlpha());
@@ -1621,6 +1624,8 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
        if (mScrimBehind == null) return;
        int background = mContext.getColor(
                com.android.internal.R.color.materialColorSurfaceDim);
        int surfaceBackground = Utils.getColorAttr(mScrimBehind.getContext(),
                com.android.internal.R.attr.colorSurfaceHeader).getDefaultColor();
        int accent = mContext.getColor(
                com.android.internal.R.color.materialColorPrimary);
        mColors.setMainColor(background);
@@ -1634,6 +1639,11 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
            state.setSurfaceColor(surface);
        }

        mBehindColors.setMainColor(surfaceBackground);
        mBehindColors.setSecondaryColor(accent);
        mBehindColors.setSupportsDarkText(
                ColorUtils.calculateContrast(mBehindColors.getMainColor(), Color.WHITE) > 4.5);

        mNeedsDrawableColorUpdate = true;
    }