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

Commit 24176c33 authored by Selim Cinek's avatar Selim Cinek
Browse files

Animating the statusbar icons now when closing

On the keyguard the statusbaricons would not animate
in if there were no notifications. We can't just magically
appear them in that case but need to animate them.

Change-Id: Ie009b2c351b7a45f9219ddc1114be79477ea692b
Fixes: 33652041
parent 9ef119c7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue
    }

    private boolean shouldHideNotificationIcons() {
        return !mStatusBar.isClosed() && mStatusBarComponent.shouldHideNotificationIcons();
        return !mStatusBar.isClosed() && mStatusBarComponent.hideStatusBarIconsWhenExpanded();
    }

    public void hideSystemIconArea(boolean animate) {
+25 −18
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.app.StatusBarManager;
import android.content.Context;
import android.content.pm.ResolveInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
@@ -47,7 +46,6 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.KeyguardStatusView;
import com.android.systemui.DejankUtils;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
@@ -179,7 +177,7 @@ public class NotificationPanelView extends PanelView implements
    private boolean mKeyguardStatusViewAnimating;
    private ValueAnimator mQsSizeChangeAnimator;

    private boolean mShadeEmpty;
    private boolean mShowEmptyShadeView;

    private boolean mQsScrimEnabled = true;
    private boolean mLastAnnouncementWasQuickSettings;
@@ -211,11 +209,12 @@ public class NotificationPanelView extends PanelView implements
        }
    };
    private NotificationGroupManager mGroupManager;
    private boolean mOpening;
    private boolean mShowIconsWhenExpanded;
    private int mIndicationBottomPadding;
    private boolean mIsFullWidth;
    private boolean mDark;
    private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
    private boolean mNoVisibleNotifications = true;

    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -1518,7 +1517,7 @@ public class NotificationPanelView extends PanelView implements
        // it in expanded QS state as well so we don't run into troubles when fading the view in/out
        // and expanding/collapsing the whole panel from/to quick settings.
        if (mNotificationStackScroller.getNotGoneChildCount() == 0
                && mShadeEmpty) {
                && mShowEmptyShadeView) {
            notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight();
        }
        int maxQsHeight = mQsMaxExpansionHeight;
@@ -2118,15 +2117,15 @@ public class NotificationPanelView extends PanelView implements
        return mDozing;
    }

    public void setShadeEmpty(boolean shadeEmpty) {
        mShadeEmpty = shadeEmpty;
    public void showEmptyShadeView(boolean emptyShadeViewVisible) {
        mShowEmptyShadeView = emptyShadeViewVisible;
        updateEmptyShadeView();
    }

    private void updateEmptyShadeView() {

        // Hide "No notifications" in QS.
        mNotificationStackScroller.updateEmptyShadeView(mShadeEmpty && !mQsExpanded);
        mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded);
    }

    public void setQsScrimEnabled(boolean qsScrimEnabled) {
@@ -2306,7 +2305,7 @@ public class NotificationPanelView extends PanelView implements
        }
        mNotificationStackScroller.setExpandedHeight(expandedHeight);
        updateKeyguardBottomAreaAlpha();
        setOpening(isFullWidth() && expandedHeight < getOpeningHeight());
        updateStatusBarIcons();
    }

    /**
@@ -2317,13 +2316,21 @@ public class NotificationPanelView extends PanelView implements
        return mIsFullWidth;
    }

    private void setOpening(boolean opening) {
        if (opening != mOpening) {
            mOpening = opening;
    private void updateStatusBarIcons() {
        boolean showIconsWhenExpanded = isFullWidth() && getExpandedHeight() < getOpeningHeight();
        if (showIconsWhenExpanded && mNoVisibleNotifications && isOnKeyguard()) {
            showIconsWhenExpanded = false;
        }
        if (showIconsWhenExpanded != mShowIconsWhenExpanded) {
            mShowIconsWhenExpanded = showIconsWhenExpanded;
            mStatusBar.recomputeDisableFlags(false);
        }
    }

    private boolean isOnKeyguard() {
        return mStatusBar.getBarState() == StatusBarState.KEYGUARD;
    }

    public void setPanelScrimMinFraction(float minFraction) {
        mBar.panelScrimMinFractionChanged(minFraction);
    }
@@ -2426,12 +2433,8 @@ public class NotificationPanelView extends PanelView implements
        mGroupManager = groupManager;
    }

    public boolean shouldHideNotificationIcons() {
        return !isFullWidth() || (!mOpening && !isFullyCollapsed());
    }

    public boolean shouldAnimateIconHiding() {
        return !isFullWidth();
    public boolean hideStatusBarIconsWhenExpanded() {
        return !isFullWidth() || !mShowIconsWhenExpanded;
    }

    private final FragmentListener mFragmentListener = new FragmentListener() {
@@ -2473,4 +2476,8 @@ public class NotificationPanelView extends PanelView implements
        mKeyguardStatusView.setDark(dark);
        positionClockAndNotifications();
    }

    public void setNoVisibleNotifications(boolean noNotifications) {
        mNoVisibleNotifications = noNotifications;
    }
}
+6 −9
Original line number Diff line number Diff line
@@ -2038,10 +2038,10 @@ public class StatusBar extends SystemUI implements DemoMode,
    }

    private void updateEmptyShadeView() {
        boolean showEmptyShade =
        boolean showEmptyShadeView =
                mState != StatusBarState.KEYGUARD &&
                        mNotificationData.getActiveNotifications().size() == 0;
        mNotificationPanel.setShadeEmpty(showEmptyShade);
        mNotificationPanel.showEmptyShadeView(showEmptyShadeView);
    }

    private void updateSpeedBumpIndex() {
@@ -2724,8 +2724,8 @@ public class StatusBar extends SystemUI implements DemoMode,
        return mLaunchTransitionFadingAway;
    }

    public boolean shouldHideNotificationIcons() {
        return mNotificationPanel.shouldHideNotificationIcons();
    public boolean hideStatusBarIconsWhenExpanded() {
        return mNotificationPanel.hideStatusBarIconsWhenExpanded();
    }

    /**
@@ -2967,7 +2967,7 @@ public class StatusBar extends SystemUI implements DemoMode,
        runPostCollapseRunnables();
        setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
        showBouncerIfKeyguard();
        recomputeDisableFlags(shouldAnimatIconHiding() /* animate */);
        recomputeDisableFlags(mNotificationPanel.hideStatusBarIconsWhenExpanded() /* animate */);

        // Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
        // the bouncer appear animation.
@@ -2976,10 +2976,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        }
    }

    private boolean shouldAnimatIconHiding() {
        return mNotificationPanel.shouldAnimateIconHiding();
    }

    public boolean interceptTouchEvent(MotionEvent event) {
        if (DEBUG_GESTURES) {
            if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
@@ -6575,6 +6571,7 @@ public class StatusBar extends SystemUI implements DemoMode,
                }
            }
        }
        mNotificationPanel.setNoVisibleNotifications(visibleNotifications == 0);

        mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
        mStackScroller.changeViewPosition(mEmptyShadeView, mStackScroller.getChildCount() - 2);