From 26d95db9dbd5d847ca56bb9b13b0a000548463f4 Mon Sep 17 00:00:00 2001 From: Caitlin Shkuratov Date: Tue, 25 Apr 2023 14:50:10 +0000 Subject: [PATCH] [Central Surfaces] Make CombinedShadeHeadersConstraintManager singleton. Bug: 277762009 Test: manual: verify privacy chip in QQS still works correctly Test: atest CombinedShadeHeaderConstraintsTest Change-Id: Ieee4b442a69a87f33f5bbdb713752e8f7fe992bf --- .../shade/CombinedShadeHeadersConstraintManagerImpl.kt | 4 ++-- .../src/com/android/systemui/shade/ShadeModule.kt | 6 ++++++ .../statusbar/phone/dagger/StatusBarViewModule.java | 10 ---------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/shade/CombinedShadeHeadersConstraintManagerImpl.kt b/packages/SystemUI/src/com/android/systemui/shade/CombinedShadeHeadersConstraintManagerImpl.kt index b3d31f2986d17..7e0f504002996 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/CombinedShadeHeadersConstraintManagerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/CombinedShadeHeadersConstraintManagerImpl.kt @@ -19,12 +19,12 @@ package com.android.systemui.shade import android.view.ViewGroup import androidx.constraintlayout.widget.ConstraintSet import com.android.systemui.R -import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent +import com.android.systemui.dagger.SysUISingleton /** * Standard implementation of [CombinedShadeHeadersConstraintManager]. */ -@CentralSurfacesComponent.CentralSurfacesScope +@SysUISingleton object CombinedShadeHeadersConstraintManagerImpl : CombinedShadeHeadersConstraintManager { override fun privacyChipVisibilityConstraints(visible: Boolean): ConstraintsChanges { diff --git a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt index 49e02e3b23379..a0ab451cb99eb 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/ShadeModule.kt @@ -127,5 +127,11 @@ abstract class ShadeModule { stub.layoutResource = layoutId return stub.inflate() as MotionLayout } + + @Provides + @SysUISingleton + fun providesCombinedShadeHeadersConstraintManager(): CombinedShadeHeadersConstraintManager { + return CombinedShadeHeadersConstraintManagerImpl + } } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java index 94414dd65fbb9..1b9b508fc1b39 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarViewModule.java @@ -35,8 +35,6 @@ import com.android.systemui.flags.Flags; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.privacy.OngoingPrivacyChip; import com.android.systemui.settings.UserTracker; -import com.android.systemui.shade.CombinedShadeHeadersConstraintManager; -import com.android.systemui.shade.CombinedShadeHeadersConstraintManagerImpl; import com.android.systemui.shade.NotificationPanelView; import com.android.systemui.shade.NotificationPanelViewController; import com.android.systemui.shade.NotificationShadeWindowView; @@ -136,14 +134,6 @@ public abstract class StatusBarViewModule { abstract ShadeViewController bindsShadeViewController( NotificationPanelViewController notificationPanelViewController); - /** */ - @Provides - @CentralSurfacesComponent.CentralSurfacesScope - public static CombinedShadeHeadersConstraintManager - provideCombinedShadeHeadersConstraintManager() { - return CombinedShadeHeadersConstraintManagerImpl.INSTANCE; - } - /** */ @Provides @CentralSurfacesComponent.CentralSurfacesScope