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

Commit 49c91ba7 authored by Yining Liu's avatar Yining Liu
Browse files

Clean up flag notification_content_alpha_optimization

Clean up flag: com.android.systemui.notification_content_alpha_optimization

Fix: 427854356
Test: ExpandableNotificationRowTest, NotificationSwipeHelperTest
Flag: EXEMPT flag cleanup
Change-Id: I721a469db77a928a3850f072c79968e6489c9633
parent ed5111ee
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -140,16 +140,6 @@ flag {
    bug: "293824309"
}

flag {
    name: "notification_content_alpha_optimization"
    namespace: "systemui"
    description: "Only reset alpha values of needed content views"
    bug: "292024656"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
   name: "notification_transparent_header_fix"
   namespace: "systemui"
+0 −3
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.shared.NotificationContentAlphaOptimization;

import org.junit.Before;
import org.junit.Rule;
@@ -718,7 +717,6 @@ public class NotificationSwipeHelperTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(NotificationContentAlphaOptimization.FLAG_NAME)
    public void testForceResetSwipeStateDoesNothingIfTranslationIsZeroAndAlphaIsOne() {
        doReturn(FAKE_ROW_WIDTH).when(mNotificationRow).getMeasuredWidth();
        doReturn(0f).when(mNotificationRow).getTranslationX();
@@ -732,7 +730,6 @@ public class NotificationSwipeHelperTest extends SysuiTestCase {
    }

    @Test
    @EnableFlags(NotificationContentAlphaOptimization.FLAG_NAME)
    public void testForceResetSwipeStateResetsAlphaIfTranslationIsZeroAndAlphaNotOne() {
        doReturn(FAKE_ROW_WIDTH).when(mNotificationRow).getMeasuredWidth();
        doReturn(0f).when(mNotificationRow).getTranslationX();
+2 −6
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;
import com.android.systemui.statusbar.notification.shared.NotificationContentAlphaOptimization;
import com.android.wm.shell.animation.FlingAnimationUtils;
import com.android.wm.shell.shared.animation.PhysicsAnimator;
import com.android.wm.shell.shared.animation.PhysicsAnimator.SpringConfig;
@@ -274,8 +273,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
            float translation) {
        float swipeProgress = getSwipeProgressForOffset(animView, translation);
        if (!mCallback.updateSwipeProgress(animView, dismissable, swipeProgress)) {
            if (dismissable
                    || (NotificationContentAlphaOptimization.isEnabled() && translation == 0)) {
            if (dismissable || translation == 0) {
                // We need to reset the content alpha even when the view is not dismissible (eg.
                //  when Guts is visible)
                if (swipeProgress != 0f && swipeProgress != 1f) {
@@ -883,9 +881,7 @@ public class SwipeHelper implements Gefingerpoken, Dumpable {
    }

    public void forceResetSwipeState(@NonNull View view) {
        if (view.getTranslationX() == 0
                && (!NotificationContentAlphaOptimization.isEnabled() || view.getAlpha() == 1f)
        ) {
        if (view.getTranslationX() == 0 && view.getAlpha() == 1f) {
            // Don't do anything when translation is 0 and alpha is 1
            return;
        }
+1 −3
Original line number Diff line number Diff line
@@ -136,7 +136,6 @@ import com.android.systemui.statusbar.notification.row.wrapper.NotificationCompa
import com.android.systemui.statusbar.notification.row.wrapper.NotificationViewWrapper;
import com.android.systemui.statusbar.notification.shared.NotificationAddXOnHoverToDismiss;
import com.android.systemui.statusbar.notification.shared.NotificationBundleUi;
import com.android.systemui.statusbar.notification.shared.NotificationContentAlphaOptimization;
import com.android.systemui.statusbar.notification.shared.TransparentHeaderFix;
import com.android.systemui.statusbar.notification.stack.AmbientState;
import com.android.systemui.statusbar.notification.stack.AnimationProperties;
@@ -3642,8 +3641,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            // we need to reset content alpha!
            final NotificationContentView showingLayout = getShowingLayout();
            final boolean showingLayoutNeedsAlphaReset = showingLayout.getAlpha() == 0;
            if (!NotificationContentAlphaOptimization.isEnabled()
                    || mShowingPublic != oldShowingPublic || showingLayoutNeedsAlphaReset) {
            if (mShowingPublic != oldShowingPublic || showingLayoutNeedsAlphaReset) {
                // Don't reset the alpha or cancel the animation if the showing layout doesn't
                // change
                mPublicLayout.animate().cancel();
+0 −53
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.
 */

package com.android.systemui.statusbar.notification.shared

import com.android.systemui.Flags
import com.android.systemui.flags.FlagToken
import com.android.systemui.flags.RefactorFlagUtils

/** Helper for reading or using the Async Group Header Inflation flag state. */
@Suppress("NOTHING_TO_INLINE")
object NotificationContentAlphaOptimization {
    /** The aconfig flag name */
    const val FLAG_NAME = Flags.FLAG_NOTIFICATION_CONTENT_ALPHA_OPTIMIZATION

    /** A token used for dependency declaration */
    val token: FlagToken
        get() = FlagToken(FLAG_NAME, isEnabled)

    /** Is the async inflation of group header views enabled */
    @JvmStatic
    inline val isEnabled
        get() = Flags.notificationContentAlphaOptimization()

    /**
     * Called to ensure code is only run when the flag is enabled. This protects users from the
     * unintended behaviors caused by accidentally running new logic, while also crashing on an eng
     * build to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun isUnexpectedlyInLegacyMode() =
        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
     * the flag is enabled to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME)
}
Loading