1/3 Begin removine SuperStatusBarViewFactory.

Use the StatusBarComponent in its place.

Bug: 190746471
Test: atest SystemUITests && manual
Change-Id: Idc7c347d19309dbbab8c134370d31479ddf5eb86
This commit is contained in:
Dave Mankoff
2021-08-19 10:17:22 -04:00
parent 8e97f22068
commit 0e2230c880
6 changed files with 44 additions and 60 deletions

View File

@@ -23,8 +23,6 @@ import android.view.ViewGroup;
import com.android.systemui.R;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.notification.row.dagger.NotificationShelfComponent;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.StatusBarWindowView;
import com.android.systemui.util.InjectionInflationController;
@@ -41,7 +39,6 @@ public class SuperStatusBarViewFactory {
private final InjectionInflationController mInjectionInflationController;
private final NotificationShelfComponent.Builder mNotificationShelfComponentBuilder;
private NotificationShadeWindowView mNotificationShadeWindowView;
private StatusBarWindowView mStatusBarWindowView;
private NotificationShelfController mNotificationShelfController;
@@ -54,28 +51,6 @@ public class SuperStatusBarViewFactory {
mNotificationShelfComponentBuilder = notificationShelfComponentBuilder;
}
/**
* Gets the inflated {@link NotificationShadeWindowView} from
* {@link R.layout#super_notification_shade}.
* Returns a cached instance, if it has already been inflated.
*/
public NotificationShadeWindowView getNotificationShadeWindowView() {
if (mNotificationShadeWindowView != null) {
return mNotificationShadeWindowView;
}
mNotificationShadeWindowView = (NotificationShadeWindowView)
mInjectionInflationController.injectable(
LayoutInflater.from(mContext)).inflate(R.layout.super_notification_shade,
/* root= */ null);
if (mNotificationShadeWindowView == null) {
throw new IllegalStateException(
"R.layout.super_notification_shade could not be properly inflated");
}
return mNotificationShadeWindowView;
}
/**
* Gets the inflated {@link StatusBarWindowView} from {@link R.layout#super_status_bar}.
* Returns a cached instance, if it has already been inflated.
@@ -127,13 +102,4 @@ public class SuperStatusBarViewFactory {
return mNotificationShelfController;
}
public NotificationPanelView getNotificationPanelView() {
NotificationShadeWindowView notificationShadeWindowView = getNotificationShadeWindowView();
if (notificationShadeWindowView == null) {
return null;
}
return mNotificationShadeWindowView.findViewById(R.id.notification_panel);
}
}

View File

@@ -228,11 +228,11 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.SplashscreenContentDrawer;
@@ -248,7 +248,6 @@ import java.util.Optional;
import java.util.concurrent.Executor;
import javax.inject.Named;
import javax.inject.Provider;
import dagger.Lazy;
@@ -491,7 +490,7 @@ public class StatusBar extends SystemUI implements
protected NotificationShadeWindowViewController mNotificationShadeWindowViewController;
private final DozeParameters mDozeParameters;
private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy;
private final Provider<StatusBarComponent.Builder> mStatusBarComponentBuilder;
private final StatusBarComponent.Factory mStatusBarComponentFactory;
private final PluginManager mPluginManager;
private final Optional<LegacySplitScreen> mSplitScreenOptional;
private final StatusBarNotificationActivityStarter.Builder
@@ -744,7 +743,7 @@ public class StatusBar extends SystemUI implements
DozeScrimController dozeScrimController,
VolumeComponent volumeComponent,
CommandQueue commandQueue,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
StatusBarComponent.Factory statusBarComponentFactory,
PluginManager pluginManager,
Optional<LegacySplitScreen> splitScreenOptional,
LightsOutNotifController lightsOutNotifController,
@@ -841,7 +840,7 @@ public class StatusBar extends SystemUI implements
mNotificationShadeDepthControllerLazy = notificationShadeDepthControllerLazy;
mVolumeComponent = volumeComponent;
mCommandQueue = commandQueue;
mStatusBarComponentBuilder = statusBarComponentBuilder;
mStatusBarComponentFactory = statusBarComponentFactory;
mPluginManager = pluginManager;
mSplitScreenOptional = splitScreenOptional;
mStatusBarNotificationActivityStarterBuilder = statusBarNotificationActivityStarterBuilder;
@@ -1533,9 +1532,8 @@ public class StatusBar extends SystemUI implements
}
private void inflateStatusBarWindow() {
mNotificationShadeWindowView = mSuperStatusBarViewFactory.getNotificationShadeWindowView();
StatusBarComponent statusBarComponent = mStatusBarComponentBuilder.get()
.statusBarWindowView(mNotificationShadeWindowView).build();
StatusBarComponent statusBarComponent = mStatusBarComponentFactory.create();
mNotificationShadeWindowView = statusBarComponent.getNotificationShadeWindowView();
mNotificationShadeWindowViewController = statusBarComponent
.getNotificationShadeWindowViewController();
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);

View File

@@ -34,7 +34,6 @@ import java.lang.annotation.Retention;
import javax.inject.Scope;
import dagger.BindsInstance;
import dagger.Subcomponent;
/**
@@ -46,11 +45,9 @@ public interface StatusBarComponent {
/**
* Builder for {@link StatusBarComponent}.
*/
@Subcomponent.Builder
interface Builder {
@BindsInstance Builder statusBarWindowView(
NotificationShadeWindowView notificationShadeWindowView);
StatusBarComponent build();
@Subcomponent.Factory
interface Factory {
StatusBarComponent create();
}
/**
@@ -61,6 +58,13 @@ public interface StatusBarComponent {
@Scope
@interface StatusBarScope {}
/**
* Creates a {@link NotificationShadeWindowView}/
* @return
*/
@StatusBarScope
NotificationShadeWindowView getNotificationShadeWindowView();
/**
* Creates a NotificationShadeWindowViewController.
*/

View File

@@ -104,11 +104,11 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.concurrency.MessageRouter;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.StartingSurface;
@@ -117,7 +117,6 @@ import java.util.Optional;
import java.util.concurrent.Executor;
import javax.inject.Named;
import javax.inject.Provider;
import dagger.Lazy;
import dagger.Module;
@@ -187,7 +186,7 @@ public interface StatusBarPhoneModule {
DozeScrimController dozeScrimController,
VolumeComponent volumeComponent,
CommandQueue commandQueue,
Provider<StatusBarComponent.Builder> statusBarComponentBuilder,
StatusBarComponent.Factory statusBarComponentFactory,
PluginManager pluginManager,
Optional<LegacySplitScreen> splitScreenOptional,
LightsOutNotifController lightsOutNotifController,
@@ -281,7 +280,7 @@ public interface StatusBarPhoneModule {
dozeScrimController,
volumeComponent,
commandQueue,
statusBarComponentBuilder,
statusBarComponentFactory,
pluginManager,
splitScreenOptional,
lightsOutNotifController,

View File

@@ -17,6 +17,8 @@
package com.android.systemui.statusbar.phone.dagger;
import android.annotation.Nullable;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import com.android.keyguard.LockIconView;
@@ -26,6 +28,7 @@ import com.android.systemui.biometrics.AuthRippleView;
import com.android.systemui.statusbar.phone.NotificationPanelView;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.TapAgainView;
import com.android.systemui.util.InjectionInflationController;
import javax.inject.Named;
@@ -37,6 +40,24 @@ public abstract class StatusBarViewModule {
public static final String SPLIT_SHADE_HEADER = "split_shade_header";
/** */
@Provides
@StatusBarComponent.StatusBarScope
public static NotificationShadeWindowView providesNotificationShadeWindowView(
InjectionInflationController injectionInflationController,
Context context) {
NotificationShadeWindowView notificationShadeWindowView = (NotificationShadeWindowView)
injectionInflationController.injectable(
LayoutInflater.from(context)).inflate(R.layout.super_notification_shade,
/* root= */ null);
if (notificationShadeWindowView == null) {
throw new IllegalStateException(
"R.layout.super_notification_shade could not be properly inflated");
}
return notificationShadeWindowView;
}
/** */
@Provides
@StatusBarComponent.StatusBarScope

View File

@@ -140,12 +140,12 @@ import com.android.systemui.statusbar.policy.UserInfoControllerImpl;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.unfold.UnfoldLightRevealOverlayAnimation;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.concurrency.MessageRouterImpl;
import com.android.systemui.util.time.FakeSystemClock;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.wmshell.BubblesManager;
import com.android.systemui.unfold.config.UnfoldTransitionConfig;
import com.android.wm.shell.bubbles.Bubbles;
import com.android.wm.shell.legacysplitscreen.LegacySplitScreen;
import com.android.wm.shell.startingsurface.StartingSurface;
@@ -160,8 +160,6 @@ import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
import java.util.Optional;
import javax.inject.Provider;
import dagger.Lazy;
@SmallTest
@@ -235,8 +233,7 @@ public class StatusBarTest extends SysuiTestCase {
@Mock private ViewMediatorCallback mKeyguardVieMediatorCallback;
@Mock private VolumeComponent mVolumeComponent;
@Mock private CommandQueue mCommandQueue;
@Mock private Provider<StatusBarComponent.Builder> mStatusBarComponentBuilderProvider;
@Mock private StatusBarComponent.Builder mStatusBarComponentBuilder;
@Mock private StatusBarComponent.Factory mStatusBarComponentFactory;
@Mock private StatusBarComponent mStatusBarComponent;
@Mock private PluginManager mPluginManager;
@Mock private LegacySplitScreen mLegacySplitScreen;
@@ -341,8 +338,7 @@ public class StatusBarTest extends SysuiTestCase {
when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper);
when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
when(mStatusBarComponentBuilderProvider.get()).thenReturn(mStatusBarComponentBuilder);
when(mStatusBarComponentBuilder.build()).thenReturn(mStatusBarComponent);
when(mStatusBarComponentFactory.create()).thenReturn(mStatusBarComponent);
when(mStatusBarComponent.getNotificationShadeWindowViewController()).thenReturn(
mNotificationShadeWindowViewController);
@@ -407,7 +403,7 @@ public class StatusBarTest extends SysuiTestCase {
mDozeScrimController,
mVolumeComponent,
mCommandQueue,
mStatusBarComponentBuilderProvider,
mStatusBarComponentFactory,
mPluginManager,
Optional.of(mLegacySplitScreen),
mLightsOutNotifController,