Remove getShadeViewController calls

Bug: 288868098
Test: updated and ran affected test
Change-Id: Ie99aaf892fa20dbf9379e749ec83d384d973f038
This commit is contained in:
Justin Weir
2023-07-19 10:45:08 -04:00
parent 5d0589110a
commit 59b2e81d30
2 changed files with 13 additions and 7 deletions

View File

@@ -133,6 +133,7 @@ import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.navigationbar.RegionSamplingHelper;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shared.rotation.RotationButton;
@@ -199,6 +200,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
private final SysUiState mSysUiFlagsContainer;
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
private final ShadeController mShadeController;
private final ShadeViewController mShadeViewController;
private final NotificationRemoteInputManager mNotificationRemoteInputManager;
private final OverviewProxyService mOverviewProxyService;
private final NavigationModeController mNavigationModeController;
@@ -523,6 +525,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
@Inject
NavigationBar(
NavigationBarView navigationBarView,
ShadeController shadeController,
NavigationBarFrame navigationBarFrame,
@Nullable Bundle savedState,
@DisplayId Context context,
@@ -541,7 +544,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
Optional<Pip> pipOptional,
Optional<Recents> recentsOptional,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
ShadeController shadeController,
ShadeViewController shadeViewController,
NotificationRemoteInputManager notificationRemoteInputManager,
NotificationShadeDepthController notificationShadeDepthController,
@Main Handler mainHandler,
@@ -577,6 +580,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
mSysUiFlagsContainer = sysUiFlagsContainer;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
mShadeController = shadeController;
mShadeViewController = shadeViewController;
mNotificationRemoteInputManager = notificationRemoteInputManager;
mOverviewProxyService = overviewProxyService;
mNavigationModeController = navigationModeController;
@@ -739,8 +743,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
final Display display = mView.getDisplay();
mView.setComponents(mRecentsOptional);
if (mCentralSurfacesOptionalLazy.get().isPresent()) {
mView.setComponents(
mCentralSurfacesOptionalLazy.get().get().getShadeViewController());
mView.setComponents(mShadeViewController);
}
mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer);
mView.setOnVerticalChangedListener(this::onVerticalChanged);
@@ -1341,9 +1344,10 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
}
private void onVerticalChanged(boolean isVertical) {
Optional<CentralSurfaces> cs = mCentralSurfacesOptionalLazy.get();
if (cs.isPresent() && cs.get().getShadeViewController() != null) {
cs.get().getShadeViewController().setQsScrimEnabled(!isVertical);
// This check can probably be safely removed. It only remained to reduce regression
// risk for a broad change that removed the CentralSurfaces reference in the if block
if (mCentralSurfacesOptionalLazy.get().isPresent()) {
mShadeViewController.setQsScrimEnabled(!isVertical);
}
}

View File

@@ -94,6 +94,7 @@ import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.NotificationShadeWindowView;
import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shared.rotation.RotationButtonController;
import com.android.systemui.shared.system.TaskStackChangeListeners;
import com.android.systemui.statusbar.CommandQueue;
@@ -467,6 +468,7 @@ public class NavigationBarTest extends SysuiTestCase {
when(deviceProvisionedController.isDeviceProvisioned()).thenReturn(true);
return spy(new NavigationBar(
mNavigationBarView,
mock(ShadeController.class),
mNavigationBarFrame,
null,
context,
@@ -485,7 +487,7 @@ public class NavigationBarTest extends SysuiTestCase {
Optional.of(mock(Pip.class)),
Optional.of(mock(Recents.class)),
() -> Optional.of(mCentralSurfaces),
mock(ShadeController.class),
mock(ShadeViewController.class),
mock(NotificationRemoteInputManager.class),
mock(NotificationShadeDepthController.class),
mHandler,