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

Commit 17aaa251 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Inject CentralSurfacesCommandQueueCallbacks directly into CS.

Injected lazily because there's a circular dependency between the two.

Bug: 277762009
Test: manual: Verify CSCQC only created once, still gets callback info
Test: atest CentralSurfacesCommandQueueCallbacksTest
CentralSurfacesImplTest

Change-Id: Ie7a9c59de66e97eb1dde4485d35784e0bf367b14
parent 7f65f246
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.R;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.camera.CameraIntents;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.DisplayId;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.flags.FeatureFlags;
@@ -67,7 +68,6 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.disableflags.DisableFlagsLogger;
import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController;
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -80,7 +80,7 @@ import java.util.Optional;
import javax.inject.Inject;

/** */
@CentralSurfacesComponent.CentralSurfacesScope
@SysUISingleton
public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callbacks {
    private final CentralSurfaces mCentralSurfaces;
    private final Context mContext;
+4 −6
Original line number Diff line number Diff line
@@ -308,6 +308,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
    private final Context mContext;
    private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    private final DeviceStateManager mDeviceStateManager;
    private final Lazy<CentralSurfacesCommandQueueCallbacks> mCommandQueueCallbacksLazy;
    private CentralSurfacesCommandQueueCallbacks mCommandQueueCallbacks;
    private float mTransitionToFullShadeProgress = 0f;
    private final NotificationListContainer mNotifListContainer;
@@ -739,6 +740,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
            VolumeComponent volumeComponent,
            CommandQueue commandQueue,
            CentralSurfacesComponent.Factory centralSurfacesComponentFactory,
            Lazy<CentralSurfacesCommandQueueCallbacks> commandQueueCallbacksLazy,
            PluginManager pluginManager,
            ShadeController shadeController,
            StatusBarKeyguardViewManager statusBarKeyguardViewManager,
@@ -847,6 +849,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mVolumeComponent = volumeComponent;
        mCommandQueue = commandQueue;
        mCentralSurfacesComponentFactory = centralSurfacesComponentFactory;
        mCommandQueueCallbacksLazy = commandQueueCallbacksLazy;
        mPluginManager = pluginManager;
        mShadeController = shadeController;
        mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
@@ -1613,12 +1616,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        // Listen for demo mode changes
        mDemoModeController.addCallback(mDemoModeCallback);

        if (mCommandQueueCallbacks != null) {
            mCommandQueue.removeCallback(mCommandQueueCallbacks);
        }
        mCommandQueueCallbacks =
                mCentralSurfacesComponent.getCentralSurfacesCommandQueueCallbacks();
        // Connect in to the status bar manager service
        mCommandQueueCallbacks = mCommandQueueCallbacksLazy.get();
        mCommandQueue.addCallback(mCommandQueueCallbacks);
    }

+0 −6
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.android.systemui.shade.ShadeHeaderController;
import com.android.systemui.statusbar.notification.NotificationActivityStarter;
import com.android.systemui.statusbar.phone.CentralSurfacesCommandQueueCallbacks;
import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
import com.android.systemui.statusbar.phone.StatusBarNotificationActivityStarterModule;
import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment;
@@ -66,11 +65,6 @@ public interface CentralSurfacesComponent {
    @Scope
    @interface CentralSurfacesScope {}

    /**
     * Creates a CentralSurfacesCommandQueueCallbacks.
     */
    CentralSurfacesCommandQueueCallbacks getCentralSurfacesCommandQueueCallbacks();

    /**
     * Creates a {@link ShadeHeaderController}.
     */
+2 −0
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
    @Mock private CommandQueue mCommandQueue;
    @Mock private CentralSurfacesComponent.Factory mStatusBarComponentFactory;
    @Mock private CentralSurfacesComponent mCentralSurfacesComponent;
    @Mock private CentralSurfacesCommandQueueCallbacks mCentralSurfacesCommandQueueCallbacks;
    @Mock private PluginManager mPluginManager;
    @Mock private ViewMediatorCallback mViewMediatorCallback;
    @Mock private StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
@@ -531,6 +532,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
                mVolumeComponent,
                mCommandQueue,
                mStatusBarComponentFactory,
                () -> mCentralSurfacesCommandQueueCallbacks,
                mPluginManager,
                mShadeController,
                mStatusBarKeyguardViewManager,