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

Commit 88b46e90 authored by Steve Elliott's avatar Steve Elliott Committed by Android (Google) Code Review
Browse files

Merge "Delete NotifGroupManagerLegacy" into tm-qpr-dev

parents d215285a 334cd29e
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -87,7 +87,6 @@ import com.android.systemui.statusbar.events.PrivacyDotViewController;
import com.android.systemui.statusbar.events.SystemStatusAnimationScheduler;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationEntryManager.KeyguardEnvironment;
import com.android.systemui.statusbar.notification.collection.legacy.NotificationGroupManagerLegacy;
import com.android.systemui.statusbar.notification.collection.legacy.VisualStabilityManager;
import com.android.systemui.statusbar.notification.collection.render.GroupExpansionManager;
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
@@ -311,7 +310,6 @@ public class Dependency {
    @Inject Lazy<AccessibilityFloatingMenuController> mAccessibilityFloatingMenuController;
    @Inject Lazy<StatusBarStateController> mStatusBarStateController;
    @Inject Lazy<NotificationLockscreenUserManager> mNotificationLockscreenUserManager;
    @Inject Lazy<NotificationGroupManagerLegacy> mNotificationGroupManager;
    @Inject Lazy<VisualStabilityManager> mVisualStabilityManager;
    @Inject Lazy<NotificationGutsManager> mNotificationGutsManager;
    @Inject Lazy<NotificationMediaManager> mNotificationMediaManager;
@@ -524,7 +522,6 @@ public class Dependency {
        mProviders.put(NotificationLockscreenUserManager.class,
                mNotificationLockscreenUserManager::get);
        mProviders.put(VisualStabilityManager.class, mVisualStabilityManager::get);
        mProviders.put(NotificationGroupManagerLegacy.class, mNotificationGroupManager::get);
        mProviders.put(NotificationMediaManager.class, mNotificationMediaManager::get);
        mProviders.put(NotificationGutsManager.class, mNotificationGutsManager::get);
        mProviders.put(NotificationRemoteInputManager.class,
+2 −15
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package com.android.systemui.statusbar.notification.collection.inflation;

import android.annotation.Nullable;
import android.annotation.NonNull;

import com.android.systemui.statusbar.NotificationUiAdjustment;
import com.android.systemui.statusbar.notification.InflationException;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
@@ -35,22 +34,10 @@ public interface NotificationRowBinder {
     */
    void inflateViews(
            NotificationEntry entry,
            NotifInflater.Params params,
            @NonNull NotifInflater.Params params,
            NotificationRowContentBinder.InflationCallback callback)
            throws InflationException;

    /**
     * Called when the ranking has been updated (but not add or remove has been done). The binder
     * should inspect the old and new adjustments and re-inflate the entry's views if necessary
     * (e.g. if something important changed).
     */
    void onNotificationRankingUpdated(
            NotificationEntry entry,
            @Nullable Integer oldImportance,
            NotificationUiAdjustment oldAdjustment,
            NotificationUiAdjustment newAdjustment,
            NotificationRowContentBinder.InflationCallback callback);

    /**
     * Called when a notification is no longer likely to be displayed and can have its views freed.
     */
+5 −62
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.systemui.statusbar.notification.row.NotificationRowCon

import static java.util.Objects.requireNonNull;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
import android.os.Build;
@@ -32,12 +33,9 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.NotificationPresenter;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.NotificationUiAdjustment;
import com.android.systemui.statusbar.notification.InflationException;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.NotificationClicker;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
import com.android.systemui.statusbar.notification.collection.legacy.LowPriorityInflationHelper;
import com.android.systemui.statusbar.notification.icon.IconManager;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRowController;
@@ -68,8 +66,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
    private final ExpandableNotificationRowComponent.Builder
            mExpandableNotificationRowComponentBuilder;
    private final IconManager mIconManager;
    private final LowPriorityInflationHelper mLowPriorityInflationHelper;
    private final NotifPipelineFlags mNotifPipelineFlags;

    private NotificationPresenter mPresenter;
    private NotificationListContainer mListContainer;
@@ -86,9 +82,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
            RowContentBindStage rowContentBindStage,
            Provider<RowInflaterTask> rowInflaterTaskProvider,
            ExpandableNotificationRowComponent.Builder expandableNotificationRowComponentBuilder,
            IconManager iconManager,
            LowPriorityInflationHelper lowPriorityInflationHelper,
            NotifPipelineFlags notifPipelineFlags) {
            IconManager iconManager) {
        mContext = context;
        mNotifBindPipeline = notifBindPipeline;
        mRowContentBindStage = rowContentBindStage;
@@ -98,8 +92,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        mRowInflaterTaskProvider = rowInflaterTaskProvider;
        mExpandableNotificationRowComponentBuilder = expandableNotificationRowComponentBuilder;
        mIconManager = iconManager;
        mLowPriorityInflationHelper = lowPriorityInflationHelper;
        mNotifPipelineFlags = notifPipelineFlags;
    }

    /**
@@ -125,13 +117,9 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
    @Override
    public void inflateViews(
            NotificationEntry entry,
            NotifInflater.Params params,
            @NonNull NotifInflater.Params params,
            NotificationRowContentBinder.InflationCallback callback)
            throws InflationException {
        if (params == null) {
            // weak assert that the params should always be passed in the new pipeline
            mNotifPipelineFlags.checkLegacyPipelineEnabled();
        }
        ViewGroup parent = mListContainer.getViewParentForNotification(entry);

        if (entry.rowExists()) {
@@ -190,39 +178,6 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
        mBindRowCallback.onBindRow(row);
    }

    /**
     * Updates the views bound to an entry when the entry's ranking changes, either in-place or by
     * reinflating them.
     *
     * TODO: Should this method be in this class?
     */
    @Override
    public void onNotificationRankingUpdated(
            NotificationEntry entry,
            @Nullable Integer oldImportance,
            NotificationUiAdjustment oldAdjustment,
            NotificationUiAdjustment newAdjustment,
            NotificationRowContentBinder.InflationCallback callback) {
        mNotifPipelineFlags.checkLegacyPipelineEnabled();
        if (NotificationUiAdjustment.needReinflate(oldAdjustment, newAdjustment)) {
            if (entry.rowExists()) {
                ExpandableNotificationRow row = entry.getRow();
                row.reset();
                updateRow(entry, row);
                inflateContentViews(entry, null, row, callback);
            } else {
                // Once the RowInflaterTask is done, it will pick up the updated entry, so
                // no-op here.
            }
        } else {
            if (oldImportance != null && entry.getImportance() != oldImportance) {
                if (entry.rowExists()) {
                    entry.getRow().onNotificationRankingUpdated();
                }
            }
        }
    }

    /**
     * Update row after the notification has updated.
     *
@@ -243,24 +198,12 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
     */
    private void inflateContentViews(
            NotificationEntry entry,
            NotifInflater.Params inflaterParams,
            @NonNull NotifInflater.Params inflaterParams,
            ExpandableNotificationRow row,
            @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) {
        final boolean useIncreasedCollapsedHeight =
                mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance());
        final boolean isLowPriority;
        if (inflaterParams != null) {
            // NEW pipeline
            isLowPriority = inflaterParams.isLowPriority();
        } else {
            // LEGACY pipeline
            mNotifPipelineFlags.checkLegacyPipelineEnabled();
            // If this is our first time inflating, we don't actually know the groupings for real
            // yet, so we might actually inflate a low priority content view incorrectly here and
            // have to correct it later in the pipeline. On subsequent inflations (i.e. updates),
            // this should inflate the correct view.
            isLowPriority = mLowPriorityInflationHelper.shouldUseLowPriorityView(entry);
        }
        final boolean isLowPriority = inflaterParams.isLowPriority();

        RowContentBindParams params = mRowContentBindStage.getStageParams(entry);
        params.requireContentViews(FLAG_CONTENT_VIEW_CONTRACTED);
+0 −49
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.notification.collection.legacy;

import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.notification.NotifPipelineFlags;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

import javax.inject.Inject;

/**
 * Helper class that provide methods to help check when we need to inflate a low priority version
 * ot notification content.
 */
@SysUISingleton
public class LowPriorityInflationHelper {
    private final NotificationGroupManagerLegacy mGroupManager;
    private final NotifPipelineFlags mNotifPipelineFlags;

    @Inject
    LowPriorityInflationHelper(
            NotificationGroupManagerLegacy groupManager,
            NotifPipelineFlags notifPipelineFlags) {
        mGroupManager = groupManager;
        mNotifPipelineFlags = notifPipelineFlags;
    }

    /**
     * Whether the notification should inflate a low priority version of its content views.
     */
    public boolean shouldUseLowPriorityView(NotificationEntry entry) {
        mNotifPipelineFlags.checkLegacyPipelineEnabled();
        return entry.isAmbient() && !mGroupManager.isChildInGroup(entry);
    }
}
+0 −950

File deleted.

Preview size limit exceeded, changes collapsed.

Loading