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

Commit 37e96a8f authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Hiding replied notification icons from AOD" into pi-dev

parents b91dd1d9 9bfc7a54
Loading
Loading
Loading
Loading
+37 −3
Original line number Diff line number Diff line
@@ -47,6 +47,8 @@ public class NotificationIconAreaController implements DarkReceiver {
    private final Rect mTintArea = new Rect();
    private NotificationStackScrollLayout mNotificationScrollLayout;
    private Context mContext;
    private boolean mFullyDark;
    private boolean mHasShelfIconsWhenFullyDark;

    public NotificationIconAreaController(Context context, StatusBar statusBar) {
        mStatusBar = statusBar;
@@ -173,13 +175,40 @@ public class NotificationIconAreaController implements DarkReceiver {
    public void updateNotificationIcons() {

        updateStatusBarIcons();
        updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
                NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,
                false /* hideRepliedMessages */);
        updateShelfIcons();
        updateHasShelfIconsWhenFullyDark();

        applyNotificationIconsTint();
    }

    private void updateHasShelfIconsWhenFullyDark() {
        boolean hasIconsWhenFullyDark = false;
        for (int i = 0; i < mNotificationScrollLayout.getChildCount(); i++) {
            View view = mNotificationScrollLayout.getChildAt(i);
            if (view instanceof ExpandableNotificationRow) {
                NotificationData.Entry ent = ((ExpandableNotificationRow) view).getEntry();
                if (shouldShowNotificationIcon(ent,
                        NotificationShelf.SHOW_AMBIENT_ICONS /* showAmbient */,
                        false /* hideDismissed */,
                        true /* hideReplied */)) {
                    hasIconsWhenFullyDark = true;
                    break;
                }
            }
        }
        mHasShelfIconsWhenFullyDark = hasIconsWhenFullyDark;
    }

    public boolean hasShelfIconsWhenFullyDark() {
        return mHasShelfIconsWhenFullyDark;
    }

    private void updateShelfIcons() {
        updateIconsForLayout(entry -> entry.expandedIcon, mShelfIcons,
                NotificationShelf.SHOW_AMBIENT_ICONS, false /* hideDismissed */,
                mFullyDark /* hideRepliedMessages */);
    }

    public void updateStatusBarIcons() {
        updateIconsForLayout(entry -> entry.icon, mNotificationIcons,
                false /* showAmbient */, true /* hideDismissed */, true /* hideRepliedMessages */);
@@ -320,6 +349,11 @@ public class NotificationIconAreaController implements DarkReceiver {
        v.setDecorColor(mIconTint);
    }

    public void setFullyDark(boolean fullyDark) {
        mFullyDark = fullyDark;
        updateShelfIcons();
    }

    public void setDark(boolean dark) {
        mNotificationIcons.setDark(dark, false, 0);
        mShelfIcons.setDark(dark, false, 0);
+1 −0
Original line number Diff line number Diff line
@@ -829,6 +829,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                .createNotificationIconAreaController(context, this);
        inflateShelf();
        mNotificationIconAreaController.setupShelf(mNotificationShelf);
        mStackScroller.setIconAreaController(mNotificationIconAreaController);
        Dependency.get(DarkIconDispatcher.class).addDarkReceiver(mNotificationIconAreaController);
        FragmentHostManager.get(mStatusBarWindow)
                .addTagListener(CollapsedStatusBarFragment.TAG, (tag, fragment) -> {
+22 −6
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.HeadsUpAppearanceController;
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.policy.HeadsUpUtil;
@@ -420,6 +421,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    private ArrayList<BiConsumer<Float, Float>> mExpandedHeightListeners = new ArrayList<>();
    private int mHeadsUpInset;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private NotificationIconAreaController mIconAreaController;

    public NotificationStackScrollLayout(Context context) {
        this(context, null);
@@ -536,10 +538,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        final int lockScreenRight = getWidth() - mSidePaddings;
        final int lockScreenTop = mCurrentBounds.top;
        final int lockScreenBottom = mCurrentBounds.bottom;
        final int darkLeft = getWidth() / 2 - mSeparatorWidth / 2;
        final int darkRight = darkLeft + mSeparatorWidth;
        final int darkTop = (int) (mRegularTopPadding + mSeparatorThickness / 2f);
        final int darkBottom = darkTop + mSeparatorThickness;
        int separatorWidth = 0;
        int separatorThickness = 0;
        if (mIconAreaController.hasShelfIconsWhenFullyDark()) {
            separatorThickness = mSeparatorThickness;
            separatorWidth = mSeparatorWidth;
        }
        final int darkLeft = getWidth() / 2 - separatorWidth / 2;
        final int darkRight = darkLeft + separatorWidth;
        final int darkTop = (int) (mRegularTopPadding + separatorThickness / 2f);
        final int darkBottom = darkTop + separatorThickness;

        if (mAmbientState.hasPulsingNotifications()) {
            // No divider, we have a notification icon instead
@@ -4015,12 +4023,16 @@ public class NotificationStackScrollLayout extends ViewGroup
        mDarkAmount = darkAmount;
        boolean wasFullyDark = mAmbientState.isFullyDark();
        mAmbientState.setDarkAmount(darkAmount);
        if (mAmbientState.isFullyDark() != wasFullyDark) {
        boolean nowFullyDark = mAmbientState.isFullyDark();
        if (nowFullyDark != wasFullyDark) {
            updateContentHeight();
            DozeParameters dozeParameters = DozeParameters.getInstance(mContext);
            if (mAmbientState.isFullyDark() && dozeParameters.shouldControlScreenOff()) {
            if (nowFullyDark && dozeParameters.shouldControlScreenOff()) {
                mShelf.fadeInTranslating();
            }
            if (mIconAreaController != null) {
                mIconAreaController.setFullyDark(nowFullyDark);
            }
        }
        updateAlgorithmHeightAndPadding();
        updateBackgroundDimming();
@@ -4638,6 +4650,10 @@ public class NotificationStackScrollLayout extends ViewGroup
        mHeadsUpAppearanceController = headsUpAppearanceController;
    }

    public void setIconAreaController(NotificationIconAreaController controller) {
        mIconAreaController = controller;
    }

    /**
     * A listener that is notified when the empty space below the notifications is clicked on
     */