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

Commit 22f46a86 authored by Lyn Han's avatar Lyn Han
Browse files

Clear quick settings backgrounds, update clock text color

- remove qs gradient background
- remove qs status bar black background
- update qs status bar clock onColorsChanged (match notif label colors)
- update status bar clock onDarkChanged

Bug: 172289783
Test: visual
   - qs & qs header background clear
   - observe sb clock - wallpaper light ? text dark : text white
   - observe qs clock - scrim light ? text dark : text white

Change-Id: Iff0aad81511c2cbc9ed9ecfcda03fda45d5001ae
parent f2977dda
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -29,25 +29,6 @@
        android:elevation="4dp"
        android:background="@drawable/qs_background_primary" />

    <!-- Black part behind the status bar -->
    <View
        android:id="@+id/quick_settings_status_bar_background"
        android:layout_width="match_parent"
        android:layout_height="@*android:dimen/quick_qs_offset_height"
        android:clipToPadding="false"
        android:clipChildren="false"
        android:background="#ff000000" />

    <!-- Gradient view behind QS -->
    <View
        android:id="@+id/quick_settings_gradient_view"
        android:layout_width="match_parent"
        android:layout_height="126dp"
        android:layout_marginTop="@*android:dimen/quick_qs_offset_height"
        android:clipToPadding="false"
        android:clipChildren="false"
        android:background="@drawable/qs_bg_gradient" />

    <com.android.systemui.qs.NonInterceptingScrollView
        android:id="@+id/expanded_qs_scroll_view"
        android:layout_width="match_parent"
+1 −2
Original line number Diff line number Diff line
@@ -43,8 +43,7 @@
        android:paddingStart="@dimen/status_bar_left_clock_starting_padding"
        android:paddingEnd="@dimen/status_bar_left_clock_end_padding"
        android:singleLine="true"
        android:textAppearance="@style/TextAppearance.StatusBar.Clock"
        systemui:showDark="false" />
        android:textAppearance="@style/TextAppearance.StatusBar.Clock" />
    </LinearLayout>

    <android.widget.Space
+1 −18
Original line number Diff line number Diff line
@@ -65,8 +65,6 @@ public class QSContainerImpl extends FrameLayout {
    private View mQSPanelContainer;

    private View mBackground;
    private View mBackgroundGradient;
    private View mStatusBarBackground;

    private int mSideMargins;
    private boolean mQsDisabled;
@@ -86,8 +84,6 @@ public class QSContainerImpl extends FrameLayout {
        mQSCustomizer = findViewById(R.id.qs_customize);
        mDragHandle = findViewById(R.id.qs_drag_handle_view);
        mBackground = findViewById(R.id.quick_settings_background);
        mStatusBarBackground = findViewById(R.id.quick_settings_status_bar_background);
        mBackgroundGradient = findViewById(R.id.quick_settings_gradient_view);
        mHeader.getHeaderQsPanel().setMediaVisibilityChangedListener((visible) -> {
            if (mHeader.getHeaderQsPanel().isShown()) {
                mAnimateBottomOnNextLayout = true;
@@ -117,7 +113,6 @@ public class QSContainerImpl extends FrameLayout {
    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setBackgroundGradientVisibility(newConfig);
        mSizePoint.set(0, 0); // Will be retrieved on next measure pass.
    }

@@ -186,7 +181,6 @@ public class QSContainerImpl extends FrameLayout {
        final boolean disabled = (state2 & DISABLE2_QUICK_SETTINGS) != 0;
        if (disabled == mQsDisabled) return;
        mQsDisabled = disabled;
        setBackgroundGradientVisibility(getResources().getConfiguration());
        mBackground.setVisibility(mQsDisabled ? View.GONE : View.VISIBLE);
    }

@@ -252,16 +246,6 @@ public class QSContainerImpl extends FrameLayout {
                + mHeader.getHeight();
    }

    private void setBackgroundGradientVisibility(Configuration newConfig) {
        if (newConfig.orientation == ORIENTATION_LANDSCAPE) {
            mBackgroundGradient.setVisibility(View.INVISIBLE);
            mStatusBarBackground.setVisibility(View.INVISIBLE);
        } else {
            mBackgroundGradient.setVisibility(mQsDisabled ? View.INVISIBLE : View.VISIBLE);
            mStatusBarBackground.setVisibility(View.VISIBLE);
        }
    }

    public void setExpansion(float expansion) {
        mQsExpansion = expansion;
        mDragHandle.setAlpha(1.0f - expansion);
@@ -271,8 +255,7 @@ public class QSContainerImpl extends FrameLayout {
    private void updatePaddingsAndMargins(QSPanelController qsPanelController) {
        for (int i = 0; i < getChildCount(); i++) {
            View view = getChildAt(i);
            if (view == mStatusBarBackground || view == mBackgroundGradient
                    || view == mQSCustomizer) {
            if (view == mQSCustomizer) {
                // Some views are always full width or have dependent padding
                continue;
            }
+7 −11
Original line number Diff line number Diff line
@@ -137,10 +137,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn

        updateResources();

        Rect tintArea = new Rect(0, 0, 0, 0);
        // Set light text on the header icons because they will always be on a black background
        applyDarkness(R.id.clock, tintArea, 0, DarkIconDispatcher.DEFAULT_ICON_TINT);

        mClockView = findViewById(R.id.clock);
        mSpace = findViewById(R.id.space);

@@ -158,7 +154,14 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
                android.R.attr.colorForeground);
        float intensity = getColorIntensity(colorForeground);
        int fillColor = mDualToneHandler.getSingleColor(intensity);

        Rect tintArea = new Rect(0, 0, 0, 0);
        mBatteryRemainingIcon.onDarkChanged(tintArea, intensity, fillColor);

        // The quick settings status bar clock depends on the color of the background scrim and
        // can be different from the status bar clock color.
        mClockView.setTextColor(
                Utils.getColorAttrDefaultColor(mContext, R.attr.wallpaperTextColor));
    }

    void onAttach(TintedIconManager iconManager) {
@@ -231,13 +234,6 @@ public class QuickStatusBarHeader extends RelativeLayout implements LifecycleOwn
                !Objects.equals(originalAlarmText, mNextAlarmTextView.getText());
    }

    private void applyDarkness(int id, Rect tintArea, float intensity, int color) {
        View v = findViewById(id);
        if (v instanceof DarkReceiver) {
            ((DarkReceiver) v).onDarkChanged(tintArea, intensity, color);
        }
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
+14 −1
Original line number Diff line number Diff line
@@ -34,8 +34,10 @@ import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.LifecycleRegistry;

import com.android.internal.colorextraction.ColorExtractor;
import com.android.internal.logging.UiEventLogger;
import com.android.systemui.R;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.demomode.DemoMode;
import com.android.systemui.demomode.DemoModeController;
import com.android.systemui.plugins.ActivityStarter;
@@ -99,6 +101,9 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
    private boolean mMicCameraIndicatorsEnabled;
    private boolean mLocationIndicatorsEnabled;
    private boolean mPrivacyChipLogged;

    private SysuiColorExtractor mColorExtractor;
    private ColorExtractor.OnColorsChangedListener mOnColorsChangedListener;
    private int mRingerMode = AudioManager.RINGER_MODE_NORMAL;

    private final ZenModeController.Callback mZenModeControllerCallback = new Callback() {
@@ -216,7 +221,8 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
            CommandQueue commandQueue, DemoModeController demoModeController,
            UserTracker userTracker, QuickQSPanelController quickQSPanelController,
            QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder,
            PrivacyLogger privacyLogger) {
            PrivacyLogger privacyLogger,
            SysuiColorExtractor colorExtractor) {
        super(view);
        mZenModeController = zenModeController;
        mNextAlarmController = nextAlarmController;
@@ -246,6 +252,12 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader

        mIconManager = new StatusBarIconController.TintedIconManager(mIconContainer, mCommandQueue);
        mDemoModeReceiver = new ClockDemoModeReceiver(mClockView);
        mColorExtractor = colorExtractor;
        mOnColorsChangedListener = (extractor, which) -> {
            final boolean lightTheme = mColorExtractor.getNeutralColors().supportsDarkText();
            mClockView.onColorsChanged(lightTheme);
        };
        mColorExtractor.addOnColorsChangedListener(mOnColorsChangedListener);
    }

    @Override
@@ -281,6 +293,7 @@ class QuickStatusBarHeaderController extends ViewController<QuickStatusBarHeader
    protected void onViewDetached() {
        mRingerModeTracker.getRingerModeInternal().removeObservers(mLifecycleOwner);
        mClockView.setOnClickListener(null);
        mColorExtractor.removeOnColorsChangedListener(mOnColorsChangedListener);
        mNextAlarmContainer.setOnClickListener(null);
        mRingerContainer.setOnClickListener(null);
        mPrivacyChip.setOnClickListener(null);
Loading