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

Commit f8d9f0a6 authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz
Browse files

[NotificationContentView] fallback to available view

calculateVisibleType and getVisualTypeForHeight return VISIBLE_TYPE_SINGLELINE without checking if the view is available.
With this CL, if it is null, we fallback the available view by height.

Bug: 398853084
Flag: EXEMPT trivial fallback update
Test: Presubmit
Change-Id: Ib17c19f89b1f66ee710cf5129a610f208044f945
parent 55efeb24
Loading
Loading
Loading
Loading
+26 −13
Original line number Diff line number Diff line
@@ -1240,7 +1240,14 @@ public class NotificationContentView extends FrameLayout implements Notification
                height = mContentHeight;
            }
            int expandedVisualType = getVisualTypeForHeight(height);
            int collapsedVisualType = mIsChildInGroup && !isGroupExpanded()
            final boolean shouldShowSingleLineView = mIsChildInGroup && !isGroupExpanded();
            final boolean isSingleLineViewPresent = mSingleLineView != null;

            if (shouldShowSingleLineView && !isSingleLineViewPresent) {
                Log.wtf(TAG, "calculateVisibleType: SingleLineView is not available!");
            }

            final int collapsedVisualType = shouldShowSingleLineView && isSingleLineViewPresent
                    ? VISIBLE_TYPE_SINGLELINE
                    : getVisualTypeForHeight(mContainingNotification.getCollapsedHeight());
            return mTransformationStartVisibleType == collapsedVisualType
@@ -1261,7 +1268,13 @@ public class NotificationContentView extends FrameLayout implements Notification
        if (!noExpandedChild && viewHeight == getViewHeight(VISIBLE_TYPE_EXPANDED)) {
            return VISIBLE_TYPE_EXPANDED;
        }
        if (!mUserExpanding && mIsChildInGroup && !isGroupExpanded()) {
        final boolean shouldShowSingleLineView = mIsChildInGroup && !isGroupExpanded();
        final boolean isSingleLinePresent =  mSingleLineView != null;
        if (shouldShowSingleLineView && !isSingleLinePresent) {
            Log.wtf(TAG, "getVisualTypeForHeight: singleLineView is not available.");
        }

        if (!mUserExpanding && shouldShowSingleLineView && isSingleLinePresent) {
            return VISIBLE_TYPE_SINGLELINE;
        }