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

Commit 4b259a16 authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed an issue where the notification could be tiny

When updating the notificationWrapper we were reapplying
the translation from the row to keep the header hidden
during headsup. This was applied even on the public layout.
Because we didn't update all layouts though when the notification
stops being heads upped, the public layout never received the
update.
We're fixing this by not allowing the translation
on the header views and additionally also letting all content
views know of the state change.

Fixes: 116864754
Test: add HUN, update it, observe lockscreen (with redaction)
Change-Id: I1c9d1dab61081fcf2ff9a4dc22a741e565076294
parent b8eb195e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -769,7 +769,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    public void setHeaderVisibleAmount(float headerVisibleAmount) {
        if (mHeaderVisibleAmount != headerVisibleAmount) {
            mHeaderVisibleAmount = headerVisibleAmount;
            mPrivateLayout.setHeaderVisibleAmount(headerVisibleAmount);
            for (NotificationContentView l : mLayouts) {
                l.setHeaderVisibleAmount(headerVisibleAmount);
            }
            if (mChildrenContainer != null) {
                mChildrenContainer.setHeaderVisibleAmount(headerVisibleAmount);
            }
+1 −25
Original line number Diff line number Diff line
@@ -17,8 +17,6 @@
package com.android.systemui.statusbar.notification.row.wrapper;

import static com.android.systemui.statusbar.notification.TransformState.TRANSFORM_Y;
import static com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
        .DEFAULT_HEADER_VISIBLE_AMOUNT;

import android.app.Notification;
import android.content.Context;
@@ -53,19 +51,17 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
            = new PathInterpolator(0.4f, 0f, 0.7f, 1f);

    protected final ViewTransformationHelper mTransformationHelper;
    private final int mTranslationForHeader;

    protected int mColor;
    private ImageView mIcon;

    private NotificationExpandButton mExpandButton;
    private NotificationHeaderView mNotificationHeader;
    protected NotificationHeaderView mNotificationHeader;
    private TextView mHeaderText;
    private ImageView mWorkProfileImage;
    private boolean mIsLowPriority;
    private boolean mTransformLowPriorityTitle;
    private boolean mShowExpandButtonAtEnd;
    protected float mHeaderTranslation;

    protected NotificationHeaderViewWrapper(Context ctx, View view, ExpandableNotificationRow row) {
        super(ctx, view, row);
@@ -101,10 +97,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
                }, TRANSFORMING_VIEW_TITLE);
        resolveHeaderViews();
        addAppOpsOnClickListener(row);
        mTranslationForHeader = ctx.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_content_margin)
                - ctx.getResources().getDimensionPixelSize(
                        com.android.internal.R.dimen.notification_content_margin_top);
    }

    protected void resolveHeaderViews() {
@@ -130,9 +122,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {

        // Reinspect the notification.
        resolveHeaderViews();
        if (row.getHeaderVisibleAmount() != DEFAULT_HEADER_VISIBLE_AMOUNT) {
            setHeaderVisibleAmount(row.getHeaderVisibleAmount());
        }
        updateTransformedTypes();
        addRemainingTransformTypes();
        updateCropToPaddingForImageViews();
@@ -198,19 +187,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
        mNotificationHeader.setOnClickListener(expandable ? onClickListener : null);
    }

    @Override
    public void setHeaderVisibleAmount(float headerVisibleAmount) {
        super.setHeaderVisibleAmount(headerVisibleAmount);
        mNotificationHeader.setAlpha(headerVisibleAmount);
        mHeaderTranslation = (1.0f - headerVisibleAmount) * mTranslationForHeader;
        mView.setTranslationY(mHeaderTranslation);
    }

    @Override
    public int getHeaderTranslation() {
        return (int) mHeaderTranslation;
    }

    @Override
    public NotificationHeaderView getNotificationHeader() {
        return mNotificationHeader;
+24 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.row.wrapper;

import static com.android.systemui.statusbar.notification.row.ExpandableNotificationRow.DEFAULT_HEADER_VISIBLE_AMOUNT;

import android.app.PendingIntent;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -49,6 +51,7 @@ import com.android.systemui.statusbar.notification.row.HybridNotificationView;
 */
public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapper {

    private final int mTranslationForHeader;
    protected ImageView mPicture;
    private ProgressBar mProgressBar;
    private TextView mTitle;
@@ -63,6 +66,7 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
    private ArraySet<PendingIntent> mCancelledPendingIntents = new ArraySet<>();
    private UiOffloadThread mUiOffloadThread;
    private View mRemoteInputHistory;
    private float mHeaderTranslation;

    protected NotificationTemplateViewWrapper(Context ctx, View view,
            ExpandableNotificationRow row) {
@@ -131,6 +135,10 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
                    }

                }, TRANSFORMING_VIEW_TEXT);
        mTranslationForHeader = ctx.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_content_margin)
                - ctx.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.notification_content_margin_top);
    }

    private void resolveTemplateViews(StatusBarNotification notification) {
@@ -280,6 +288,9 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
        // the transformation types and we need to have our values set by then.
        resolveTemplateViews(row.getStatusBarNotification());
        super.onContentUpdated(row);
        if (row.getHeaderVisibleAmount() != DEFAULT_HEADER_VISIBLE_AMOUNT) {
            setHeaderVisibleAmount(row.getHeaderVisibleAmount());
        }
    }

    @Override
@@ -333,6 +344,19 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
        }
    }

    @Override
    public int getHeaderTranslation() {
        return (int) mHeaderTranslation;
    }

    @Override
    public void setHeaderVisibleAmount(float headerVisibleAmount) {
        super.setHeaderVisibleAmount(headerVisibleAmount);
        mNotificationHeader.setAlpha(headerVisibleAmount);
        mHeaderTranslation = (1.0f - headerVisibleAmount) * mTranslationForHeader;
        mView.setTranslationY(mHeaderTranslation);
    }

    @Override
    public int getExtraMeasureHeight() {
        int extra = 0;