Merge "Extract camera launch code from NPVC into CentralSurfaces" into tm-qpr-dev
This commit is contained in:
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2022 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.shade;
|
||||||
|
|
||||||
|
import com.android.systemui.camera.CameraGestureHelper;
|
||||||
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
|
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
/** Handles launching camera from Shade. */
|
||||||
|
@SysUISingleton
|
||||||
|
public class CameraLauncher {
|
||||||
|
private final CameraGestureHelper mCameraGestureHelper;
|
||||||
|
private final KeyguardBypassController mKeyguardBypassController;
|
||||||
|
|
||||||
|
private boolean mLaunchingAffordance;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
public CameraLauncher(
|
||||||
|
CameraGestureHelper cameraGestureHelper,
|
||||||
|
KeyguardBypassController keyguardBypassController
|
||||||
|
) {
|
||||||
|
mCameraGestureHelper = cameraGestureHelper;
|
||||||
|
mKeyguardBypassController = keyguardBypassController;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Launches the camera. */
|
||||||
|
public void launchCamera(int source, boolean isShadeFullyCollapsed) {
|
||||||
|
if (!isShadeFullyCollapsed) {
|
||||||
|
setLaunchingAffordance(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mCameraGestureHelper.launchCamera(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether we are currently launching an affordance. This is currently only set when
|
||||||
|
* launched via a camera gesture.
|
||||||
|
*/
|
||||||
|
public void setLaunchingAffordance(boolean launchingAffordance) {
|
||||||
|
mLaunchingAffordance = launchingAffordance;
|
||||||
|
mKeyguardBypassController.setLaunchingAffordance(launchingAffordance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true when a bottom affordance is launching an occluded activity with a splash screen.
|
||||||
|
*/
|
||||||
|
public boolean isLaunchingAffordance() {
|
||||||
|
return mLaunchingAffordance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the camera application can be launched for the camera launch gesture.
|
||||||
|
*/
|
||||||
|
public boolean canCameraGestureBeLaunched(int barState) {
|
||||||
|
return mCameraGestureHelper.canCameraGestureBeLaunched(barState);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -123,7 +123,6 @@ import com.android.systemui.animation.ActivityLaunchAnimator;
|
|||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
import com.android.systemui.animation.LaunchAnimator;
|
import com.android.systemui.animation.LaunchAnimator;
|
||||||
import com.android.systemui.biometrics.AuthController;
|
import com.android.systemui.biometrics.AuthController;
|
||||||
import com.android.systemui.camera.CameraGestureHelper;
|
|
||||||
import com.android.systemui.classifier.Classifier;
|
import com.android.systemui.classifier.Classifier;
|
||||||
import com.android.systemui.classifier.FalsingCollector;
|
import com.android.systemui.classifier.FalsingCollector;
|
||||||
import com.android.systemui.dagger.qualifiers.DisplayId;
|
import com.android.systemui.dagger.qualifiers.DisplayId;
|
||||||
@@ -462,7 +461,6 @@ public final class NotificationPanelViewController {
|
|||||||
private boolean mCollapsedOnDown;
|
private boolean mCollapsedOnDown;
|
||||||
private boolean mClosingWithAlphaFadeOut;
|
private boolean mClosingWithAlphaFadeOut;
|
||||||
private boolean mHeadsUpAnimatingAway;
|
private boolean mHeadsUpAnimatingAway;
|
||||||
private boolean mLaunchingAffordance;
|
|
||||||
private final FalsingManager mFalsingManager;
|
private final FalsingManager mFalsingManager;
|
||||||
private final FalsingCollector mFalsingCollector;
|
private final FalsingCollector mFalsingCollector;
|
||||||
|
|
||||||
@@ -613,7 +611,6 @@ public final class NotificationPanelViewController {
|
|||||||
private final NotificationListContainer mNotificationListContainer;
|
private final NotificationListContainer mNotificationListContainer;
|
||||||
private final NotificationStackSizeCalculator mNotificationStackSizeCalculator;
|
private final NotificationStackSizeCalculator mNotificationStackSizeCalculator;
|
||||||
private final NPVCDownEventState.Buffer mLastDownEvents;
|
private final NPVCDownEventState.Buffer mLastDownEvents;
|
||||||
private final CameraGestureHelper mCameraGestureHelper;
|
|
||||||
private final KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel;
|
private final KeyguardBottomAreaViewModel mKeyguardBottomAreaViewModel;
|
||||||
private final KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor;
|
private final KeyguardBottomAreaInteractor mKeyguardBottomAreaInteractor;
|
||||||
private float mMinExpandHeight;
|
private float mMinExpandHeight;
|
||||||
@@ -741,7 +738,6 @@ public final class NotificationPanelViewController {
|
|||||||
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
|
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
|
||||||
ShadeTransitionController shadeTransitionController,
|
ShadeTransitionController shadeTransitionController,
|
||||||
SystemClock systemClock,
|
SystemClock systemClock,
|
||||||
CameraGestureHelper cameraGestureHelper,
|
|
||||||
KeyguardBottomAreaViewModel keyguardBottomAreaViewModel,
|
KeyguardBottomAreaViewModel keyguardBottomAreaViewModel,
|
||||||
KeyguardBottomAreaInteractor keyguardBottomAreaInteractor) {
|
KeyguardBottomAreaInteractor keyguardBottomAreaInteractor) {
|
||||||
keyguardStateController.addCallback(new KeyguardStateController.Callback() {
|
keyguardStateController.addCallback(new KeyguardStateController.Callback() {
|
||||||
@@ -921,7 +917,6 @@ public final class NotificationPanelViewController {
|
|||||||
unlockAnimationStarted(playingCannedAnimation, isWakeAndUnlock, startDelay);
|
unlockAnimationStarted(playingCannedAnimation, isWakeAndUnlock, startDelay);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mCameraGestureHelper = cameraGestureHelper;
|
|
||||||
mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor;
|
mKeyguardBottomAreaInteractor = keyguardBottomAreaInteractor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3948,6 +3943,10 @@ public final class NotificationPanelViewController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getBarState() {
|
||||||
|
return mBarState;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isOnKeyguard() {
|
private boolean isOnKeyguard() {
|
||||||
return mBarState == KEYGUARD;
|
return mBarState == KEYGUARD;
|
||||||
}
|
}
|
||||||
@@ -3993,35 +3992,6 @@ public final class NotificationPanelViewController {
|
|||||||
&& mBarState == StatusBarState.SHADE;
|
&& mBarState == StatusBarState.SHADE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Launches the camera. */
|
|
||||||
public void launchCamera(int source) {
|
|
||||||
if (!isFullyCollapsed()) {
|
|
||||||
setLaunchingAffordance(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
mCameraGestureHelper.launchCamera(source);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onAffordanceLaunchEnded() {
|
|
||||||
setLaunchingAffordance(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set whether we are currently launching an affordance (i.e. camera gesture). */
|
|
||||||
private void setLaunchingAffordance(boolean launchingAffordance) {
|
|
||||||
mLaunchingAffordance = launchingAffordance;
|
|
||||||
mKeyguardBypassController.setLaunchingAffordance(launchingAffordance);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns whether a bottom affordance is launching an occluded activity with splash screen. */
|
|
||||||
public boolean isLaunchingAffordanceWithPreview() {
|
|
||||||
return mLaunchingAffordance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether the camera application can be launched by the camera launch gesture. */
|
|
||||||
public boolean canCameraGestureBeLaunched() {
|
|
||||||
return mCameraGestureHelper.canCameraGestureBeLaunched(mBarState);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hideStatusBarIconsWhenExpanded() {
|
public boolean hideStatusBarIconsWhenExpanded() {
|
||||||
if (mIsLaunchAnimationRunning) {
|
if (mIsLaunchAnimationRunning) {
|
||||||
return mHideIconsDuringLaunchAnimation;
|
return mHideIconsDuringLaunchAnimation;
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ import com.android.systemui.dagger.qualifiers.DisplayId;
|
|||||||
import com.android.systemui.dagger.qualifiers.Main;
|
import com.android.systemui.dagger.qualifiers.Main;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
import com.android.systemui.qs.QSPanelController;
|
import com.android.systemui.qs.QSPanelController;
|
||||||
|
import com.android.systemui.shade.CameraLauncher;
|
||||||
import com.android.systemui.shade.NotificationPanelViewController;
|
import com.android.systemui.shade.NotificationPanelViewController;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
@@ -71,6 +72,8 @@ import java.util.Optional;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import dagger.Lazy;
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@CentralSurfacesComponent.CentralSurfacesScope
|
@CentralSurfacesComponent.CentralSurfacesScope
|
||||||
public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callbacks {
|
public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callbacks {
|
||||||
@@ -99,6 +102,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
|||||||
private final boolean mVibrateOnOpening;
|
private final boolean mVibrateOnOpening;
|
||||||
private final VibrationEffect mCameraLaunchGestureVibrationEffect;
|
private final VibrationEffect mCameraLaunchGestureVibrationEffect;
|
||||||
private final SystemBarAttributesListener mSystemBarAttributesListener;
|
private final SystemBarAttributesListener mSystemBarAttributesListener;
|
||||||
|
private final Lazy<CameraLauncher> mCameraLauncherLazy;
|
||||||
|
|
||||||
private static final VibrationAttributes HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES =
|
private static final VibrationAttributes HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES =
|
||||||
VibrationAttributes.createForUsage(VibrationAttributes.USAGE_HARDWARE_FEEDBACK);
|
VibrationAttributes.createForUsage(VibrationAttributes.USAGE_HARDWARE_FEEDBACK);
|
||||||
@@ -128,8 +132,8 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
|||||||
Optional<Vibrator> vibratorOptional,
|
Optional<Vibrator> vibratorOptional,
|
||||||
DisableFlagsLogger disableFlagsLogger,
|
DisableFlagsLogger disableFlagsLogger,
|
||||||
@DisplayId int displayId,
|
@DisplayId int displayId,
|
||||||
SystemBarAttributesListener systemBarAttributesListener) {
|
SystemBarAttributesListener systemBarAttributesListener,
|
||||||
|
Lazy<CameraLauncher> cameraLauncherLazy) {
|
||||||
mCentralSurfaces = centralSurfaces;
|
mCentralSurfaces = centralSurfaces;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mShadeController = shadeController;
|
mShadeController = shadeController;
|
||||||
@@ -152,6 +156,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
|||||||
mVibratorOptional = vibratorOptional;
|
mVibratorOptional = vibratorOptional;
|
||||||
mDisableFlagsLogger = disableFlagsLogger;
|
mDisableFlagsLogger = disableFlagsLogger;
|
||||||
mDisplayId = displayId;
|
mDisplayId = displayId;
|
||||||
|
mCameraLauncherLazy = cameraLauncherLazy;
|
||||||
|
|
||||||
mVibrateOnOpening = resources.getBoolean(R.bool.config_vibrateOnIconAnimation);
|
mVibrateOnOpening = resources.getBoolean(R.bool.config_vibrateOnIconAnimation);
|
||||||
mCameraLaunchGestureVibrationEffect = getCameraGestureVibrationEffect(
|
mCameraLaunchGestureVibrationEffect = getCameraGestureVibrationEffect(
|
||||||
@@ -346,7 +351,8 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
|||||||
mCentralSurfaces.setLaunchCameraOnFinishedGoingToSleep(true);
|
mCentralSurfaces.setLaunchCameraOnFinishedGoingToSleep(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mNotificationPanelViewController.canCameraGestureBeLaunched()) {
|
if (!mCameraLauncherLazy.get().canCameraGestureBeLaunched(
|
||||||
|
mNotificationPanelViewController.getBarState())) {
|
||||||
if (CentralSurfaces.DEBUG_CAMERA_LIFT) {
|
if (CentralSurfaces.DEBUG_CAMERA_LIFT) {
|
||||||
Slog.d(CentralSurfaces.TAG, "Can't launch camera right now");
|
Slog.d(CentralSurfaces.TAG, "Can't launch camera right now");
|
||||||
}
|
}
|
||||||
@@ -383,7 +389,8 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
|||||||
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||||
mStatusBarKeyguardViewManager.reset(true /* hide */);
|
mStatusBarKeyguardViewManager.reset(true /* hide */);
|
||||||
}
|
}
|
||||||
mNotificationPanelViewController.launchCamera(source);
|
mCameraLauncherLazy.get().launchCamera(source,
|
||||||
|
mNotificationPanelViewController.isFullyCollapsed());
|
||||||
mCentralSurfaces.updateScrimController();
|
mCentralSurfaces.updateScrimController();
|
||||||
} else {
|
} else {
|
||||||
// We need to defer the camera launch until the screen comes on, since otherwise
|
// We need to defer the camera launch until the screen comes on, since otherwise
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ import com.android.systemui.recents.ScreenPinningRequest;
|
|||||||
import com.android.systemui.ripple.RippleShader.RippleShape;
|
import com.android.systemui.ripple.RippleShader.RippleShape;
|
||||||
import com.android.systemui.scrim.ScrimView;
|
import com.android.systemui.scrim.ScrimView;
|
||||||
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
||||||
|
import com.android.systemui.shade.CameraLauncher;
|
||||||
import com.android.systemui.shade.NotificationPanelViewController;
|
import com.android.systemui.shade.NotificationPanelViewController;
|
||||||
import com.android.systemui.shade.NotificationShadeWindowView;
|
import com.android.systemui.shade.NotificationShadeWindowView;
|
||||||
import com.android.systemui.shade.NotificationShadeWindowViewController;
|
import com.android.systemui.shade.NotificationShadeWindowViewController;
|
||||||
@@ -485,6 +486,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
private final PluginManager mPluginManager;
|
private final PluginManager mPluginManager;
|
||||||
private final ShadeController mShadeController;
|
private final ShadeController mShadeController;
|
||||||
private final InitController mInitController;
|
private final InitController mInitController;
|
||||||
|
private final Lazy<CameraLauncher> mCameraLauncherLazy;
|
||||||
|
|
||||||
private final PluginDependencyProvider mPluginDependencyProvider;
|
private final PluginDependencyProvider mPluginDependencyProvider;
|
||||||
private final KeyguardDismissUtil mKeyguardDismissUtil;
|
private final KeyguardDismissUtil mKeyguardDismissUtil;
|
||||||
@@ -617,6 +619,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
|
|
||||||
private Runnable mLaunchTransitionEndRunnable;
|
private Runnable mLaunchTransitionEndRunnable;
|
||||||
private Runnable mLaunchTransitionCancelRunnable;
|
private Runnable mLaunchTransitionCancelRunnable;
|
||||||
|
private boolean mLaunchingAffordance;
|
||||||
private boolean mLaunchCameraWhenFinishedWaking;
|
private boolean mLaunchCameraWhenFinishedWaking;
|
||||||
private boolean mLaunchCameraOnFinishedGoingToSleep;
|
private boolean mLaunchCameraOnFinishedGoingToSleep;
|
||||||
private boolean mLaunchEmergencyActionWhenFinishedWaking;
|
private boolean mLaunchEmergencyActionWhenFinishedWaking;
|
||||||
@@ -761,7 +764,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
InteractionJankMonitor jankMonitor,
|
InteractionJankMonitor jankMonitor,
|
||||||
DeviceStateManager deviceStateManager,
|
DeviceStateManager deviceStateManager,
|
||||||
WiredChargingRippleController wiredChargingRippleController,
|
WiredChargingRippleController wiredChargingRippleController,
|
||||||
IDreamManager dreamManager) {
|
IDreamManager dreamManager,
|
||||||
|
Lazy<CameraLauncher> cameraLauncherLazy) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mNotificationsController = notificationsController;
|
mNotificationsController = notificationsController;
|
||||||
mFragmentService = fragmentService;
|
mFragmentService = fragmentService;
|
||||||
@@ -838,6 +842,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
mMessageRouter = messageRouter;
|
mMessageRouter = messageRouter;
|
||||||
mWallpaperManager = wallpaperManager;
|
mWallpaperManager = wallpaperManager;
|
||||||
mJankMonitor = jankMonitor;
|
mJankMonitor = jankMonitor;
|
||||||
|
mCameraLauncherLazy = cameraLauncherLazy;
|
||||||
|
|
||||||
mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
|
mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
|
||||||
mStartingSurfaceOptional = startingSurfaceOptional;
|
mStartingSurfaceOptional = startingSurfaceOptional;
|
||||||
@@ -2978,7 +2983,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
|
|
||||||
private void onLaunchTransitionFadingEnded() {
|
private void onLaunchTransitionFadingEnded() {
|
||||||
mNotificationPanelViewController.resetAlpha();
|
mNotificationPanelViewController.resetAlpha();
|
||||||
mNotificationPanelViewController.onAffordanceLaunchEnded();
|
mCameraLauncherLazy.get().setLaunchingAffordance(false);
|
||||||
releaseGestureWakeLock();
|
releaseGestureWakeLock();
|
||||||
runLaunchTransitionEndRunnable();
|
runLaunchTransitionEndRunnable();
|
||||||
mKeyguardStateController.setLaunchTransitionFadingAway(false);
|
mKeyguardStateController.setLaunchTransitionFadingAway(false);
|
||||||
@@ -3048,7 +3053,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
|
|
||||||
private void onLaunchTransitionTimeout() {
|
private void onLaunchTransitionTimeout() {
|
||||||
Log.w(TAG, "Launch transition: Timeout!");
|
Log.w(TAG, "Launch transition: Timeout!");
|
||||||
mNotificationPanelViewController.onAffordanceLaunchEnded();
|
mCameraLauncherLazy.get().setLaunchingAffordance(false);
|
||||||
releaseGestureWakeLock();
|
releaseGestureWakeLock();
|
||||||
mNotificationPanelViewController.resetViews(false /* animate */);
|
mNotificationPanelViewController.resetViews(false /* animate */);
|
||||||
}
|
}
|
||||||
@@ -3101,7 +3106,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
}
|
}
|
||||||
mMessageRouter.cancelMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
|
mMessageRouter.cancelMessages(MSG_LAUNCH_TRANSITION_TIMEOUT);
|
||||||
releaseGestureWakeLock();
|
releaseGestureWakeLock();
|
||||||
mNotificationPanelViewController.onAffordanceLaunchEnded();
|
mCameraLauncherLazy.get().setLaunchingAffordance(false);
|
||||||
mNotificationPanelViewController.resetAlpha();
|
mNotificationPanelViewController.resetAlpha();
|
||||||
mNotificationPanelViewController.resetTranslation();
|
mNotificationPanelViewController.resetTranslation();
|
||||||
mNotificationPanelViewController.resetViewGroupFade();
|
mNotificationPanelViewController.resetViewGroupFade();
|
||||||
@@ -3259,7 +3264,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
@Override
|
@Override
|
||||||
public void endAffordanceLaunch() {
|
public void endAffordanceLaunch() {
|
||||||
releaseGestureWakeLock();
|
releaseGestureWakeLock();
|
||||||
mNotificationPanelViewController.onAffordanceLaunchEnded();
|
mCameraLauncherLazy.get().setLaunchingAffordance(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3531,7 +3536,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() {
|
final WakefulnessLifecycle.Observer mWakefulnessObserver = new WakefulnessLifecycle.Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void onFinishedGoingToSleep() {
|
public void onFinishedGoingToSleep() {
|
||||||
mNotificationPanelViewController.onAffordanceLaunchEnded();
|
mCameraLauncherLazy.get().setLaunchingAffordance(false);
|
||||||
releaseGestureWakeLock();
|
releaseGestureWakeLock();
|
||||||
mLaunchCameraWhenFinishedWaking = false;
|
mLaunchCameraWhenFinishedWaking = false;
|
||||||
mDeviceInteractive = false;
|
mDeviceInteractive = false;
|
||||||
@@ -3632,7 +3637,8 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
.updateSensitivenessForOccludedWakeup();
|
.updateSensitivenessForOccludedWakeup();
|
||||||
}
|
}
|
||||||
if (mLaunchCameraWhenFinishedWaking) {
|
if (mLaunchCameraWhenFinishedWaking) {
|
||||||
mNotificationPanelViewController.launchCamera(mLastCameraLaunchSource);
|
mCameraLauncherLazy.get().launchCamera(mLastCameraLaunchSource,
|
||||||
|
mNotificationPanelViewController.isFullyCollapsed());
|
||||||
mLaunchCameraWhenFinishedWaking = false;
|
mLaunchCameraWhenFinishedWaking = false;
|
||||||
}
|
}
|
||||||
if (mLaunchEmergencyActionWhenFinishedWaking) {
|
if (mLaunchEmergencyActionWhenFinishedWaking) {
|
||||||
@@ -3823,8 +3829,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
|||||||
|
|
||||||
mScrimController.setExpansionAffectsAlpha(!unlocking);
|
mScrimController.setExpansionAffectsAlpha(!unlocking);
|
||||||
|
|
||||||
boolean launchingAffordanceWithPreview =
|
boolean launchingAffordanceWithPreview = mLaunchingAffordance;
|
||||||
mNotificationPanelViewController.isLaunchingAffordanceWithPreview();
|
|
||||||
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
|
mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview);
|
||||||
|
|
||||||
if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) {
|
if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) {
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ import com.android.systemui.DejankUtils;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.biometrics.AuthController;
|
import com.android.systemui.biometrics.AuthController;
|
||||||
import com.android.systemui.camera.CameraGestureHelper;
|
|
||||||
import com.android.systemui.classifier.FalsingCollectorFake;
|
import com.android.systemui.classifier.FalsingCollectorFake;
|
||||||
import com.android.systemui.classifier.FalsingManagerFake;
|
import com.android.systemui.classifier.FalsingManagerFake;
|
||||||
import com.android.systemui.doze.DozeLog;
|
import com.android.systemui.doze.DozeLog;
|
||||||
@@ -492,7 +491,6 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase {
|
|||||||
mUnlockedScreenOffAnimationController,
|
mUnlockedScreenOffAnimationController,
|
||||||
mShadeTransitionController,
|
mShadeTransitionController,
|
||||||
systemClock,
|
systemClock,
|
||||||
mock(CameraGestureHelper.class),
|
|
||||||
mKeyguardBottomAreaViewModel,
|
mKeyguardBottomAreaViewModel,
|
||||||
mKeyguardBottomAreaInteractor);
|
mKeyguardBottomAreaInteractor);
|
||||||
mNotificationPanelViewController.initDependencies(
|
mNotificationPanelViewController.initDependencies(
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
|
|||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.assist.AssistManager;
|
import com.android.systemui.assist.AssistManager;
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
import com.android.systemui.keyguard.WakefulnessLifecycle;
|
||||||
|
import com.android.systemui.shade.CameraLauncher;
|
||||||
import com.android.systemui.shade.NotificationPanelViewController;
|
import com.android.systemui.shade.NotificationPanelViewController;
|
||||||
import com.android.systemui.shade.ShadeController;
|
import com.android.systemui.shade.ShadeController;
|
||||||
import com.android.systemui.statusbar.CommandQueue;
|
import com.android.systemui.statusbar.CommandQueue;
|
||||||
@@ -60,6 +61,8 @@ import org.mockito.stubbing.Answer;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import dagger.Lazy;
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
||||||
@@ -84,6 +87,7 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
|||||||
@Mock private Vibrator mVibrator;
|
@Mock private Vibrator mVibrator;
|
||||||
@Mock private StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager;
|
@Mock private StatusBarHideIconsForBouncerManager mStatusBarHideIconsForBouncerManager;
|
||||||
@Mock private SystemBarAttributesListener mSystemBarAttributesListener;
|
@Mock private SystemBarAttributesListener mSystemBarAttributesListener;
|
||||||
|
@Mock private Lazy<CameraLauncher> mCameraLauncherLazy;
|
||||||
|
|
||||||
CentralSurfacesCommandQueueCallbacks mSbcqCallbacks;
|
CentralSurfacesCommandQueueCallbacks mSbcqCallbacks;
|
||||||
|
|
||||||
@@ -115,7 +119,8 @@ public class CentralSurfacesCommandQueueCallbacksTest extends SysuiTestCase {
|
|||||||
Optional.of(mVibrator),
|
Optional.of(mVibrator),
|
||||||
new DisableFlagsLogger(),
|
new DisableFlagsLogger(),
|
||||||
DEFAULT_DISPLAY,
|
DEFAULT_DISPLAY,
|
||||||
mSystemBarAttributesListener);
|
mSystemBarAttributesListener,
|
||||||
|
mCameraLauncherLazy);
|
||||||
|
|
||||||
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true);
|
when(mDeviceProvisionedController.isCurrentUserSetup()).thenReturn(true);
|
||||||
when(mRemoteInputQuickSettingsDisabler.adjustDisableFlags(anyInt()))
|
when(mRemoteInputQuickSettingsDisabler.adjustDisableFlags(anyInt()))
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ import com.android.systemui.plugins.PluginDependencyProvider;
|
|||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.recents.ScreenPinningRequest;
|
import com.android.systemui.recents.ScreenPinningRequest;
|
||||||
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
import com.android.systemui.settings.brightness.BrightnessSliderController;
|
||||||
|
import com.android.systemui.shade.CameraLauncher;
|
||||||
import com.android.systemui.shade.NotificationPanelView;
|
import com.android.systemui.shade.NotificationPanelView;
|
||||||
import com.android.systemui.shade.NotificationPanelViewController;
|
import com.android.systemui.shade.NotificationPanelViewController;
|
||||||
import com.android.systemui.shade.NotificationShadeWindowView;
|
import com.android.systemui.shade.NotificationShadeWindowView;
|
||||||
@@ -287,6 +288,8 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
@Mock private InteractionJankMonitor mJankMonitor;
|
@Mock private InteractionJankMonitor mJankMonitor;
|
||||||
@Mock private DeviceStateManager mDeviceStateManager;
|
@Mock private DeviceStateManager mDeviceStateManager;
|
||||||
@Mock private WiredChargingRippleController mWiredChargingRippleController;
|
@Mock private WiredChargingRippleController mWiredChargingRippleController;
|
||||||
|
@Mock private Lazy<CameraLauncher> mCameraLauncherLazy;
|
||||||
|
@Mock private CameraLauncher mCameraLauncher;
|
||||||
/**
|
/**
|
||||||
* The process of registering/unregistering a predictive back callback requires a
|
* The process of registering/unregistering a predictive back callback requires a
|
||||||
* ViewRootImpl, which is present IRL, but may be missing during a Mockito unit test.
|
* ViewRootImpl, which is present IRL, but may be missing during a Mockito unit test.
|
||||||
@@ -378,6 +381,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
|
|
||||||
when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper);
|
when(mLockscreenWallpaperLazy.get()).thenReturn(mLockscreenWallpaper);
|
||||||
when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
|
when(mBiometricUnlockControllerLazy.get()).thenReturn(mBiometricUnlockController);
|
||||||
|
when(mCameraLauncherLazy.get()).thenReturn(mCameraLauncher);
|
||||||
|
|
||||||
when(mStatusBarComponentFactory.create()).thenReturn(mCentralSurfacesComponent);
|
when(mStatusBarComponentFactory.create()).thenReturn(mCentralSurfacesComponent);
|
||||||
when(mCentralSurfacesComponent.getNotificationShadeWindowViewController()).thenReturn(
|
when(mCentralSurfacesComponent.getNotificationShadeWindowViewController()).thenReturn(
|
||||||
@@ -479,7 +483,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
mActivityLaunchAnimator,
|
mActivityLaunchAnimator,
|
||||||
mJankMonitor,
|
mJankMonitor,
|
||||||
mDeviceStateManager,
|
mDeviceStateManager,
|
||||||
mWiredChargingRippleController, mDreamManager) {
|
mWiredChargingRippleController,
|
||||||
|
mDreamManager,
|
||||||
|
mCameraLauncherLazy) {
|
||||||
@Override
|
@Override
|
||||||
protected ViewRootImpl getViewRootImpl() {
|
protected ViewRootImpl getViewRootImpl() {
|
||||||
return mViewRootImpl;
|
return mViewRootImpl;
|
||||||
@@ -891,7 +897,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
mCentralSurfaces.showKeyguardImpl();
|
mCentralSurfaces.showKeyguardImpl();
|
||||||
|
|
||||||
// Starting a pulse should change the scrim controller to the pulsing state
|
// Starting a pulse should change the scrim controller to the pulsing state
|
||||||
when(mNotificationPanelViewController.isLaunchingAffordanceWithPreview()).thenReturn(true);
|
when(mCameraLauncher.isLaunchingAffordance()).thenReturn(true);
|
||||||
mCentralSurfaces.updateScrimController();
|
mCentralSurfaces.updateScrimController();
|
||||||
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any());
|
||||||
}
|
}
|
||||||
@@ -927,7 +933,7 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
|||||||
mCentralSurfaces.showKeyguardImpl();
|
mCentralSurfaces.showKeyguardImpl();
|
||||||
|
|
||||||
// Starting a pulse should change the scrim controller to the pulsing state
|
// Starting a pulse should change the scrim controller to the pulsing state
|
||||||
when(mNotificationPanelViewController.isLaunchingAffordanceWithPreview()).thenReturn(false);
|
when(mCameraLauncher.isLaunchingAffordance()).thenReturn(false);
|
||||||
mCentralSurfaces.updateScrimController();
|
mCentralSurfaces.updateScrimController();
|
||||||
verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD));
|
verify(mScrimController).transitionTo(eq(ScrimState.KEYGUARD));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user