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

Commit 3f805137 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Ic4370fa8,I81c43329,Ic563a8fe,I6d4be770,I858d1c95, ...

* changes:
  Fixed a bug where a wrong notification could be visible
  Fixed a bug where the icon would dissappear
  Continued low-priority group implementation
  Fixed an issue where the minimum height wasn't applied correctly
  Worked around a bug where the view could render blank
  Fixed another memory leak
  Creating the right views for low-priority group children
  Move the inflation away from the statusbar
parents bb983d28 fc9fb15c
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -4040,15 +4040,23 @@ public class Notification implements Parcelable
        }

        /**
         * Construct a RemoteViews for the final notification header only
         * Construct a RemoteViews for the final notification header only. This will not be
         * colorized.
         *
         * @hide
         */
        public RemoteViews makeNotificationHeader() {
            Boolean colorized = (Boolean) mN.extras.get(EXTRA_COLORIZED);
            mN.extras.putBoolean(EXTRA_COLORIZED, false);
            RemoteViews header = new BuilderRemoteViews(mContext.getApplicationInfo(),
                    R.layout.notification_template_header);
            resetNotificationHeader(header);
            bindNotificationHeader(header, false /* ambient */);
            if (colorized != null) {
                mN.extras.putBoolean(EXTRA_COLORIZED, colorized);
            } else {
                mN.extras.remove(EXTRA_COLORIZED);
            }
            return header;
        }

@@ -4167,8 +4175,6 @@ public class Notification implements Parcelable
                    mN.extras.putCharSequence(EXTRA_SUB_TEXT, newSummary);
                }
            }
            Boolean colorized = (Boolean) mN.extras.get(EXTRA_COLORIZED);
            mN.extras.putBoolean(EXTRA_COLORIZED, false);

            RemoteViews header = makeNotificationHeader();

@@ -4177,11 +4183,6 @@ public class Notification implements Parcelable
            } else {
                mN.extras.remove(EXTRA_SUB_TEXT);
            }
            if (colorized != null) {
                mN.extras.putBoolean(EXTRA_COLORIZED, colorized);
            } else {
                mN.extras.remove(EXTRA_COLORIZED);
            }
            mN.color = color;
            return header;
        }
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@
    <LinearLayout
            android:id="@+id/notification_action_list_margin_target"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="top"
            android:layout_marginTop="@dimen/notification_content_margin_top"
            android:clipToPadding="false"
@@ -38,6 +38,7 @@
            android:paddingStart="@dimen/notification_content_margin_start"
            android:paddingEnd="@dimen/notification_content_margin_end"
            android:minHeight="@dimen/notification_min_content_height"
            android:layout_marginBottom="@dimen/notification_content_margin_bottom"
            android:clipToPadding="false"
            android:orientation="vertical"
            >
@@ -49,7 +50,6 @@
                android:id="@+id/notification_messaging"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:paddingBottom="@dimen/notification_content_margin_bottom"
                android:spacing="@dimen/notification_messaging_spacing" >
                <com.android.internal.widget.ImageFloatingTextView android:id="@+id/inbox_text0"
                    style="@style/Widget.Material.Notification.MessagingText"
+0 −6
Original line number Diff line number Diff line
@@ -923,12 +923,6 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mOnActivatedListener = onActivatedListener;
    }

    public void reset() {
        setTintColor(0);
        resetBackgroundAlpha();
        setBelowSpeedBump(false);
    }

    public boolean hasSameBgColor(ActivatableNotificationView otherView) {
        return calculateBgColor() == otherView.calculateBgColor();
    }
+88 −49
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar;

import static com.android.systemui.statusbar.notification.NotificationInflater.InflationExceptionHandler;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
@@ -42,6 +44,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.Chronometer;
import android.widget.ImageView;
import android.widget.RemoteViews;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
@@ -52,6 +55,8 @@ import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.plugins.statusbar.NotificationMenuRowProvider.MenuItem;
import com.android.systemui.statusbar.notification.HybridNotificationView;
import com.android.systemui.statusbar.notification.InflationException;
import com.android.systemui.statusbar.notification.NotificationInflater;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.VisualStabilityManager;
import com.android.systemui.statusbar.phone.NotificationGroupManager;
@@ -70,6 +75,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    private static final int DEFAULT_DIVIDER_ALPHA = 0x29;
    private static final int COLORED_DIVIDER_ALPHA = 0x7B;
    private final NotificationInflater mNotificationInflater;
    private int mIconTransformContentShift;
    private int mIconTransformContentShiftNoIcon;
    private int mNotificationMinHeightLegacy;
@@ -152,14 +158,15 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private OnClickListener mExpandClickListener = new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (!mShowingPublic && mGroupManager.isSummaryOfGroup(mStatusBarNotification)) {
            if (!mShowingPublic && (!mIsLowPriority || isExpanded())
                    && mGroupManager.isSummaryOfGroup(mStatusBarNotification)) {
                mGroupExpansionChanging = true;
                final boolean wasExpanded = mGroupManager.isGroupExpanded(mStatusBarNotification);
                boolean nowExpanded = mGroupManager.toggleGroupExpansion(mStatusBarNotification);
                mOnExpandClickListener.onExpandClicked(mEntry, nowExpanded);
                MetricsLogger.action(mContext, MetricsEvent.ACTION_NOTIFICATION_GROUP_EXPANDER,
                        nowExpanded);
                logExpansionEvent(true /* userAction */, wasExpanded);
                onExpansionChanged(true /* userAction */, wasExpanded);
            } else {
                if (v.isAccessibilityFocused()) {
                    mPrivateLayout.setFocusOnVisibilityChange();
@@ -246,6 +253,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
        if (mIsSummaryWithChildren) {
            setIconAnimationRunningForChild(running, mChildrenContainer.getHeaderView());
            setIconAnimationRunningForChild(running, mChildrenContainer.getLowPriorityHeaderView());
            List<ExpandableNotificationRow> notificationChildren =
                    mChildrenContainer.getNotificationChildren();
            for (int i = 0; i < notificationChildren.size(); i++) {
@@ -298,17 +306,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    public void onNotificationUpdated(NotificationData.Entry entry) {
    public void updateNotification(NotificationData.Entry entry) throws InflationException {
        mEntry = entry;
        mStatusBarNotification = entry.notification;
        mNotificationInflater.inflateNotificationViews();
        onNotificationUpdated();
    }

    private void onNotificationUpdated() {
        for (NotificationContentView l : mLayouts) {
            l.onNotificationUpdated(entry);
            l.onNotificationUpdated(mEntry);
        }
        mIsColorized = mStatusBarNotification.getNotification().isColorized();
        mShowingPublicInitialized = false;
        updateNotificationColor();
        if (mIsSummaryWithChildren) {
            mChildrenContainer.recreateNotificationHeader(mExpandClickListener, mEntry.notification);
            mChildrenContainer.recreateNotificationHeader(mExpandClickListener);
            mChildrenContainer.onNotificationUpdated();
        }
        if (mIconAnimationRunning) {
@@ -458,6 +471,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        boolean childInGroup = StatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup;
        mNotificationParent = childInGroup ? parent : null;
        mPrivateLayout.setIsChildInGroup(childInGroup);
        if (mNotificationInflater.setIsChildInGroup(childInGroup)) {
            onNotificationUpdated();
        }
        resetBackgroundAlpha();
        updateBackgroundForGroupState();
        updateClickAndFocus();
@@ -671,9 +687,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        return mPrivateLayout.getNotificationHeader();
    }

    private NotificationHeaderView getVisibleNotificationHeader() {
    /**
     * @return the currently visible notification header. This can be different from
     * {@link #getNotificationHeader()} in case it is a low-priority group.
     */
    public NotificationHeaderView getVisibleNotificationHeader() {
        if (mIsSummaryWithChildren && !mShowingPublic) {
            return mChildrenContainer.getHeaderView();
            return mChildrenContainer.getVisibleHeader();
        }
        return getShowingLayout().getVisibleNotificationHeader();
    }
@@ -711,7 +731,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        }
    }

    public void reInflateViews() {
    public void onDensityOrFontScaleChanged() {
        initDimens();
        if (mIsSummaryWithChildren) {
            if (mChildrenContainer != null) {
@@ -742,6 +762,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        for (NotificationContentView l : mLayouts) {
            l.reInflateViews();
        }
        mNotificationInflater.onDensityOrFontScaleChanged();
        onNotificationUpdated();
    }

    public void setContentBackground(int customBackgroundColor, boolean animate,
@@ -891,7 +913,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    }

    public View getNotificationIcon() {
        NotificationHeaderView notificationHeader = getNotificationHeader();
        NotificationHeaderView notificationHeader = getVisibleNotificationHeader();
        if (notificationHeader != null) {
            return notificationHeader.getIcon();
        }
@@ -1008,17 +1030,32 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    public void setIsLowPriority(boolean isLowPriority) {
        mIsLowPriority = isLowPriority;
        mPrivateLayout.setIsLowPriority(isLowPriority);
        mNotificationInflater.setIsLowPriority(mIsLowPriority);
        if (mChildrenContainer != null) {
            mChildrenContainer.setIsLowPriority(isLowPriority);
        }
    }

    public boolean isLowPriority() {
        return mIsLowPriority;
    }

    public void setUseIncreasedCollapsedHeight(boolean use) {
        mUseIncreasedCollapsedHeight = use;
        mNotificationInflater.setUsesIncreasedHeight(use);
    }

    public void setUseIncreasedHeadsUpHeight(boolean use) {
        mUseIncreasedHeadsUpHeight = use;
        mNotificationInflater.setUsesIncreasedHeadsUpHeight(use);
    }

    public void setRemoteViewClickHandler(RemoteViews.OnClickHandler remoteViewClickHandler) {
        mNotificationInflater.setRemoteViewClickHandler(remoteViewClickHandler);
    }

    public void setInflateExceptionHandler(InflationExceptionHandler inflateExceptionHandler) {
        mNotificationInflater.setInflateExceptionHandler(inflateExceptionHandler);
    }

    public interface ExpansionLogger {
@@ -1028,6 +1065,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    public ExpandableNotificationRow(Context context, AttributeSet attrs) {
        super(context, attrs);
        mFalsingManager = FalsingManager.getInstance(context);
        mNotificationInflater = new NotificationInflater(this);
        initDimens();
    }

@@ -1063,26 +1101,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    /**
     * Resets this view so it can be re-used for an updated notification.
     */
    @Override
    public void reset() {
        super.reset();
        final boolean wasExpanded = isExpanded();
        mExpandable = false;
        mHasUserChangedExpansion = false;
        mUserLocked = false;
        mShowingPublic = false;
        mSensitive = false;
        mShowingPublicInitialized = false;
        mIsSystemExpanded = false;
        mOnKeyguard = false;
        mPublicLayout.reset();
        mPrivateLayout.reset();
        resetHeight();
        resetTranslation();
        logExpansionEvent(false, wasExpanded);
    }

    public void resetHeight() {
        onHeightReset();
        requestLayout();
    }
@@ -1124,7 +1144,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            public void onInflate(ViewStub stub, View inflated) {
                mChildrenContainer = (NotificationChildrenContainer) inflated;
                mChildrenContainer.setIsLowPriority(mIsLowPriority);
                mChildrenContainer.setNotificationParent(ExpandableNotificationRow.this);
                mChildrenContainer.setContainingNotification(ExpandableNotificationRow.this);
                mChildrenContainer.onNotificationUpdated();
                mTranslateableViews.add(mChildrenContainer);
            }
@@ -1253,9 +1273,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        if (mChildrenContainer != null) {
            mChildrenContainer.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE
                    : INVISIBLE);
            mChildrenContainer.updateHeaderVisibility(!mShowingPublic && mIsSummaryWithChildren
                    ? VISIBLE
                    : INVISIBLE);
            mChildrenContainer.setHeaderVisible(!mShowingPublic && mIsSummaryWithChildren);
        }
        // The limits might have changed if the view suddenly became a group or vice versa
        updateLimits();
@@ -1323,7 +1341,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     */
    public void setUserExpanded(boolean userExpanded) {
        setUserExpanded(userExpanded, false /* allowChildExpansion */);
        updateShelfIconColor();
    }

    /**
@@ -1334,22 +1351,28 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     */
    public void setUserExpanded(boolean userExpanded, boolean allowChildExpansion) {
        mFalsingManager.setNotificationExpanded();
        if (mIsSummaryWithChildren && !mShowingPublic && allowChildExpansion) {
        if (mIsSummaryWithChildren && !mShowingPublic && allowChildExpansion
                && !mChildrenContainer.showingAsLowPriority()) {
            final boolean wasExpanded = mGroupManager.isGroupExpanded(mStatusBarNotification);
            mGroupManager.setGroupExpanded(mStatusBarNotification, userExpanded);
            logExpansionEvent(true /* userAction */, wasExpanded);
            onExpansionChanged(true /* userAction */, wasExpanded);
            return;
        }
        if (userExpanded && !mExpandable) return;
        final boolean wasExpanded = isExpanded();
        mHasUserChangedExpansion = true;
        mUserExpanded = userExpanded;
        logExpansionEvent(true, wasExpanded);
        onExpansionChanged(true /* userAction */, wasExpanded);
    }

    public void resetUserExpansion() {
        boolean changed = mUserExpanded;
        mHasUserChangedExpansion = false;
        mUserExpanded = false;
        if (changed && mIsSummaryWithChildren) {
            mChildrenContainer.onExpansionChanged();
        }
        updateShelfIconColor();
    }

    public boolean isUserLocked() {
@@ -1383,9 +1406,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        if (expand != mIsSystemExpanded) {
            final boolean wasExpanded = isExpanded();
            mIsSystemExpanded = expand;
            updateShelfIconColor();
            notifyHeightChanged(false /* needsAnimation */);
            logExpansionEvent(false, wasExpanded);
            onExpansionChanged(false /* userAction */, wasExpanded);
            if (mIsSummaryWithChildren) {
                mChildrenContainer.updateGroupOverflow();
            }
@@ -1399,7 +1421,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        if (onKeyguard != mOnKeyguard) {
            final boolean wasExpanded = isExpanded();
            mOnKeyguard = onKeyguard;
            logExpansionEvent(false, wasExpanded);
            onExpansionChanged(false /* userAction */, wasExpanded);
            if (wasExpanded != isExpanded()) {
                if (mIsSummaryWithChildren) {
                    mChildrenContainer.updateGroupOverflow();
@@ -1470,8 +1492,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mIsSummaryWithChildren = StatusBar.ENABLE_CHILD_NOTIFICATIONS
                && mChildrenContainer != null && mChildrenContainer.getNotificationChildCount() > 0;
        if (mIsSummaryWithChildren && mChildrenContainer.getHeaderView() == null) {
            mChildrenContainer.recreateNotificationHeader(mExpandClickListener,
                    mEntry.notification);
            mChildrenContainer.recreateNotificationHeader(mExpandClickListener
            );
        }
        getShowingLayout().updateBackgroundColor(false /* animate */);
        mPrivateLayout.updateExpandButtons(isExpandable());
@@ -1526,7 +1548,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     * the top.
     */
    private void updateContentShiftHeight() {
        NotificationHeaderView notificationHeader = getNotificationHeader();
        NotificationHeaderView notificationHeader = getVisibleNotificationHeader();
        if (notificationHeader != null) {
            CachingIconView icon = notificationHeader.getIcon();
            mIconTransformContentShift = getRelativeTopPadding(icon) + icon.getHeight();
@@ -1737,7 +1759,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    @Override
    public void setActualHeight(int height, boolean notifyListeners) {
        boolean changed = height != getActualHeight();
        super.setActualHeight(height, notifyListeners);
        if (changed && isRemoved()) {
            // TODO: remove this once we found the gfx bug for this.
            // This is a hack since a removed view sometimes would just stay blank. it occured
            // when sending yourself a message and then clicking on it.
            ViewGroup parent = (ViewGroup) getParent();
            if (parent != null) {
                parent.invalidate();
            }
        }
        if (mGuts != null && mGuts.isExposed()) {
            mGuts.setActualHeight(height);
            return;
@@ -1828,9 +1860,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        return mShowingPublic ? mPublicLayout : mPrivateLayout;
    }

    public void setShowingLegacyBackground(boolean showing) {
    public void setLegacy(boolean legacy) {
        for (NotificationContentView l : mLayouts) {
            l.setShowingLegacyBackground(showing);
            l.setLegacy(legacy);
        }
    }

@@ -1910,7 +1942,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            if (isGroupExpanded()) {
                return 1.0f;
            } else if (isUserLocked()) {
                return mChildrenContainer.getGroupExpandFraction();
                return mChildrenContainer.getIncreasedPaddingAmount();
            }
        } else if (isColorized() && (!mIsLowPriority || isExpanded())) {
            return -1.0f;
@@ -1933,14 +1965,20 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        return super.disallowSingleClick(event);
    }

    private void logExpansionEvent(boolean userAction, boolean wasExpanded) {
    private void onExpansionChanged(boolean userAction, boolean wasExpanded) {
        boolean nowExpanded = isExpanded();
        if (mIsSummaryWithChildren) {
        if (mIsSummaryWithChildren && (!mIsLowPriority || wasExpanded)) {
            nowExpanded = mGroupManager.isGroupExpanded(mStatusBarNotification);
        }
        if (wasExpanded != nowExpanded && mLogger != null) {
        if (nowExpanded != wasExpanded) {
            updateShelfIconColor();
            if (mLogger != null) {
                mLogger.logNotificationExpansion(mLoggingKey, userAction, nowExpanded);
            }
            if (mIsSummaryWithChildren) {
                mChildrenContainer.onExpansionChanged();
            }
        }
    }

    @Override
@@ -1980,7 +2018,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    @Override
    public boolean isAboveShelf() {
        return mIsPinned || mHeadsupDisappearRunning || (mIsHeadsUp && mAboveShelf);
        return !isOnKeyguard()
                && (mIsPinned || mHeadsupDisappearRunning || (mIsHeadsUp && mAboveShelf));
    }

    public void setShowAmbient(boolean showAmbient) {
+74 −53

File changed.

Preview size limit exceeded, changes collapsed.

Loading