Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +6 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.inflation.LowPriorityInflationHelper; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; Loading Loading @@ -71,6 +72,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle protected final VisualStabilityManager mVisualStabilityManager; private final SysuiStatusBarStateController mStatusBarStateController; private final NotificationEntryManager mEntryManager; private final LowPriorityInflationHelper mLowPriorityInflationHelper; /** * {@code true} if notifications not part of a group should by default be rendered in their Loading Loading @@ -108,7 +110,8 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle BubbleController bubbleController, DynamicPrivacyController privacyController, ForegroundServiceSectionController fgsSectionController, DynamicChildBindController dynamicChildBindController) { DynamicChildBindController dynamicChildBindController, LowPriorityInflationHelper lowPriorityInflationHelper) { mContext = context; mHandler = mainHandler; mLockscreenUserManager = notificationLockscreenUserManager; Loading @@ -124,6 +127,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle mBubbleController = bubbleController; mDynamicPrivacyController = privacyController; mDynamicChildBindController = dynamicChildBindController; mLowPriorityInflationHelper = lowPriorityInflationHelper; } public void setUpWithPresenter(NotificationPresenter presenter, Loading Loading @@ -177,6 +181,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle currentUserId); ent.setSensitive(sensitive, deviceSensitive); ent.getRow().setNeedsRedaction(needsRedaction); mLowPriorityInflationHelper.recheckLowPriorityViewAndInflate(ent, ent.getRow()); boolean isChildInGroup = mGroupManager.isChildInGroupWithSummary(ent.getSbn()); boolean groupChangesAllowed = mVisualStabilityManager.areGroupChangesAllowed() Loading packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.notification.DynamicChildBindController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.inflation.LowPriorityInflationHelper; import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationGroupManager; Loading Loading @@ -143,7 +144,8 @@ public interface StatusBarDependenciesModule { BubbleController bubbleController, DynamicPrivacyController privacyController, ForegroundServiceSectionController fgsSectionController, DynamicChildBindController dynamicChildBindController) { DynamicChildBindController dynamicChildBindController, LowPriorityInflationHelper lowPriorityInflationHelper) { return new NotificationViewHierarchyManager( context, mainHandler, Loading @@ -156,7 +158,8 @@ public interface StatusBarDependenciesModule { bubbleController, privacyController, fgsSectionController, dynamicChildBindController); dynamicChildBindController, lowPriorityInflationHelper); } /** Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,8 @@ public class NotificationEntryManager implements entry.setSbn(notification); for (NotifCollectionListener listener : mNotifCollectionListeners) { listener.onEntryBind(entry, notification); } mGroupManager.onEntryUpdated(entry, oldSbn); } mGroupManager.onEntryUpdated(entry, oldSbn); mLogger.logNotifUpdated(entry.getKey()); for (NotificationEntryListener listener : mNotificationEntryListeners) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/LowPriorityInflationHelper.java 0 → 100644 +85 −0 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.inflation; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.RowContentBindParams; import com.android.systemui.statusbar.notification.row.RowContentBindStage; import com.android.systemui.statusbar.phone.NotificationGroupManager; import javax.inject.Inject; import javax.inject.Singleton; /** * Helper class that provide methods to help check when we need to inflate a low priority version * ot notification content. */ @Singleton public class LowPriorityInflationHelper { private final FeatureFlags mFeatureFlags; private final NotificationGroupManager mGroupManager; private final RowContentBindStage mRowContentBindStage; @Inject LowPriorityInflationHelper( FeatureFlags featureFlags, NotificationGroupManager groupManager, RowContentBindStage rowContentBindStage) { mFeatureFlags = featureFlags; mGroupManager = groupManager; mRowContentBindStage = rowContentBindStage; } /** * Check if we inflated the wrong version of the view and if we need to reinflate the * content views to be their low priority version or not. * * Whether we inflate the low priority view or not depends on the notification being visually * part of a group. Since group membership is determined AFTER inflation, we're forced to check * again at a later point in the pipeline to see if we inflated the wrong view and reinflate * the correct one here. * * TODO: The group manager should run before inflation so that we don't deal with this */ public void recheckLowPriorityViewAndInflate( NotificationEntry entry, ExpandableNotificationRow row) { RowContentBindParams params = mRowContentBindStage.getStageParams(entry); final boolean shouldBeLowPriority = shouldUseLowPriorityView(entry); if (!row.isRemoved() && row.isLowPriority() != shouldBeLowPriority) { params.setUseLowPriority(shouldBeLowPriority); mRowContentBindStage.requestRebind(entry, en -> row.setIsLowPriority(shouldBeLowPriority)); } } /** * Whether the notification should inflate a low priority version of its content views. */ public boolean shouldUseLowPriorityView(NotificationEntry entry) { boolean isGroupChild; if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { isGroupChild = (entry.getParent() != GroupEntry.ROOT_ENTRY); } else { isGroupChild = mGroupManager.isChildInGroupWithSummary(entry.getSbn()); } return entry.isAmbient() && !isGroupChild; } } packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java +10 −3 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { private final ExpandableNotificationRowComponent.Builder mExpandableNotificationRowComponentBuilder; private final IconManager mIconManager; private final LowPriorityInflationHelper mLowPriorityInflationHelper; private NotificationPresenter mPresenter; private NotificationListContainer mListContainer; Loading @@ -81,7 +82,8 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { NotificationInterruptStateProvider notificationInterruptionStateProvider, Provider<RowInflaterTask> rowInflaterTaskProvider, ExpandableNotificationRowComponent.Builder expandableNotificationRowComponentBuilder, IconManager iconManager) { IconManager iconManager, LowPriorityInflationHelper lowPriorityInflationHelper) { mContext = context; mNotifBindPipeline = notifBindPipeline; mRowContentBindStage = rowContentBindStage; Loading @@ -92,6 +94,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { mRowInflaterTaskProvider = rowInflaterTaskProvider; mExpandableNotificationRowComponentBuilder = expandableNotificationRowComponentBuilder; mIconManager = iconManager; mLowPriorityInflationHelper = lowPriorityInflationHelper; } /** Loading Loading @@ -225,11 +228,15 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) { final boolean useIncreasedCollapsedHeight = mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance()); final boolean isLowPriority = entry.isAmbient(); // 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. final boolean isLowPriority = mLowPriorityInflationHelper.shouldUseLowPriorityView(entry); RowContentBindParams params = mRowContentBindStage.getStageParams(entry); params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight); params.setUseLowPriority(entry.isAmbient()); params.setUseLowPriority(isLowPriority); // TODO: Replace this API with RowContentBindParams directly. Also move to a separate // redaction controller. Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +6 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.inflation.LowPriorityInflationHelper; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; Loading Loading @@ -71,6 +72,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle protected final VisualStabilityManager mVisualStabilityManager; private final SysuiStatusBarStateController mStatusBarStateController; private final NotificationEntryManager mEntryManager; private final LowPriorityInflationHelper mLowPriorityInflationHelper; /** * {@code true} if notifications not part of a group should by default be rendered in their Loading Loading @@ -108,7 +110,8 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle BubbleController bubbleController, DynamicPrivacyController privacyController, ForegroundServiceSectionController fgsSectionController, DynamicChildBindController dynamicChildBindController) { DynamicChildBindController dynamicChildBindController, LowPriorityInflationHelper lowPriorityInflationHelper) { mContext = context; mHandler = mainHandler; mLockscreenUserManager = notificationLockscreenUserManager; Loading @@ -124,6 +127,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle mBubbleController = bubbleController; mDynamicPrivacyController = privacyController; mDynamicChildBindController = dynamicChildBindController; mLowPriorityInflationHelper = lowPriorityInflationHelper; } public void setUpWithPresenter(NotificationPresenter presenter, Loading Loading @@ -177,6 +181,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle currentUserId); ent.setSensitive(sensitive, deviceSensitive); ent.getRow().setNeedsRedaction(needsRedaction); mLowPriorityInflationHelper.recheckLowPriorityViewAndInflate(ent, ent.getRow()); boolean isChildInGroup = mGroupManager.isChildInGroupWithSummary(ent.getSbn()); boolean groupChangesAllowed = mVisualStabilityManager.areGroupChangesAllowed() Loading
packages/SystemUI/src/com/android/systemui/statusbar/dagger/StatusBarDependenciesModule.java +5 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import com.android.systemui.statusbar.notification.DynamicChildBindController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.VisualStabilityManager; import com.android.systemui.statusbar.notification.collection.inflation.LowPriorityInflationHelper; import com.android.systemui.statusbar.notification.stack.ForegroundServiceSectionController; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.NotificationGroupManager; Loading Loading @@ -143,7 +144,8 @@ public interface StatusBarDependenciesModule { BubbleController bubbleController, DynamicPrivacyController privacyController, ForegroundServiceSectionController fgsSectionController, DynamicChildBindController dynamicChildBindController) { DynamicChildBindController dynamicChildBindController, LowPriorityInflationHelper lowPriorityInflationHelper) { return new NotificationViewHierarchyManager( context, mainHandler, Loading @@ -156,7 +158,8 @@ public interface StatusBarDependenciesModule { bubbleController, privacyController, fgsSectionController, dynamicChildBindController); dynamicChildBindController, lowPriorityInflationHelper); } /** Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -619,7 +619,8 @@ public class NotificationEntryManager implements entry.setSbn(notification); for (NotifCollectionListener listener : mNotifCollectionListeners) { listener.onEntryBind(entry, notification); } mGroupManager.onEntryUpdated(entry, oldSbn); } mGroupManager.onEntryUpdated(entry, oldSbn); mLogger.logNotifUpdated(entry.getKey()); for (NotificationEntryListener listener : mNotificationEntryListeners) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/LowPriorityInflationHelper.java 0 → 100644 +85 −0 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.inflation; import com.android.systemui.statusbar.FeatureFlags; import com.android.systemui.statusbar.notification.collection.GroupEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; import com.android.systemui.statusbar.notification.row.RowContentBindParams; import com.android.systemui.statusbar.notification.row.RowContentBindStage; import com.android.systemui.statusbar.phone.NotificationGroupManager; import javax.inject.Inject; import javax.inject.Singleton; /** * Helper class that provide methods to help check when we need to inflate a low priority version * ot notification content. */ @Singleton public class LowPriorityInflationHelper { private final FeatureFlags mFeatureFlags; private final NotificationGroupManager mGroupManager; private final RowContentBindStage mRowContentBindStage; @Inject LowPriorityInflationHelper( FeatureFlags featureFlags, NotificationGroupManager groupManager, RowContentBindStage rowContentBindStage) { mFeatureFlags = featureFlags; mGroupManager = groupManager; mRowContentBindStage = rowContentBindStage; } /** * Check if we inflated the wrong version of the view and if we need to reinflate the * content views to be their low priority version or not. * * Whether we inflate the low priority view or not depends on the notification being visually * part of a group. Since group membership is determined AFTER inflation, we're forced to check * again at a later point in the pipeline to see if we inflated the wrong view and reinflate * the correct one here. * * TODO: The group manager should run before inflation so that we don't deal with this */ public void recheckLowPriorityViewAndInflate( NotificationEntry entry, ExpandableNotificationRow row) { RowContentBindParams params = mRowContentBindStage.getStageParams(entry); final boolean shouldBeLowPriority = shouldUseLowPriorityView(entry); if (!row.isRemoved() && row.isLowPriority() != shouldBeLowPriority) { params.setUseLowPriority(shouldBeLowPriority); mRowContentBindStage.requestRebind(entry, en -> row.setIsLowPriority(shouldBeLowPriority)); } } /** * Whether the notification should inflate a low priority version of its content views. */ public boolean shouldUseLowPriorityView(NotificationEntry entry) { boolean isGroupChild; if (mFeatureFlags.isNewNotifPipelineRenderingEnabled()) { isGroupChild = (entry.getParent() != GroupEntry.ROOT_ENTRY); } else { isGroupChild = mGroupManager.isChildInGroupWithSummary(entry.getSbn()); } return entry.isAmbient() && !isGroupChild; } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/inflation/NotificationRowBinderImpl.java +10 −3 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { private final ExpandableNotificationRowComponent.Builder mExpandableNotificationRowComponentBuilder; private final IconManager mIconManager; private final LowPriorityInflationHelper mLowPriorityInflationHelper; private NotificationPresenter mPresenter; private NotificationListContainer mListContainer; Loading @@ -81,7 +82,8 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { NotificationInterruptStateProvider notificationInterruptionStateProvider, Provider<RowInflaterTask> rowInflaterTaskProvider, ExpandableNotificationRowComponent.Builder expandableNotificationRowComponentBuilder, IconManager iconManager) { IconManager iconManager, LowPriorityInflationHelper lowPriorityInflationHelper) { mContext = context; mNotifBindPipeline = notifBindPipeline; mRowContentBindStage = rowContentBindStage; Loading @@ -92,6 +94,7 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { mRowInflaterTaskProvider = rowInflaterTaskProvider; mExpandableNotificationRowComponentBuilder = expandableNotificationRowComponentBuilder; mIconManager = iconManager; mLowPriorityInflationHelper = lowPriorityInflationHelper; } /** Loading Loading @@ -225,11 +228,15 @@ public class NotificationRowBinderImpl implements NotificationRowBinder { @Nullable NotificationRowContentBinder.InflationCallback inflationCallback) { final boolean useIncreasedCollapsedHeight = mMessagingUtil.isImportantMessaging(entry.getSbn(), entry.getImportance()); final boolean isLowPriority = entry.isAmbient(); // 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. final boolean isLowPriority = mLowPriorityInflationHelper.shouldUseLowPriorityView(entry); RowContentBindParams params = mRowContentBindStage.getStageParams(entry); params.setUseIncreasedCollapsedHeight(useIncreasedCollapsedHeight); params.setUseLowPriority(entry.isAmbient()); params.setUseLowPriority(isLowPriority); // TODO: Replace this API with RowContentBindParams directly. Also move to a separate // redaction controller. Loading