Merge "Inject StatusBarWindowViewController"
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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}.
|
||||
|
||||
@@ -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 */);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -225,7 +263,7 @@ public class StatusBarWindowViewController {
|
||||
}
|
||||
}
|
||||
if (isDown) {
|
||||
getStackScrollLayout().closeControlsIfOutsideTouch(ev);
|
||||
mStackScrollLayout.closeControlsIfOutsideTouch(ev);
|
||||
}
|
||||
if (mService.isDozing()) {
|
||||
mService.mDozeScrimController.extendPulse();
|
||||
@@ -266,10 +304,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();
|
||||
}
|
||||
@@ -347,6 +384,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() {
|
||||
@@ -389,44 +433,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -436,138 +444,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user