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

Commit 0603c3a9 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "Apply a full shadow to HUNs when the shade is closed" into main

parents 016e6572 a2b11dfe
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -193,6 +193,16 @@ flag {
    }
}

flag {
    name: "notification_fix_hun_shadows"
    namespace: "systemui"
    description: "Fix HUN shadows when the shade is collapsed."
    bug: "440572084"
    metadata {
       purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "scene_container"
    namespace: "systemui"
+7 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ import android.view.View
import android.widget.FrameLayout
import androidx.test.filters.SmallTest
import com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.ShadeInterpolation.getContentAlpha
import com.android.systemui.dump.DumpManager
@@ -117,7 +118,8 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        @JvmStatic
        @Parameters(name = "{0}")
        fun getParams(): List<FlagsParameterization> {
            return FlagsParameterization.allCombinationsOf().andSceneContainer()
            return FlagsParameterization.allCombinationsOf(Flags.FLAG_NOTIFICATION_FIX_HUN_SHADOWS)
                .andSceneContainer()
        }
    }

@@ -1447,6 +1449,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        // Given: shade is opened, yTranslation of HUN is 0,
        // the height of HUN equals to the height of QQS Panel,
        // and HUN fully overlaps with QQS Panel
        ambientState.isShadeExpanded = true
        ambientState.stackTranslation =
            px(R.dimen.qqs_layout_margin_top) + px(R.dimen.qqs_layout_padding_bottom)
        val childHunView =
@@ -1474,6 +1477,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        // Given: shade is opened, yTranslation of HUN is greater than 0,
        // the height of HUN is equal to the height of QQS Panel,
        // and HUN partially overlaps with QQS Panel
        ambientState.isShadeExpanded = true
        ambientState.stackTranslation =
            px(R.dimen.qqs_layout_margin_top) + px(R.dimen.qqs_layout_padding_bottom)
        val childHunView =
@@ -1504,6 +1508,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
        // Given: shade is opened, yTranslation of HUN is equal to QQS Panel's height,
        // the height of HUN is equal to the height of QQS Panel,
        // and HUN doesn't overlap with QQS Panel
        ambientState.isShadeExpanded = true
        ambientState.stackTranslation =
            px(R.dimen.qqs_layout_margin_top) + px(R.dimen.qqs_layout_padding_bottom)
        // Mock the height of shade
@@ -1534,6 +1539,7 @@ class StackScrollAlgorithmTest(flags: FlagsParameterization) : SysuiTestCase() {
    fun shadeClosed_hunShouldHaveFullShadow() {
        // Given: shade is closed, ambientState.stackTranslation == -ambientState.topPadding,
        // the height of HUN is equal to the height of QQS Panel,
        ambientState.isShadeExpanded = false
        ambientState.stackTranslation = (-ambientState.topPadding).toFloat()
        // Mock the height of shade
        ambientState.setLayoutMinHeight(1000)
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.stack;

import static com.android.systemui.Flags.notificationFixHunShadows;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
@@ -1305,7 +1307,7 @@ public class StackScrollAlgorithm {
                if (childrenOnTop != 0.0f) {
                    // To elevate the later HUN over previous HUN when multiple HUNs exist
                    childrenOnTop++;
                } else {
                } else if (ambientState.isShadeExpanded() || !notificationFixHunShadows()) {
                    // Handles HUN shadow when Shade is opened, and AmbientState.mScrollY > 0
                    // Calculate the HUN's z-value based on its overlapping fraction with QQS Panel.
                    // When scrolling down shade to make HUN back to in-position in Notif Panel,
@@ -1317,6 +1319,9 @@ public class StackScrollAlgorithm {
                            1.0f,
                            overlap / childViewState.height
                    );
                } else {
                    // Increment by one to add the full shadow when the shade is closed.
                    childrenOnTop++;
                }
                childViewState.setZTranslation(baseZ
                        + childrenOnTop * mPinnedZTranslationExtra);