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

Commit 5287d53c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Avert potential crashes in NotificationChildrenContainer.getMinHeight"...

Merge "Avert potential crashes in NotificationChildrenContainer.getMinHeight" into tm-dev am: fb5ea447 am: 0f7b1882 am: 5b331394 am: 936bf1b4

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18557779



Change-Id: Ibd078ae2b3b0c977194681558c1cd0ba63f2e8e3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents b69ea9b7 936bf1b4
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.res.TypedArray;
import android.graphics.drawable.ColorDrawable;
import android.service.notification.StatusBarNotification;
import android.util.AttributeSet;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.NotificationHeaderView;
@@ -58,6 +59,8 @@ import java.util.List;
public class NotificationChildrenContainer extends ViewGroup
        implements NotificationFadeAware {

    private static final String TAG = "NotificationChildrenContainer";

    @VisibleForTesting
    static final int NUMBER_OF_CHILDREN_WHEN_COLLAPSED = 2;
    @VisibleForTesting
@@ -1144,6 +1147,10 @@ public class NotificationChildrenContainer extends ViewGroup
    private int getMinHeight(int maxAllowedVisibleChildren, boolean likeHighPriority,
            int headerTranslation) {
        if (!likeHighPriority && showingAsLowPriority()) {
            if (mNotificationHeaderLowPriority == null) {
                Log.e(TAG, "getMinHeight: low priority header is null", new Exception());
                return 0;
            }
            return mNotificationHeaderLowPriority.getHeight();
        }
        int minExpandHeight = mNotificationHeaderMargin + headerTranslation;
@@ -1160,7 +1167,13 @@ public class NotificationChildrenContainer extends ViewGroup
                firstChild = false;
            }
            ExpandableNotificationRow child = mAttachedChildren.get(i);
            minExpandHeight += child.getSingleLineView().getHeight();
            View singleLineView = child.getSingleLineView();
            if (singleLineView != null) {
                minExpandHeight += singleLineView.getHeight();
            } else {
                Log.e(TAG, "getMinHeight: child " + child + " single line view is null",
                        new Exception());
            }
            visibleChildren++;
        }
        minExpandHeight += mCollapsedBottomPadding;