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

Commit da42d65e authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed a bug where groups were layouted too small

If the group was a group of custom views it
was layouted too small.

Change-Id: I88778c9a162e6f3012140d1e7864d66f13da2b1d
parent 7a7c63ab
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -1544,7 +1544,6 @@ public abstract class BaseStatusBar extends SystemUI implements
            }
        }
        entry.row = row;
        updateNotificationHeightRange(entry);
        entry.row.setOnActivatedListener(this);
        entry.row.setExpandable(bigContentViewLocal != null);

@@ -1557,19 +1556,11 @@ public abstract class BaseStatusBar extends SystemUI implements
            row.setUserExpanded(userExpanded);
        }
        row.setUserLocked(userLocked);
        row.updateStatusBarNotification(entry.notification);
        row.onNotificationUpdated(entry);
        applyRemoteInput(entry);
        return true;
    }

    private void updateNotificationHeightRange(Entry entry) {
        boolean customView = entry.getContentView().getId()
                != com.android.internal.R.id.status_bar_latest_event_content;
        boolean beforeN = entry.targetSdk < Build.VERSION_CODES.N;
        int minHeight = customView && beforeN ? mRowMinHeightLegacy : mRowMinHeight;
        entry.row.setHeightRange(minHeight, mRowMaxHeight);
    }

    /**
     * Adds RemoteInput actions from the WearableExtender; to be removed once more apps support this
     * via first-class API.
@@ -2191,7 +2182,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        // update the contentIntent
        mNotificationClicker.register(entry.row, sbn);

        entry.row.updateStatusBarNotification(entry.notification);
        entry.row.onNotificationUpdated(entry);
        entry.row.resetHeight();

        applyRemoteInput(entry);
+33 −13
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -49,6 +50,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private static final int DEFAULT_DIVIDER_ALPHA = 0x29;
    private static final int COLORED_DIVIDER_ALPHA = 0x7B;
    private final LinearInterpolator mLinearInterpolator = new LinearInterpolator();
    private final int mNotificationMinHeightLegacy;
    private final int mNotificationMinHeight;
    private final int mNotificationMaxHeight;
    private int mRowMinHeight;

    /** Does this row contain layouts that can adapt to row expansion */
@@ -86,6 +90,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private String mLoggingKey;
    private boolean mWasReset;
    private NotificationGuts mGuts;
    private NotificationData.Entry mEntry;
    private StatusBarNotification mStatusBarNotification;
    private boolean mIsHeadsUp;
    private boolean mLastChronometerRunning = true;
@@ -188,10 +193,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    public void updateStatusBarNotification(StatusBarNotification statusBarNotification) {
        mStatusBarNotification = statusBarNotification;
        mPrivateLayout.onNotificationUpdated(statusBarNotification);
        mPublicLayout.onNotificationUpdated(statusBarNotification);
    public void onNotificationUpdated(NotificationData.Entry entry) {
        mEntry = entry;
        mStatusBarNotification = entry.notification;
        mPrivateLayout.onNotificationUpdated(entry.notification);
        mPublicLayout.onNotificationUpdated(entry.notification);
        updateVetoButton();
        if (mIsSummaryWithChildren) {
            recreateNotificationHeader();
@@ -203,6 +209,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            mNotificationParent.updateChildrenHeaderAppearance();
        }
        onChildrenCountChanged();
        updateLimits();
    }

    private void updateLimits() {
        boolean customView = getPrivateLayout().getContractedChild().getId()
                != com.android.internal.R.id.status_bar_latest_event_content;
        boolean beforeN = mEntry.targetSdk < Build.VERSION_CODES.N;
        int minHeight = customView && beforeN && !mIsSummaryWithChildren ?
                mNotificationMinHeightLegacy : mNotificationMinHeight;
        mRowMinHeight = minHeight;
        mMaxViewHeight = mNotificationMaxHeight;
        mPrivateLayout.setSmallHeight(mRowMinHeight);
        mPublicLayout.setSmallHeight(mRowMinHeight);
    }

    public StatusBarNotification getStatusBarNotification() {
@@ -437,6 +456,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    public ExpandableNotificationRow(Context context, AttributeSet attrs) {
        super(context, attrs);
        mFalsingManager = FalsingManager.getInstance(context);
        mNotificationMinHeightLegacy =  getResources().getDimensionPixelSize(
                R.dimen.notification_min_height_legacy);
        mNotificationMinHeight =  getResources().getDimensionPixelSize(
                R.dimen.notification_min_height);
        mNotificationMaxHeight =  getResources().getDimensionPixelSize(
                R.dimen.notification_max_height);
    }

    /**
@@ -513,13 +538,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    private void updateChildrenVisibility(boolean animated) {
    private void updateChildrenVisibility() {
        if (mChildrenContainer == null) {
            return;
        }
        mChildrenContainer.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
        mNotificationHeader.setVisibility(mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
        mPrivateLayout.setVisibility(!mIsSummaryWithChildren ? VISIBLE : INVISIBLE);
        // The limits might have changed if the view suddenly became a group or vice versa
        updateLimits();
    }

    @Override
@@ -545,13 +572,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
        mRowMinHeight = rowMinHeight;
        mMaxViewHeight = rowMaxHeight;
        mPrivateLayout.setSmallHeight(mRowMinHeight);
        mPublicLayout.setSmallHeight(mRowMinHeight);
    }

    public boolean isExpandable() {
        if (mIsSummaryWithChildren && !mShowingPublic) {
            return !mChildrenExpanded;
@@ -721,7 +741,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mPrivateLayout.updateExpandButtons(isExpandable());
        updateChildrenHeaderAppearance();
        updateHeaderChildCount();
        updateChildrenVisibility(true);
        updateChildrenVisibility();
    }

    /**
+0 −4
Original line number Diff line number Diff line
@@ -3136,10 +3136,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        mNaturalBarHeight = res.getDimensionPixelSize(
                com.android.internal.R.dimen.status_bar_height);

        mRowMinHeightLegacy =  res.getDimensionPixelSize(R.dimen.notification_min_height_legacy);
        mRowMinHeight =  res.getDimensionPixelSize(R.dimen.notification_min_height);
        mRowMaxHeight =  res.getDimensionPixelSize(R.dimen.notification_max_height);

        mMaxAllowedKeyguardNotifications = res.getInteger(R.integer.keyguard_max_notification_count);

        if (DEBUG) Log.v(TAG, "updateResources");