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

Commit 7927c73f authored by Selim Cinek's avatar Selim Cinek
Browse files

Remove the ambient group layout

Because the layout looks pretty much the same as when awake, we're
going back to the regular group layout.

Test: atest SystemUiTests
Fixes: 127697886
Change-Id: I5eafaf74435151faab13d8f84850b4939196edd9
parent d6f7187d
Loading
Loading
Loading
Loading
+0 −21
Original line number Diff line number Diff line
@@ -522,27 +522,6 @@ public class ContrastColorUtil {
        return ColorUtilsFromCompat.LABToColor(result[0], result[1], result[2]);
    }

    public static int resolveAmbientColor(Context context, int notificationColor) {
        final int resolvedColor = notificationColor == Notification.COLOR_DEFAULT
                ? context.getColor(com.android.internal.R.color.notification_default_color_dark)
                : notificationColor;

        int color = resolvedColor;
        color = ContrastColorUtil.ensureTextContrastOnBlack(color);

        if (color != resolvedColor) {
            if (DEBUG){
                Log.w(TAG, String.format(
                        "Ambient contrast of notification for %s is %s (over black)"
                                + " by changing #%s to #%s",
                        context.getPackageName(),
                        ContrastColorUtil.contrastChange(resolvedColor, color, Color.BLACK),
                        Integer.toHexString(resolvedColor), Integer.toHexString(color)));
            }
        }
        return color;
    }

    public static int resolvePrimaryColor(Context context, int backgroundColor,
                                          boolean defaultBackgroundIsDark) {
        boolean useDark = shouldUseDark(backgroundColor, defaultBackgroundIsDark);
+0 −2
Original line number Diff line number Diff line
@@ -651,8 +651,6 @@

    <!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "+ 3" [CHAR LIMIT=5] -->
    <string name="notification_group_overflow_indicator">+ <xliff:g id="number" example="3">%s</xliff:g></string>
    <!-- The overflow indicator shown when a group has more notification inside the group than the visible ones. An example is "New message, +3" [CHAR LIMIT=7] -->
    <string name="notification_group_overflow_indicator_ambient"><xliff:g id="notification_title" example="New message">%1$s</xliff:g>, +<xliff:g id="overflow" example="+3">%2$s</xliff:g></string>

    <!-- Content description describing how many more notifications are in a group [CHAR LIMIT=NONE] -->
    <plurals name="notification_group_overflow_description">
+1 −15
Original line number Diff line number Diff line
@@ -334,7 +334,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private boolean mUseIncreasedHeadsUpHeight;
    private float mTranslationWhenRemoved;
    private boolean mWasChildInGroupWhenRemoved;
    private int mNotificationColorAmbient;
    private NotificationInlineImageResolver mImageResolver;
    private NotificationMediaManager mMediaManager;

@@ -1284,18 +1283,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mNotificationColor = ContrastColorUtil.resolveContrastColor(mContext,
                getStatusBarNotification().getNotification().color,
                getBackgroundColorWithoutTint(), nightMode);
        mNotificationColorAmbient = ContrastColorUtil.resolveAmbientColor(mContext,
                getStatusBarNotification().getNotification().color);
    }

    public HybridNotificationView getSingleLineView() {
        return mPrivateLayout.getSingleLineView();
    }

    public HybridNotificationView getAmbientSingleLineView() {
        return getShowingLayout().getAmbientSingleLineChild();
    }

    public boolean isOnKeyguard() {
        return mOnKeyguard;
    }
@@ -1628,10 +1621,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return mNotificationInflater;
    }

    public int getNotificationColorAmbient() {
        return mNotificationColorAmbient;
    }

    public interface ExpansionLogger {
        void logNotificationExpansion(String key, boolean userAction, boolean expanded);
    }
@@ -2316,7 +2305,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            return mPrivateLayout.getMinHeight();
        } else if (mSensitive && mHideSensitiveForIntrinsicHeight) {
            return getMinHeight();
        } else if (mIsSummaryWithChildren && (!mOnKeyguard || mOnAmbient)) {
        } else if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getIntrinsicHeight();
        } else if (isHeadsUpAllowed() && (mIsHeadsUp || mHeadsupDisappearRunning)) {
            if (isPinned() || mHeadsupDisappearRunning) {
@@ -3018,9 +3007,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public void setOnAmbient(boolean onAmbient) {
        if (onAmbient != mOnAmbient) {
            mOnAmbient = onAmbient;
            if (mChildrenContainer != null) {
                mChildrenContainer.notifyDozingStateChanged();
            }
            notifyHeightChanged(false /* needsAnimation */);
        }
    }
+0 −19
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import com.android.systemui.statusbar.notification.NotificationUtils;
public class HybridGroupManager {

    private final Context mContext;
    private final NotificationDozeHelper mDozer;
    private final ViewGroup mParent;

    private float mOverflowNumberSize;
@@ -47,7 +46,6 @@ public class HybridGroupManager {
    public HybridGroupManager(Context ctx, ViewGroup parent) {
        mContext = ctx;
        mParent = parent;
        mDozer = new NotificationDozeHelper();
        initDimens();
    }

@@ -94,12 +92,6 @@ public class HybridGroupManager {
                R.style.HybridNotification);
    }

    public HybridNotificationView bindAmbientFromNotification(HybridNotificationView reusableView,
            Notification notification) {
        return bindFromNotificationWithStyle(reusableView, notification,
                R.style.HybridNotification);
    }

    private HybridNotificationView bindFromNotificationWithStyle(
            HybridNotificationView reusableView, Notification notification, int style) {
        if (reusableView == null) {
@@ -147,15 +139,4 @@ public class HybridGroupManager {
        updateOverFlowNumberColor(reusableView);
        return reusableView;
    }

    public TextView bindOverflowNumberAmbient(TextView titleView, Notification notification,
            int number) {
        String text = mContext.getResources().getString(
                R.string.notification_group_overflow_indicator_ambient,
                resolveTitle(notification), number);
        if (!text.equals(titleView.getText())) {
            titleView.setText(text);
        }
        return titleView;
    }
}
+3 −58
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ public class NotificationContentView extends FrameLayout {
    public static final int VISIBLE_TYPE_HEADSUP = 2;
    private static final int VISIBLE_TYPE_SINGLELINE = 3;
    public static final int VISIBLE_TYPE_AMBIENT = 4;
    private static final int VISIBLE_TYPE_AMBIENT_SINGLELINE = 5;
    public static final int UNDEFINED = -1;

    private final Rect mClipBounds = new Rect();
@@ -84,7 +83,6 @@ public class NotificationContentView extends FrameLayout {
    private View mHeadsUpChild;
    private HybridNotificationView mSingleLineView;
    private View mAmbientChild;
    private HybridNotificationView mAmbientSingleLineChild;

    private RemoteInputView mExpandedRemoteInput;
    private RemoteInputView mHeadsUpRemoteInput;
@@ -301,27 +299,6 @@ public class NotificationContentView extends FrameLayout {
                            : MeasureSpec.AT_MOST));
            maxChildHeight = Math.max(maxChildHeight, mAmbientChild.getMeasuredHeight());
        }
        if (mAmbientSingleLineChild != null) {
            int size = mNotificationAmbientHeight;
            ViewGroup.LayoutParams layoutParams = mAmbientSingleLineChild.getLayoutParams();
            boolean useExactly = false;
            if (layoutParams.height >= 0) {
                // An actual height is set
                size = Math.min(size, layoutParams.height);
                useExactly = true;
            }
            int ambientSingleLineWidthSpec = widthMeasureSpec;
            if (mSingleLineWidthIndention != 0
                    && MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED) {
                ambientSingleLineWidthSpec = MeasureSpec.makeMeasureSpec(
                        width - mSingleLineWidthIndention + mAmbientSingleLineChild.getPaddingEnd(),
                        MeasureSpec.EXACTLY);
            }
            mAmbientSingleLineChild.measure(ambientSingleLineWidthSpec,
                    MeasureSpec.makeMeasureSpec(size, useExactly ? MeasureSpec.EXACTLY
                            : MeasureSpec.AT_MOST));
            maxChildHeight = Math.max(maxChildHeight, mAmbientSingleLineChild.getMeasuredHeight());
        }
        int ownHeight = Math.min(maxChildHeight, maxSize);
        setMeasuredDimension(width, ownHeight);
    }
@@ -432,10 +409,6 @@ public class NotificationContentView extends FrameLayout {
        return mAmbientChild;
    }

    public HybridNotificationView getAmbientSingleLineChild() {
        return mAmbientSingleLineChild;
    }

    /**
     * Sets the contracted view. Child may be null to remove the content view.
     *
@@ -693,9 +666,6 @@ public class NotificationContentView extends FrameLayout {
        int hint;
        if (mAmbientChild != null && isVisibleOrTransitioning(VISIBLE_TYPE_AMBIENT)) {
            hint = mAmbientChild.getHeight();
        } else if (mAmbientSingleLineChild != null && isVisibleOrTransitioning(
                VISIBLE_TYPE_AMBIENT_SINGLELINE)) {
            hint = mAmbientSingleLineChild.getHeight();
        }  else if (mHeadsUpChild != null && isVisibleOrTransitioning(VISIBLE_TYPE_HEADSUP)) {
            hint = getViewHeight(VISIBLE_TYPE_HEADSUP);
        } else if (mExpandedChild != null) {
@@ -833,7 +803,7 @@ public class NotificationContentView extends FrameLayout {
    }

    public View getShowingAmbientView() {
        View v = mIsChildInGroup ? mAmbientSingleLineChild : mAmbientChild;
        View v = mIsChildInGroup ? mSingleLineView : mAmbientChild;
        if (v != null) {
            return v;
        } else {
@@ -923,8 +893,6 @@ public class NotificationContentView extends FrameLayout {
        forceUpdateVisibility(VISIBLE_TYPE_HEADSUP, mHeadsUpChild, mHeadsUpWrapper);
        forceUpdateVisibility(VISIBLE_TYPE_SINGLELINE, mSingleLineView, mSingleLineView);
        forceUpdateVisibility(VISIBLE_TYPE_AMBIENT, mAmbientChild, mAmbientWrapper);
        forceUpdateVisibility(VISIBLE_TYPE_AMBIENT_SINGLELINE, mAmbientSingleLineChild,
                mAmbientSingleLineChild);
        fireExpandedVisibleListenerIfVisible();
        // forceUpdateVisibilities cancels outstanding animations without updating the
        // mAnimationStartVisibleType. Do so here instead.
@@ -1002,8 +970,6 @@ public class NotificationContentView extends FrameLayout {
                mSingleLineView, mSingleLineView);
        updateViewVisibility(visibleType, VISIBLE_TYPE_AMBIENT,
                mAmbientChild, mAmbientWrapper);
        updateViewVisibility(visibleType, VISIBLE_TYPE_AMBIENT_SINGLELINE,
                mAmbientSingleLineChild, mAmbientSingleLineChild);
        fireExpandedVisibleListenerIfVisible();
        // updateViewVisibilities cancels outstanding animations without updating the
        // mAnimationStartVisibleType. Do so here instead.
@@ -1066,8 +1032,6 @@ public class NotificationContentView extends FrameLayout {
                return mSingleLineView;
            case VISIBLE_TYPE_AMBIENT:
                return mAmbientWrapper;
            case VISIBLE_TYPE_AMBIENT_SINGLELINE:
                return mAmbientSingleLineChild;
            default:
                return mContractedWrapper;
        }
@@ -1087,8 +1051,6 @@ public class NotificationContentView extends FrameLayout {
                return mSingleLineView;
            case VISIBLE_TYPE_AMBIENT:
                return mAmbientChild;
            case VISIBLE_TYPE_AMBIENT_SINGLELINE:
                return mAmbientSingleLineChild;
            default:
                return mContractedChild;
        }
@@ -1145,8 +1107,7 @@ public class NotificationContentView extends FrameLayout {
        }
        boolean onAmbient = mContainingNotification.isOnAmbient();
        if (!mUserExpanding && mIsChildInGroup && !isGroupExpanded()) {
            return onAmbient ? VISIBLE_TYPE_AMBIENT_SINGLELINE
                    : VISIBLE_TYPE_SINGLELINE;
            return VISIBLE_TYPE_SINGLELINE;
        }

        if ((mIsHeadsUp || mHeadsUpAnimatingAway) && mHeadsUpChild != null
@@ -1259,7 +1220,6 @@ public class NotificationContentView extends FrameLayout {

    private void updateAllSingleLineViews() {
        updateSingleLineView();
        updateAmbientSingleLineView();
    }

    private void updateSingleLineView() {
@@ -1277,21 +1237,6 @@ public class NotificationContentView extends FrameLayout {
        }
    }

    private void updateAmbientSingleLineView() {
        if (mIsChildInGroup) {
            boolean isNewView = mAmbientSingleLineChild == null;
            mAmbientSingleLineChild = mHybridGroupManager.bindAmbientFromNotification(
                    mAmbientSingleLineChild, mStatusBarNotification.getNotification());
            if (isNewView) {
                updateViewVisibility(mVisibleType, VISIBLE_TYPE_AMBIENT_SINGLELINE,
                        mAmbientSingleLineChild, mAmbientSingleLineChild);
            }
        } else if (mAmbientSingleLineChild != null) {
            removeView(mAmbientSingleLineChild);
            mAmbientSingleLineChild = null;
        }
    }

    private void applyMediaTransfer(final NotificationEntry entry) {
        View bigContentView = mExpandedChild;
        if (bigContentView == null || !entry.isMediaNotification()) {
Loading