diff options
| author | 2019-11-12 16:40:00 -0800 | |
|---|---|---|
| committer | 2019-11-18 09:07:04 -0800 | |
| commit | 82b96cd23a44e4f6fadb9fa6b35befecd7fb1c4b (patch) | |
| tree | d259717c9390cb2b7d35548787a838a0c241935d | |
| parent | 7c93dc5e45ba7420c877b4e80fd517360068ab1f (diff) | |
Inject StatusBarWindowViewController
Bug: 144378800
Test: manual, atest SystemUITests
Change-Id: I9c957ffc943bcef04a2473e5feaca6d85b26071c
11 files changed, 234 insertions, 245 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 4e5a3a633c3e..f7ea39adde22 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -114,6 +114,7 @@ import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.LightBarController; import com.android.systemui.statusbar.phone.LightsOutNotifController; +import com.android.systemui.statusbar.phone.LockscreenLockIconController; import com.android.systemui.statusbar.phone.LockscreenWallpaper; import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper; import com.android.systemui.statusbar.phone.NotificationGroupManager; @@ -153,7 +154,10 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt private static final float FLING_ANIMATION_MAX_TIME = 0.5f; // acceleration rate for the fling animation private static final float FLING_SPEED_UP_FACTOR = 0.6f; + private final ScrimController mScrimController; + private final StatusBarWindowViewController mStatusBarWindowViewController; + private final LockscreenLockIconController mLockscreenLockIconController; private float mOpeningVelocity = DEFAULT_FLING_VELOCITY; private float mClosingVelocity = DEFAULT_FLING_VELOCITY; @@ -287,7 +291,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuild, + StatusBarWindowViewController statusBarWindowViewController, + LockscreenLockIconController lockscreenLockIconController, DozeParameters dozeParameters, ScrimController scrimController, Lazy<LockscreenWallpaper> lockscreenWallpaperLazy, @@ -363,7 +368,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt notificationListener, configurationController, statusBarWindowController, - statusBarWindowViewControllerBuild, + statusBarWindowViewController, + lockscreenLockIconController, dozeParameters, scrimController, null /* keyguardLiftController */, @@ -385,6 +391,8 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt viewMediatorCallback, dismissCallbackRegistry); mScrimController = scrimController; + mStatusBarWindowViewController = statusBarWindowViewController; + mLockscreenLockIconController = lockscreenLockIconController; mDeviceProvisionedController = deviceProvisionedController; mCarServiceProvider = carServiceProvider; mDrivingStateHelperLazy = drivingStateHelperLazy; @@ -400,22 +408,22 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt mScreenLifecycle = Dependency.get(ScreenLifecycle.class); mScreenLifecycle.addObserver(mScreenObserver); - // Notification bar related setup. + // Notification bar related setup. mInitialBackgroundAlpha = (float) mContext.getResources().getInteger( - R.integer.config_initialNotificationBackgroundAlpha) / 100; + R.integer.config_initialNotificationBackgroundAlpha) / 100; if (mInitialBackgroundAlpha < 0 || mInitialBackgroundAlpha > 100) { throw new RuntimeException( - "Unable to setup notification bar due to incorrect initial background alpha" - + " percentage"); + "Unable to setup notification bar due to incorrect initial background alpha" + + " percentage"); } float finalBackgroundAlpha = Math.max( - mInitialBackgroundAlpha, - (float) mContext.getResources().getInteger( - R.integer.config_finalNotificationBackgroundAlpha) / 100); + mInitialBackgroundAlpha, + (float) mContext.getResources().getInteger( + R.integer.config_finalNotificationBackgroundAlpha) / 100); if (finalBackgroundAlpha < 0 || finalBackgroundAlpha > 100) { throw new RuntimeException( - "Unable to setup notification bar due to incorrect final background alpha" - + " percentage"); + "Unable to setup notification bar due to incorrect final background alpha" + + " percentage"); } mBackgroundAlphaDiff = finalBackgroundAlpha - mInitialBackgroundAlpha; diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java index 4813d6dfeb7e..eaf4ffb66227 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBarModule.java @@ -73,6 +73,7 @@ import com.android.systemui.statusbar.phone.HeadsUpManagerPhone; import com.android.systemui.statusbar.phone.KeyguardBypassController; import com.android.systemui.statusbar.phone.LightBarController; import com.android.systemui.statusbar.phone.LightsOutNotifController; +import com.android.systemui.statusbar.phone.LockscreenLockIconController; import com.android.systemui.statusbar.phone.LockscreenWallpaper; import com.android.systemui.statusbar.phone.NotificationGroupAlertTransferHelper; import com.android.systemui.statusbar.phone.NotificationGroupManager; @@ -160,7 +161,8 @@ public class CarStatusBarModule { NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder, + StatusBarWindowViewController statusBarWindowViewController, + LockscreenLockIconController lockscreenLockIconController, DozeParameters dozeParameters, ScrimController scrimController, Lazy<LockscreenWallpaper> lockscreenWallpaperLazy, @@ -235,7 +237,8 @@ public class CarStatusBarModule { notificationListener, configurationController, statusBarWindowController, - statusBarWindowViewControllerBuilder, + statusBarWindowViewController, + lockscreenLockIconController, dozeParameters, scrimController, lockscreenWallpaperLazy, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java b/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java index bc7c22d65a44..e808ad12af0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/SuperStatusBarViewFactory.java @@ -21,6 +21,7 @@ import android.view.LayoutInflater; import android.view.ViewGroup; import com.android.systemui.R; +import com.android.systemui.statusbar.phone.LockIcon; import com.android.systemui.statusbar.phone.StatusBarWindowView; import com.android.systemui.util.InjectionInflationController; @@ -66,6 +67,11 @@ public class SuperStatusBarViewFactory { return mStatusBarWindowView; } + /** Gets the {@link LockIcon} inside of {@link R.layout#super_status_bar}. */ + public LockIcon getLockIcon() { + return getStatusBarWindowView().findViewById(R.id.lock_icon); + } + /** * Gets the inflated {@link NotificationShelf} from * {@link R.layout#status_bar_notification_shelf}. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java index 6aee19454cda..063ad855343f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeServiceHost.java @@ -88,8 +88,9 @@ public final class DozeServiceHost implements DozeHost { private final PulseExpansionHandler mPulseExpansionHandler; private final StatusBarWindowController mStatusBarWindowController; private final NotificationWakeUpCoordinator mNotificationWakeUpCoordinator; + private final StatusBarWindowViewController mStatusBarWindowViewController; + private final LockscreenLockIconController mLockscreenLockIconController; private NotificationIconAreaController mNotificationIconAreaController; - private StatusBarWindowViewController mStatusBarWindowViewController; private StatusBarWindowView mStatusBarWindow; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private NotificationPanelView mNotificationPanel; @@ -110,7 +111,9 @@ public final class DozeServiceHost implements DozeHost { VisualStabilityManager visualStabilityManager, PulseExpansionHandler pulseExpansionHandler, StatusBarWindowController statusBarWindowController, - NotificationWakeUpCoordinator notificationWakeUpCoordinator) { + NotificationWakeUpCoordinator notificationWakeUpCoordinator, + StatusBarWindowViewController statusBarWindowViewController, + LockscreenLockIconController lockscreenLockIconController) { super(); mDozeLog = dozeLog; mPowerManager = powerManager; @@ -129,6 +132,8 @@ public final class DozeServiceHost implements DozeHost { mPulseExpansionHandler = pulseExpansionHandler; mStatusBarWindowController = statusBarWindowController; mNotificationWakeUpCoordinator = notificationWakeUpCoordinator; + mStatusBarWindowViewController = statusBarWindowViewController; + mLockscreenLockIconController = lockscreenLockIconController; } // TODO: we should try to not pass status bar in here if we can avoid it. @@ -138,13 +143,11 @@ public final class DozeServiceHost implements DozeHost { */ public void initialize(StatusBar statusBar, NotificationIconAreaController notificationIconAreaController, - StatusBarWindowViewController statusBarWindowViewController, StatusBarWindowView statusBarWindow, StatusBarKeyguardViewManager statusBarKeyguardViewManager, NotificationPanelView notificationPanel, View ambientIndicationContainer) { mStatusBar = statusBar; mNotificationIconAreaController = notificationIconAreaController; - mStatusBarWindowViewController = statusBarWindowViewController; mStatusBarWindow = statusBarWindow; mStatusBarKeyguardViewManager = statusBarKeyguardViewManager; mNotificationPanel = notificationPanel; @@ -262,7 +265,7 @@ public final class DozeServiceHost implements DozeHost { mKeyguardViewMediator.setPulsing(pulsing); mNotificationPanel.setPulsing(pulsing); mVisualStabilityManager.setPulsing(pulsing); - mStatusBarWindowViewController.setPulsing(pulsing); + mLockscreenLockIconController.setPulsing(pulsing); mIgnoreTouchWhilePulsing = false; if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) { mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java new file mode 100644 index 000000000000..1e35b46db774 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2019 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.phone; + +import com.android.systemui.statusbar.SuperStatusBarViewFactory; + +import javax.inject.Inject; +import javax.inject.Singleton; + +/** Controls the {@link LockIcon} in the lockscreen. */ +@Singleton +public class LockscreenLockIconController { + + private final LockIcon mLockIcon; + + @Inject + public LockscreenLockIconController(SuperStatusBarViewFactory superStatusBarViewFactory) { + mLockIcon = superStatusBarViewFactory.getLockIcon(); + } + + /** + * Called whenever the scrims become opaque, transparent or semi-transparent. + */ + public void onScrimVisibilityChanged(Integer scrimsVisible) { + if (mLockIcon != null) { + mLockIcon.onScrimVisibilityChanged(scrimsVisible); + } + } + + /** + * Propagate {@link StatusBar} pulsing state. + */ + public void setPulsing(boolean pulsing) { + if (mLockIcon != null) { + mLockIcon.setPulsing(pulsing); + } + } + + /** + * Called when the biometric authentication mode changes. + * + * @param wakeAndUnlock If the type is {@link BiometricUnlockController#isWakeAndUnlock()} + * @param isUnlock If the type is {@link BiometricUnlockController#isBiometricUnlock()} () + */ + public void onBiometricAuthModeChanged(boolean wakeAndUnlock, boolean isUnlock) { + if (mLockIcon != null) { + mLockIcon.onBiometricAuthModeChanged(wakeAndUnlock, isUnlock); + } + } + + /** + * When we're launching an affordance, like double pressing power to open camera. + */ + public void onShowingLaunchAffordanceChanged(Boolean showing) { + if (mLockIcon != null) { + mLockIcon.onShowingLaunchAffordanceChanged(showing); + } + } + + /** Sets whether the bouncer is showing. */ + public void setBouncerShowingScrimmed(boolean bouncerShowing) { + if (mLockIcon != null) { + mLockIcon.setBouncerShowingScrimmed(bouncerShowing); + } + } + + /** + * When {@link KeyguardBouncer} starts to be dismissed and starts to play its animation. + */ + public void onBouncerPreHideAnimation() { + if (mLockIcon != null) { + mLockIcon.onBouncerPreHideAnimation(); + } + } +} diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index fafdf6aa1128..2ace45c978e5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -353,12 +353,12 @@ public class StatusBar extends SystemUI implements DemoMode, private final Point mCurrentDisplaySize = new Point(); - protected StatusBarWindowViewController mStatusBarWindowViewController; protected StatusBarWindowView mStatusBarWindow; protected PhoneStatusBarView mStatusBarView; private int mStatusBarWindowState = WINDOW_STATE_SHOWING; protected StatusBarWindowController mStatusBarWindowController; private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; + private final LockscreenLockIconController mLockscreenLockIconController; @VisibleForTesting DozeServiceHost mDozeServiceHost; private boolean mWakeUpComingFromTouch; @@ -380,7 +380,7 @@ public class StatusBar extends SystemUI implements DemoMode, private final FalsingManager mFalsingManager; private final BroadcastDispatcher mBroadcastDispatcher; private final ConfigurationController mConfigurationController; - private final StatusBarWindowViewController.Builder mStatusBarWindowViewControllerBuilder; + private final StatusBarWindowViewController mStatusBarWindowViewController; private final DozeParameters mDozeParameters; private final Lazy<BiometricUnlockController> mBiometricUnlockControllerLazy; private final PluginManager mPluginManager; @@ -660,7 +660,8 @@ public class StatusBar extends SystemUI implements DemoMode, NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder, + StatusBarWindowViewController statusBarWindowViewController, + LockscreenLockIconController lockscreenLockIconController, DozeParameters dozeParameters, ScrimController scrimController, @Nullable KeyguardLiftController keyguardLiftController, @@ -730,7 +731,8 @@ public class StatusBar extends SystemUI implements DemoMode, mNotificationListener = notificationListener; mConfigurationController = configurationController; mStatusBarWindowController = statusBarWindowController; - mStatusBarWindowViewControllerBuilder = statusBarWindowViewControllerBuilder; + mStatusBarWindowViewController = statusBarWindowViewController; + mLockscreenLockIconController = lockscreenLockIconController; mDozeServiceHost = dozeServiceHost; mPowerManager = powerManager; mDozeParameters = dozeParameters; @@ -892,7 +894,7 @@ public class StatusBar extends SystemUI implements DemoMode, mKeyguardUpdateMonitor.registerCallback(mUpdateCallback); mDozeServiceHost.initialize(this, mNotificationIconAreaController, - mStatusBarWindowViewController, mStatusBarWindow, mStatusBarKeyguardViewManager, + mStatusBarWindow, mStatusBarKeyguardViewManager, mNotificationPanel, mAmbientIndicationContainer); Dependency.get(ActivityStarterDelegate.class).setActivityStarterImpl(this); @@ -1091,7 +1093,7 @@ public class StatusBar extends SystemUI implements DemoMode, mScrimController.setScrimVisibleListener(scrimsVisible -> { mStatusBarWindowController.setScrimsVisibility(scrimsVisible); if (mStatusBarWindow != null) { - mStatusBarWindowViewController.onScrimVisibilityChanged(scrimsVisible); + mLockscreenLockIconController.onScrimVisibilityChanged(scrimsVisible); } }); mScrimController.attachViews(scrimBehind, scrimInFront, scrimForBubble); @@ -1109,7 +1111,7 @@ public class StatusBar extends SystemUI implements DemoMode, } mNotificationPanel.setLaunchAffordanceListener( - mStatusBarWindowViewController::onShowingLaunchAffordanceChanged); + mLockscreenLockIconController::onShowingLaunchAffordanceChanged); // Set up the quick settings tile panel View container = mStatusBarWindow.findViewById(R.id.qs_frame); @@ -1386,9 +1388,7 @@ public class StatusBar extends SystemUI implements DemoMode, protected void inflateStatusBarWindow(Context context) { mStatusBarWindow = mSuperStatusBarViewFactory.getStatusBarWindowView(); - mStatusBarWindowViewController = mStatusBarWindowViewControllerBuilder - .setShadeController(this) - .build(); + mStatusBarWindowViewController.setupExpandedStatusBar(); } protected void startKeyguard() { @@ -3693,7 +3693,7 @@ public class StatusBar extends SystemUI implements DemoMode, mBouncerShowing = bouncerShowing; mKeyguardBypassController.setBouncerShowing(bouncerShowing); mPulseExpansionHandler.setBouncerShowing(bouncerShowing); - mStatusBarWindowViewController.setBouncerShowingScrimmed(isBouncerShowingScrimmed()); + mLockscreenLockIconController.setBouncerShowingScrimmed(isBouncerShowingScrimmed()); if (mStatusBarView != null) mStatusBarView.setBouncerShowing(bouncerShowing); updateHideIconsForBouncer(true /* animate */); mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */); @@ -3944,7 +3944,7 @@ public class StatusBar extends SystemUI implements DemoMode, public void notifyBiometricAuthModeChanged() { mDozeServiceHost.updateDozing(); updateScrimController(); - mStatusBarWindowViewController.onBiometricAuthModeChanged( + mLockscreenLockIconController.onBiometricAuthModeChanged( mBiometricUnlockController.isWakeAndUnlock(), mBiometricUnlockController.isBiometricUnlock()); } @@ -4341,7 +4341,7 @@ public class StatusBar extends SystemUI implements DemoMode, */ public void onBouncerPreHideAnimation() { mNotificationPanel.onBouncerPreHideAnimation(); - mStatusBarWindowViewController.onBouncerPreHideAnimation(); + mLockscreenLockIconController.onBouncerPreHideAnimation(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java index 88f1c63f627a..ffb5afe70915 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarModule.java @@ -143,7 +143,8 @@ public class StatusBarModule { NotificationListener notificationListener, ConfigurationController configurationController, StatusBarWindowController statusBarWindowController, - StatusBarWindowViewController.Builder statusBarWindowViewControllerBuilder, + StatusBarWindowViewController statusBarWindowViewController, + LockscreenLockIconController lockscreenLockIconController, DozeParameters dozeParameters, ScrimController scrimController, @Nullable KeyguardLiftController keyguardLiftController, @@ -214,7 +215,8 @@ public class StatusBarModule { notificationListener, configurationController, statusBarWindowController, - statusBarWindowViewControllerBuilder, + statusBarWindowViewController, + lockscreenLockIconController, dozeParameters, scrimController, keyguardLiftController, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java index c1328ec2a060..2c538da7989b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java @@ -38,7 +38,6 @@ import com.android.systemui.R; import com.android.systemui.dock.DockManager; import com.android.systemui.doze.DozeLog; import com.android.systemui.plugins.FalsingManager; -import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.DragDownHelper; @@ -58,21 +57,40 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import javax.inject.Inject; +import javax.inject.Singleton; + +import dagger.Lazy; /** * Controller for {@link StatusBarWindowView}. */ +@Singleton public class StatusBarWindowViewController { - private final StatusBarWindowView mView; + private final InjectionInflationController mInjectionInflationController; + private final NotificationWakeUpCoordinator mCoordinator; + private final PulseExpansionHandler mPulseExpansionHandler; + private final DynamicPrivacyController mDynamicPrivacyController; + private final KeyguardBypassController mBypassController; + private final PluginManager mPluginManager; private final FalsingManager mFalsingManager; - private final GestureDetector mGestureDetector; + private final TunerService mTunerService; + private final NotificationLockscreenUserManager mNotificationLockscreenUserManager; + private final NotificationEntryManager mNotificationEntryManager; + private final KeyguardStateController mKeyguardStateController; + private final SysuiStatusBarStateController mStatusBarStateController; + private final DozeLog mDozeLog; + private final DozeParameters mDozeParameters; + private final CommandQueue mCommandQueue; + private final StatusBarWindowView mView; + private final Lazy<ShadeController> mShadeControllerLazy; + + private GestureDetector mGestureDetector; private View mBrightnessMirror; private boolean mTouchActive; private boolean mTouchCancelled; private boolean mExpandAnimationPending; private boolean mExpandAnimationRunning; private NotificationStackScrollLayout mStackScrollLayout; - private LockIcon mLockIcon; private PhoneStatusBarView mStatusBarView; private StatusBar mService; private DragDownHelper mDragDownHelper; @@ -81,8 +99,8 @@ public class StatusBarWindowViewController { private boolean mExpandingBelowNotch; private final DockManager mDockManager; - private StatusBarWindowViewController( - StatusBarWindowView view, + @Inject + public StatusBarWindowViewController( InjectionInflationController injectionInflationController, NotificationWakeUpCoordinator coordinator, PulseExpansionHandler pulseExpansionHandler, @@ -91,7 +109,6 @@ public class StatusBarWindowViewController { FalsingManager falsingManager, PluginManager pluginManager, TunerService tunerService, - ShadeController shadeController, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationEntryManager notificationEntryManager, KeyguardStateController keyguardStateController, @@ -99,47 +116,68 @@ public class StatusBarWindowViewController { DozeLog dozeLog, DozeParameters dozeParameters, CommandQueue commandQueue, + SuperStatusBarViewFactory superStatusBarViewFactory, + Lazy<ShadeController> shadeControllerLazy, DockManager dockManager) { - mView = view; + mInjectionInflationController = injectionInflationController; + mCoordinator = coordinator; + mPulseExpansionHandler = pulseExpansionHandler; + mDynamicPrivacyController = dynamicPrivacyController; + mBypassController = bypassController; mFalsingManager = falsingManager; + mPluginManager = pluginManager; + mTunerService = tunerService; + mNotificationLockscreenUserManager = notificationLockscreenUserManager; + mNotificationEntryManager = notificationEntryManager; + mKeyguardStateController = keyguardStateController; + mStatusBarStateController = statusBarStateController; + mDozeLog = dozeLog; + mDozeParameters = dozeParameters; + mCommandQueue = commandQueue; + mView = superStatusBarViewFactory.getStatusBarWindowView(); + mShadeControllerLazy = shadeControllerLazy; mDockManager = dockManager; + // This view is not part of the newly inflated expanded status bar. + mBrightnessMirror = mView.findViewById(R.id.brightness_mirror); + } + + /** Inflates the {@link R.layout#status_bar_expanded} layout and sets it up. */ + public void setupExpandedStatusBar() { // TODO: create controller for NotificationPanelView NotificationPanelView notificationPanelView = new NotificationPanelView( - view.getContext(), + mView.getContext(), null, - injectionInflationController, - coordinator, - pulseExpansionHandler, - dynamicPrivacyController, - bypassController, - falsingManager, - pluginManager, - shadeController, - notificationLockscreenUserManager, - notificationEntryManager, - keyguardStateController, - statusBarStateController, - dozeLog, - dozeParameters, - commandQueue); + mInjectionInflationController, + mCoordinator, + mPulseExpansionHandler, + mDynamicPrivacyController, + mBypassController, + mFalsingManager, + mPluginManager, + mShadeControllerLazy.get(), + mNotificationLockscreenUserManager, + mNotificationEntryManager, + mKeyguardStateController, + mStatusBarStateController, + mDozeLog, + mDozeParameters, + mCommandQueue); ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); notificationPanelView.setVisibility(View.INVISIBLE); notificationPanelView.setId(R.id.notification_panel); - LayoutInflater li = injectionInflationController.injectable( + LayoutInflater li = mInjectionInflationController.injectable( LayoutInflater.from(mView.getContext())); li.inflate(R.layout.status_bar_expanded, notificationPanelView); notificationPanelView.onChildrenAttached(); - ViewStub statusBarExpanded = view.findViewById(R.id.status_bar_expanded); + ViewStub statusBarExpanded = mView.findViewById(R.id.status_bar_expanded); mView.addView(notificationPanelView, mView.indexOfChild(statusBarExpanded), lp); mView.removeView(statusBarExpanded); mStackScrollLayout = mView.findViewById(R.id.notification_stack_scroller); - mLockIcon = mView.findViewById(R.id.lock_icon); - mBrightnessMirror = mView.findViewById(R.id.brightness_mirror); TunerService.Tunable tunable = (key, newValue) -> { AmbientDisplayConfiguration configuration = @@ -153,7 +191,7 @@ public class StatusBarWindowViewController { mSingleTapEnabled = configuration.tapGestureEnabled(UserHandle.USER_CURRENT); } }; - tunerService.addTunable(tunable, + mTunerService.addTunable(tunable, Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, Settings.Secure.DOZE_TAP_SCREEN_GESTURE); @@ -224,7 +262,7 @@ public class StatusBarWindowViewController { } } if (isDown) { - getStackScrollLayout().closeControlsIfOutsideTouch(ev); + mStackScrollLayout.closeControlsIfOutsideTouch(ev); } if (mService.isDozing()) { mService.mDozeScrimController.extendPulse(); @@ -264,10 +302,9 @@ public class StatusBarWindowViewController { @Override public void didIntercept(MotionEvent ev) { - NotificationStackScrollLayout stackScrollLayout = getStackScrollLayout(); MotionEvent cancellation = MotionEvent.obtain(ev); cancellation.setAction(MotionEvent.ACTION_CANCEL); - stackScrollLayout.onInterceptTouchEvent(cancellation); + mStackScrollLayout.onInterceptTouchEvent(cancellation); notificationPanelView.onInterceptTouchEvent(cancellation); cancellation.recycle(); } @@ -345,6 +382,13 @@ public class StatusBarWindowViewController { public void onChildViewRemoved(View parent, View child) { } }); + + ExpandHelper.Callback expandHelperCallback = mStackScrollLayout.getExpandHelperCallback(); + DragDownHelper.DragDownCallback dragDownCallback = mStackScrollLayout.getDragDownCallback(); + setDragDownHelper( + new DragDownHelper( + mView.getContext(), mView, expandHelperCallback, + dragDownCallback, mFalsingManager)); } public StatusBarWindowView getView() { @@ -387,44 +431,8 @@ public class StatusBarWindowViewController { } public void cancelExpandHelper() { - NotificationStackScrollLayout stackScrollLayout = getStackScrollLayout(); - if (stackScrollLayout != null) { - stackScrollLayout.cancelExpandHelper(); - } - } - - @VisibleForTesting - protected NotificationStackScrollLayout getStackScrollLayout() { - return mStackScrollLayout; - } - - /** - * Called whenever the scrims become opaque, transparent or semi-transparent. - */ - public void onScrimVisibilityChanged(Integer scrimsVisible) { - if (mLockIcon != null) { - mLockIcon.onScrimVisibilityChanged(scrimsVisible); - } - } - - /** - * Propagate {@link StatusBar} pulsing state. - */ - public void setPulsing(boolean pulsing) { - if (mLockIcon != null) { - mLockIcon.setPulsing(pulsing); - } - } - - /** - * Called when the biometric authentication mode changes. - * - * @param wakeAndUnlock If the type is {@link BiometricUnlockController#isWakeAndUnlock()} - * @param isUnlock If the type is {@link BiometricUnlockController#isBiometricUnlock()} () - */ - public void onBiometricAuthModeChanged(boolean wakeAndUnlock, boolean isUnlock) { - if (mLockIcon != null) { - mLockIcon.onBiometricAuthModeChanged(wakeAndUnlock, isUnlock); + if (mStackScrollLayout != null) { + mStackScrollLayout.cancelExpandHelper(); } } @@ -434,138 +442,10 @@ public class StatusBarWindowViewController { public void setService(StatusBar statusBar) { mService = statusBar; - NotificationStackScrollLayout stackScrollLayout = getStackScrollLayout(); - ExpandHelper.Callback expandHelperCallback = stackScrollLayout.getExpandHelperCallback(); - DragDownHelper.DragDownCallback dragDownCallback = stackScrollLayout.getDragDownCallback(); - setDragDownHelper( - new DragDownHelper( - mView.getContext(), mView, expandHelperCallback, - dragDownCallback, mFalsingManager)); } @VisibleForTesting void setDragDownHelper(DragDownHelper dragDownHelper) { mDragDownHelper = dragDownHelper; } - - /** - * When we're launching an affordance, like double pressing power to open camera. - */ - public void onShowingLaunchAffordanceChanged(Boolean showing) { - if (mLockIcon != null) { - mLockIcon.onShowingLaunchAffordanceChanged(showing); - } - } - - public void setBouncerShowingScrimmed(boolean bouncerShowing) { - if (mLockIcon != null) { - mLockIcon.setBouncerShowingScrimmed(bouncerShowing); - } - } - - /** - * When {@link KeyguardBouncer} starts to be dismissed and starts to play its animation. - */ - public void onBouncerPreHideAnimation() { - if (mLockIcon != null) { - mLockIcon.onBouncerPreHideAnimation(); - } - } - - /** - * Builder for {@link StatusBarWindowViewController}. - */ - public static class Builder { - private final InjectionInflationController mInjectionInflationController; - private final NotificationWakeUpCoordinator mCoordinator; - private final PulseExpansionHandler mPulseExpansionHandler; - private final DynamicPrivacyController mDynamicPrivacyController; - private final KeyguardBypassController mBypassController; - private final FalsingManager mFalsingManager; - private final PluginManager mPluginManager; - private final TunerService mTunerService; - private final KeyguardStateController mKeyguardStateController; - private final SysuiStatusBarStateController mStatusBarStateController; - private ShadeController mShadeController; - private final NotificationLockscreenUserManager mNotificationLockScreenUserManager; - private final NotificationEntryManager mNotificationEntryManager; - private final DozeLog mDozeLog; - private final DozeParameters mDozeParameters; - private final CommandQueue mCommandQueue; - private final SuperStatusBarViewFactory mSuperStatusBarViewFactory; - private final StatusBarWindowView mView; - private final DockManager mDockManager; - - @Inject - public Builder( - InjectionInflationController injectionInflationController, - NotificationWakeUpCoordinator coordinator, - PulseExpansionHandler pulseExpansionHandler, - DynamicPrivacyController dynamicPrivacyController, - KeyguardBypassController bypassController, - FalsingManager falsingManager, - PluginManager pluginManager, - TunerService tunerService, - NotificationLockscreenUserManager notificationLockscreenUserManager, - NotificationEntryManager notificationEntryManager, - KeyguardStateController keyguardStateController, - StatusBarStateController statusBarStateController, - DozeLog dozeLog, - DozeParameters dozeParameters, - CommandQueue commandQueue, - SuperStatusBarViewFactory superStatusBarViewFactory, - DockManager dockManager) { - mInjectionInflationController = injectionInflationController; - mCoordinator = coordinator; - mPulseExpansionHandler = pulseExpansionHandler; - mDynamicPrivacyController = dynamicPrivacyController; - mBypassController = bypassController; - mFalsingManager = falsingManager; - mPluginManager = pluginManager; - mTunerService = tunerService; - mNotificationLockScreenUserManager = notificationLockscreenUserManager; - mNotificationEntryManager = notificationEntryManager; - mKeyguardStateController = keyguardStateController; - mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController; - mDozeLog = dozeLog; - mDozeParameters = dozeParameters; - mCommandQueue = commandQueue; - mSuperStatusBarViewFactory = superStatusBarViewFactory; - mView = mSuperStatusBarViewFactory.getStatusBarWindowView(); - mDockManager = dockManager; - } - - /** - * Provide {@link ShadeController} that this view needs. - */ - public Builder setShadeController(ShadeController shadeController) { - mShadeController = shadeController; - return this; - } - - /** - * Build a {@link StatusBarWindowView}. - */ - public StatusBarWindowViewController build() { - return new StatusBarWindowViewController( - mView, - mInjectionInflationController, - mCoordinator, - mPulseExpansionHandler, - mDynamicPrivacyController, - mBypassController, - mFalsingManager, - mPluginManager, - mTunerService, - mShadeController, - mNotificationLockScreenUserManager, - mNotificationEntryManager, - mKeyguardStateController, - mStatusBarStateController, - mDozeLog, - mDozeParameters, - mCommandQueue, - mDockManager); - } - } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java index 105dbad66488..222fcb696c8b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/DozeServiceHostTest.java @@ -90,6 +90,7 @@ public class DozeServiceHostTest extends SysuiTestCase { @Mock private NotificationPanelView mNotificationPanel; @Mock private View mAmbientIndicationContainer; @Mock private BiometricUnlockController mBiometricUnlockController; + @Mock private LockscreenLockIconController mLockscreenLockIconController; @Before public void setup() { @@ -99,11 +100,11 @@ public class DozeServiceHostTest extends SysuiTestCase { mBatteryController, mScrimController, () -> mBiometricUnlockController, mKeyguardViewMediator, () -> mAssistManager, mDozeScrimController, mKeyguardUpdateMonitor, mVisualStabilityManager, mPulseExpansionHandler, - mStatusBarWindowController, mNotificationWakeUpCoordinator); + mStatusBarWindowController, mNotificationWakeUpCoordinator, + mStatusBarWindowViewController, mLockscreenLockIconController); - mDozeServiceHost.initialize(mStatusBar, mNotificationIconAreaController, - mStatusBarWindowViewController, mStatusBarWindow, mStatusBarKeyguardViewManager, - mNotificationPanel, mAmbientIndicationContainer); + mDozeServiceHost.initialize(mStatusBar, mNotificationIconAreaController, mStatusBarWindow, + mStatusBarKeyguardViewManager, mNotificationPanel, mAmbientIndicationContainer); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java index 1f2df653490c..8009ff0faa9d 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java @@ -216,7 +216,6 @@ public class StatusBarTest extends SysuiTestCase { @Mock private NotificationGroupAlertTransferHelper mGroupAlertTransferHelper; @Mock private StatusBarWindowController mStatusBarWindowController; @Mock private NotificationIconAreaController mNotificationIconAreaController; - @Mock private StatusBarWindowViewController.Builder mStatusBarWindowViewControllerBuilder; @Mock private StatusBarWindowViewController mStatusBarWindowViewController; @Mock private DozeParameters mDozeParameters; @Mock private Lazy<LockscreenWallpaper> mLockscreenWallpaperLazy; @@ -236,6 +235,7 @@ public class StatusBarTest extends SysuiTestCase { @Mock private DismissCallbackRegistry mDismissCallbackRegistry; @Mock private ScreenPinningRequest mScreenPinningRequest; @Mock private NotificationEntryManager mEntryManager; + @Mock private LockscreenLockIconController mLockscreenLockIconController; @Before public void setup() throws Exception { @@ -295,9 +295,6 @@ public class StatusBarTest extends SysuiTestCase { when(mColorExtractor.getNeutralColors()).thenReturn(mGradientColors); ConfigurationController configurationController = new ConfigurationControllerImpl(mContext); - when(mStatusBarWindowViewControllerBuilder.build()) - .thenReturn(mStatusBarWindowViewController); - when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper); when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController); @@ -355,7 +352,8 @@ public class StatusBarTest extends SysuiTestCase { mNotificationListener, configurationController, mStatusBarWindowController, - mStatusBarWindowViewControllerBuilder, + mStatusBarWindowViewController, + mLockscreenLockIconController, mDozeParameters, mScrimController, mKeyguardLiftController, @@ -397,7 +395,6 @@ public class StatusBarTest extends SysuiTestCase { mStatusBar.mKeyguardIndicationController = mKeyguardIndicationController; mStatusBar.mBarService = mBarService; mStatusBar.mStackScroller = mStackScroller; - mStatusBar.mStatusBarWindowViewController = mStatusBarWindowViewController; mStatusBar.startKeyguard(); Dependency.get(InitController.class).executePostInitTasks(); notificationLogger.setUpWithContainer(mStackScroller); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java index e08551abdca2..ee9ea9f26a95 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarWindowViewTest.java @@ -88,7 +88,7 @@ public class StatusBarWindowViewTest extends SysuiTestCase { when(mSuperStatusBarViewFactory.getStatusBarWindowView()).thenReturn(mView); when(mDockManager.isDocked()).thenReturn(false); - mController = new StatusBarWindowViewController.Builder( + mController = new StatusBarWindowViewController( new InjectionInflationController( SystemUIFactory.getInstance().getRootComponent()), mCoordinator, @@ -106,9 +106,9 @@ public class StatusBarWindowViewTest extends SysuiTestCase { mDozeParameters, new CommandQueue(mContext), mSuperStatusBarViewFactory, - mDockManager) - .setShadeController(mShadeController) - .build(); + () -> mShadeController, + mDockManager); + mController.setupExpandedStatusBar(); mController.setService(mStatusBar); mController.setDragDownHelper(mDragDownHelper); |