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

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

Merge changes Ic88e8094,I4253bf4b,Iba4ebd3c,I943b6352,If88c0b08, ...

* changes:
  Made it easier to use updatable Animators
  Improved the interpolators of the icon appearing
  Modified the way icons merge into the shelf
  Fixed a potential heads up crash
  Fixed a bug where the notifications would close on back
  Bye bye veto button
  Only requiring 2 taps for accessibility on lock screen
  Fixed a bug where systemui could crash
  Introduced the visual stability manager
  Removing notifications always immediately when swiping them away
parents 0f3fa9e3 f082fe23
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -20,12 +20,16 @@
    <item type="id" name="translation_y_animator_tag"/>
    <item type="id" name="translation_z_animator_tag"/>
    <item type="id" name="alpha_animator_tag"/>
    <item type="id" name="scale_x_animator_tag"/>
    <item type="id" name="scale_y_animator_tag"/>
    <item type="id" name="top_inset_animator_tag"/>
    <item type="id" name="height_animator_tag"/>
    <item type="id" name="shadow_alpha_animator_tag"/>
    <item type="id" name="translation_x_animator_end_value_tag"/>
    <item type="id" name="translation_y_animator_end_value_tag"/>
    <item type="id" name="translation_z_animator_end_value_tag"/>
    <item type="id" name="scale_x_animator_end_value_tag"/>
    <item type="id" name="scale_y_animator_end_value_tag"/>
    <item type="id" name="alpha_animator_end_value_tag"/>
    <item type="id" name="top_inset_animator_end_value_tag"/>
    <item type="id" name="height_animator_end_value_tag"/>
@@ -33,6 +37,8 @@
    <item type="id" name="translation_x_animator_start_value_tag"/>
    <item type="id" name="translation_y_animator_start_value_tag"/>
    <item type="id" name="translation_z_animator_start_value_tag"/>
    <item type="id" name="scale_x_animator_start_value_tag"/>
    <item type="id" name="scale_y_animator_start_value_tag"/>
    <item type="id" name="alpha_animator_start_value_tag"/>
    <item type="id" name="top_inset_animator_start_value_tag"/>
    <item type="id" name="height_animator_start_value_tag"/>
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.PathInterpolator;

import com.android.systemui.statusbar.stack.HeadsUpAppearInterpolator;

/**
 * Utility class to receive interpolators from
 */
@@ -37,6 +39,8 @@ public class Interpolators {
    public static final Interpolator ACCELERATE_DECELERATE = new AccelerateDecelerateInterpolator();
    public static final Interpolator DECELERATE_QUINT = new DecelerateInterpolator(2.5f);
    public static final Interpolator CUSTOM_40_40 = new PathInterpolator(0.4f, 0f, 0.6f, 1f);
    public static final Interpolator HEADS_UP_APPEAR = new HeadsUpAppearInterpolator();
    public static final Interpolator ICON_OVERSHOT = new PathInterpolator(0.4f, 0f, 0.2f, 1.4f);

    /**
     * Interpolator to be used when animating a move based on a click. Pair with enough duration.
+11 −3
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewConfiguration;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.Interpolator;
import android.view.animation.PathInterpolator;

@@ -37,6 +38,7 @@ import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.statusbar.notification.FakeShadowView;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.policy.AccessibilityController;
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import com.android.systemui.statusbar.stack.StackStateAnimator;

@@ -99,6 +101,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    private final int mTintedRippleColor;
    private final int mLowPriorityRippleColor;
    protected final int mNormalRippleColor;
    private final AccessibilityManager mAccessibilityManager;

    private boolean mDimmed;
    private boolean mDark;
@@ -199,6 +202,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mNormalRippleColor = context.getColor(
                R.color.notification_ripple_untinted_color);
        mFalsingManager = FalsingManager.getInstance(context);
        mAccessibilityManager = AccessibilityManager.getInstance(mContext);
    }

    @Override
@@ -223,13 +227,17 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (mDimmed && !mActivated
                && ev.getActionMasked() == MotionEvent.ACTION_DOWN && disallowSingleClick(ev)) {
        if (mDimmed && !mActivated && ev.getActionMasked() == MotionEvent.ACTION_DOWN
                && disallowSingleClick(ev) && !isTouchExplorationEnabled()) {
            return true;
        }
        return super.onInterceptTouchEvent(ev);
    }

    private boolean isTouchExplorationEnabled() {
        return mAccessibilityManager.isTouchExplorationEnabled();
    }

    protected boolean disallowSingleClick(MotionEvent ev) {
        return false;
    }
@@ -241,7 +249,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        boolean result;
        if (mDimmed) {
        if (mDimmed && !isTouchExplorationEnabled()) {
            boolean wasActivated = mActivated;
            result = handleTouchEventDimmed(event);
            if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
+35 −32
Original line number Diff line number Diff line
@@ -101,6 +101,7 @@ import com.android.systemui.assist.AssistManager;
import com.android.systemui.recents.Recents;
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.NotificationGuts.OnGutsClosedListener;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.phone.NavigationBarView;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
@@ -116,12 +117,12 @@ import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Stack;

public abstract class BaseStatusBar extends SystemUI implements
        CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener,
        ExpandableNotificationRow.ExpansionLogger, NotificationData.Environment,
        ExpandableNotificationRow.OnExpandClickListener,
        OnGutsClosedListener {
        ExpandableNotificationRow.OnExpandClickListener, OnGutsClosedListener {
    public static final String TAG = "StatusBar";
    public static final boolean DEBUG = false;
    public static final boolean MULTIUSER_DEBUG = false;
@@ -175,6 +176,9 @@ public abstract class BaseStatusBar extends SystemUI implements
    // for heads up notifications
    protected HeadsUpManager mHeadsUpManager;

    // handling reordering
    protected VisualStabilityManager mVisualStabilityManager = new VisualStabilityManager();

    protected int mCurrentUserId = 0;
    final protected SparseArray<UserInfo> mCurrentProfiles = new SparseArray<UserInfo>();

@@ -975,18 +979,11 @@ public abstract class BaseStatusBar extends SystemUI implements
        }
    }

    protected void bindDismissListener(final ExpandableNotificationRow row) {
        row.setOnDismissListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Accessibility feedback
                v.announceForAccessibility(
                        mContext.getString(R.string.accessibility_notification_dismissed));
                performRemoveNotification(row.getStatusBarNotification(), false /* removeView */);
            }
        });
    protected void bindDismissRunnable(final ExpandableNotificationRow row) {
        row.setOnDismissRunnable(() -> performRemoveNotification(row.getStatusBarNotification()));
    }

    protected void performRemoveNotification(StatusBarNotification n, boolean removeView) {
    protected void performRemoveNotification(StatusBarNotification n) {
        final String pkg = n.getPackageName();
        final String tag = n.getTag();
        final int id = n.getId();
@@ -996,14 +993,8 @@ public abstract class BaseStatusBar extends SystemUI implements
            if (FORCE_REMOTE_INPUT_HISTORY
                    && mKeysKeptForRemoteInput.contains(n.getKey())) {
                mKeysKeptForRemoteInput.remove(n.getKey());
                removeView = true;
            }
            if (mRemoteInputEntriesToRemoveOnCollapse.remove(mNotificationData.get(n.getKey()))) {
                removeView = true;
            }
            if (removeView) {
            removeNotification(n.getKey(), null);
            }

        } catch (RemoteException ex) {
            // system process is dead if we're here.
@@ -1656,7 +1647,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        }

        workAroundBadLayerDrawableOpacity(row);
        bindDismissListener(row);
        bindDismissRunnable(row);

        // NB: the large icon is now handled entirely by the template

@@ -1978,8 +1969,7 @@ public abstract class BaseStatusBar extends SystemUI implements
                                        Runnable removeRunnable = new Runnable() {
                                            @Override
                                            public void run() {
                                                performRemoveNotification(parentToCancelFinal,
                                                        true);
                                                performRemoveNotification(parentToCancelFinal);
                                            }
                                        };
                                        if (isCollapsing()) {
@@ -2192,8 +2182,7 @@ public abstract class BaseStatusBar extends SystemUI implements
     * Updates expanded, dimmed and locked states of notification rows.
     */
    protected void updateRowStates() {
        ArrayList<Entry> activeNotifications = mNotificationData.getActiveNotifications();
        final int N = activeNotifications.size();
        final int N = mStackScroller.getChildCount();

        int visibleNotifications = 0;
        boolean onKeyguard = mState == StatusBarState.KEYGUARD;
@@ -2202,21 +2191,27 @@ public abstract class BaseStatusBar extends SystemUI implements
            maxNotifications = getMaxKeyguardNotifications(true /* recompute */);
        }
        mStackScroller.setMaxDisplayedNotifications(maxNotifications);
        for (int i = 0; i < N; i++) {
            NotificationData.Entry entry = activeNotifications.get(i);
        Stack<ExpandableNotificationRow> stack = new Stack<>();
        for (int i = N - 1; i >= 0; i--) {
            View child = mStackScroller.getChildAt(i);
            if (!(child instanceof ExpandableNotificationRow)) {
                continue;
            }
            stack.push((ExpandableNotificationRow) child);
        }
        while(!stack.isEmpty()) {
            ExpandableNotificationRow row = stack.pop();
            NotificationData.Entry entry = row.getEntry();
            boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
            if (onKeyguard) {
                entry.row.setOnKeyguard(true);
                row.setOnKeyguard(true);
            } else {
                entry.row.setOnKeyguard(false);
                entry.row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
                row.setOnKeyguard(false);
                row.setSystemExpanded(visibleNotifications == 0 && !childNotification);
            }
            int userId = entry.notification.getUserId();
            boolean suppressedSummary = mGroupManager.isSummaryOfSuppressedGroup(
                    entry.notification) && !entry.row.isRemoved();
            boolean childWithVisibleSummary = childNotification
                    && mGroupManager.getGroupSummary(entry.notification).getVisibility()
                    == View.VISIBLE;
            boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
            if (suppressedSummary
                    || (isLockscreenPublicMode(userId) && !mShowLockscreenNotifications)
@@ -2234,6 +2229,14 @@ public abstract class BaseStatusBar extends SystemUI implements
                    visibleNotifications++;
                }
            }
            if (row.isSummaryWithChildren()) {
                List<ExpandableNotificationRow> notificationChildren =
                        row.getNotificationChildren();
                int size = notificationChildren.size();
                for (int i = size - 1; i >= 0; i--) {
                    stack.push(notificationChildren.get(i));
                }
            }
        }

        mStackScroller.changeViewPosition(mDismissView, mStackScroller.getChildCount() - 1);
+18 −15
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.statusbar.notification.HybridNotificationView;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.stack.AnimationProperties;
@@ -112,7 +113,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private NotificationContentView mPrivateLayout;
    private int mMaxExpandHeight;
    private int mHeadsUpHeight;
    private View mVetoButton;
    private int mNotificationColor;
    private ExpansionLogger mLogger;
    private String mLoggingKey;
@@ -197,6 +197,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private boolean mIconsVisible = true;
    private boolean mAboveShelf;
    private boolean mIsLastChild;
    private Runnable mOnDismissRunnable;

    public boolean isGroupExpansionChanging() {
        if (isChildInGroup()) {
@@ -469,10 +470,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     * Apply the order given in the list to the children.
     *
     * @param childOrder the new list order
     * @param visualStabilityManager
     * @param callback the callback to invoked in case it is not allowed
     * @return whether the list order has changed
     */
    public boolean applyChildOrder(List<ExpandableNotificationRow> childOrder) {
        return mChildrenContainer != null && mChildrenContainer.applyChildOrder(childOrder);
    public boolean applyChildOrder(List<ExpandableNotificationRow> childOrder,
            VisualStabilityManager visualStabilityManager,
            VisualStabilityManager.Callback callback) {
        return mChildrenContainer != null && mChildrenContainer.applyChildOrder(childOrder,
                visualStabilityManager, callback);
    }

    public void getChildrenStates(StackScrollState resultState) {
@@ -807,11 +813,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    }

    public void performDismiss() {
        mVetoButton.performClick();
        if (mOnDismissRunnable != null) {
            mOnDismissRunnable.run();
        }
    }

    public void setOnDismissListener(OnClickListener listener) {
        mVetoButton.setOnClickListener(listener);
    public void setOnDismissRunnable(Runnable onDismissRunnable) {
        mOnDismissRunnable = onDismissRunnable;
    }

    public View getNotificationIcon() {
@@ -921,6 +929,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        return topPadding;
    }

    public float getContentTranslation() {
        return mPrivateLayout.getTranslationY();
    }

    public interface ExpansionLogger {
        public void logNotificationExpansion(String key, boolean userAction, boolean expanded);
    }
@@ -1021,10 +1033,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
                mTranslateableViews.add(mChildrenContainer);
            }
        });
        mVetoButton = findViewById(R.id.veto);
        mVetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
        mVetoButton.setContentDescription(mContext.getString(
                R.string.accessibility_remove_notification));

        // Add the views that we translate to reveal the gear
        mTranslateableViews = new ArrayList<View>();
@@ -1032,16 +1040,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            mTranslateableViews.add(getChildAt(i));
        }
        // Remove views that don't translate
        mTranslateableViews.remove(mVetoButton);
        mTranslateableViews.remove(mSettingsIconRowStub);
        mTranslateableViews.remove(mChildrenContainerStub);
        mTranslateableViews.remove(mGutsStub);
    }

    public View getVetoButton() {
        return mVetoButton;
    }

    public void resetTranslation() {
        if (mTranslateAnim != null) {
            mTranslateAnim.cancel();
Loading