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

Commit 9403df83 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Android (Google) Code Review
Browse files

Merge "[NotificationContentView] Log erroneous state for single line view visibility" into main

parents 83207b52 5ae85055
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

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

import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL;

import static org.junit.Assert.assertNull;

import android.app.Notification;
@@ -64,6 +66,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
                mContext,
                mDependency,
                TestableLooper.get(this));
        mNotificationTestHelper.setDefaultInflationFlags(FLAG_CONTENT_VIEW_ALL);
        mGroup = mNotificationTestHelper.createGroup();
        mChildrenContainer = mGroup.getChildrenContainer();
    }
@@ -172,9 +175,12 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    @Test
    @EnableFlags(AsyncGroupHeaderViewInflation.FLAG_NAME)
    public void testSetLowPriorityWithAsyncInflation_noHeaderReInflation() {
        mChildrenContainer.setLowPriorityGroupHeader(null, null);
        mChildrenContainer.setIsMinimized(true);

        // THEN
        assertNull("We don't inflate header from the main thread with Async "
                + "Inflation enabled", mChildrenContainer.getCurrentHeaderView());
                + "Inflation enabled", mChildrenContainer.getMinimizedNotificationHeader());
    }

    @Test
@@ -182,7 +188,7 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    public void setLowPriorityBeforeLowPriorityHeaderSet() {

        //Given: the children container does not have a low-priority header, and is not low-priority
        assertNull(mChildrenContainer.getMinimizedGroupHeaderWrapper());
        mChildrenContainer.setLowPriorityGroupHeader(null, null);
        mGroup.setIsMinimized(false);

        //When: set the children container to be low-priority and set the low-priority header
@@ -214,8 +220,8 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
    public void changeLowPriorityAfterHeaderSet() {

        //Given: the children container does not have headers, and is not low-priority
        assertNull(mChildrenContainer.getMinimizedGroupHeaderWrapper());
        assertNull(mChildrenContainer.getNotificationHeaderWrapper());
        mChildrenContainer.setLowPriorityGroupHeader(null, null);
        mChildrenContainer.setGroupHeader(null, null);
        mGroup.setIsMinimized(false);

        //When: set the set the normal header
+1 −0
Original line number Diff line number Diff line
@@ -298,6 +298,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        mRowContentBindStage.requestRebind(entry, en -> {
            mLogger.logRebindComplete(entry);
            row.setIsMinimized(isMinimized);
            row.setRedactionType(redactionType);
            if (inflationCallback != null) {
                inflationCallback.onAsyncInflationFinished(en);
            }
+12 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import static com.android.systemui.Flags.notificationRowAccessibilityExpanded;
import static com.android.systemui.Flags.notificationRowTransparency;
import static com.android.systemui.Flags.notificationsPinnedHunInShade;
import static com.android.systemui.flags.Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE;
import static com.android.systemui.statusbar.notification.NotificationUtils.logKey;
import static com.android.systemui.statusbar.notification.collection.NotificationEntry.DismissState.PARENT_DISMISSED;
import static com.android.systemui.statusbar.notification.row.NotificationContentView.VISIBLE_TYPE_HEADSUP;
@@ -102,6 +103,7 @@ import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin.MenuItem
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.res.R;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType;
import com.android.systemui.statusbar.RemoteInputController;
import com.android.systemui.statusbar.SmartReplyController;
import com.android.systemui.statusbar.StatusBarIconView;
@@ -503,7 +505,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

    private final ListenerSet<DismissButtonTargetVisibilityListener>
            mDismissButtonTargetVisibilityListeners = new ListenerSet<>();

    @RedactionType
    private int mRedactionType = REDACTION_TYPE_NONE;
    public NotificationContentView[] getLayouts() {
        return Arrays.copyOf(mLayouts, mLayouts.length);
    }
@@ -1866,6 +1869,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        );
    }

    /**
     * Set the redaction type of the row.
     */
    public void setRedactionType(@RedactionType int redactionType) {
        mRedactionType = redactionType;
    }

    /**
     * Init the bundle header view. The ComposeView is initialized within with the passed viewModel.
     * This can only be init once and not in conjunction with any other header view.
@@ -4516,6 +4526,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            pw.print(", expandedWhenPinned: " + mExpandedWhenPinned);
            pw.print(", isMinimized: " + mIsMinimized);
            pw.print(", isAboveShelf: " + isAboveShelf());
            pw.print(", redactionType: " + mRedactionType);

            pw.println();
            if (NotificationContentView.INCLUDE_HEIGHTS_TO_DUMP) {
+1 −4
Original line number Diff line number Diff line
@@ -1248,7 +1248,7 @@ public class NotificationContentView extends FrameLayout implements Notification
            final boolean isSingleLineViewPresent = mSingleLineView != null;

            if (shouldShowSingleLineView && !isSingleLineViewPresent) {
                Log.e(TAG, "calculateVisibleType: SingleLineView is not available!");
                Log.wtf(TAG, "calculateVisibleType: SingleLineView is not available!");
            }

            final int collapsedVisualType = shouldShowSingleLineView && isSingleLineViewPresent
@@ -1274,9 +1274,6 @@ public class NotificationContentView extends FrameLayout implements Notification
        }
        final boolean shouldShowSingleLineView = mIsChildInGroup && !isGroupExpanded();
        final boolean isSingleLinePresent =  mSingleLineView != null;
        if (shouldShowSingleLineView && !isSingleLinePresent) {
            Log.e(TAG, "getVisualTypeForHeight: singleLineView is not available.");
        }

        if (!mUserExpanding && shouldShowSingleLineView && isSingleLinePresent) {
            return VISIBLE_TYPE_SINGLELINE;