Merge "Disable screen off animation in situations where it currently looks bad." into sc-dev
This commit is contained in:
@@ -249,6 +249,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
|||||||
public void onStateChanged(int newState) {
|
public void onStateChanged(int newState) {
|
||||||
mStatusBarState = newState;
|
mStatusBarState = newState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onExpandedChanged(boolean isExpanded) {
|
||||||
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
|
if (cb != null) {
|
||||||
|
cb.onShadeExpandedChanged(isExpanded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
HashMap<Integer, SimData> mSimDatas = new HashMap<>();
|
HashMap<Integer, SimData> mSimDatas = new HashMap<>();
|
||||||
|
|||||||
@@ -333,4 +333,8 @@ public class KeyguardUpdateMonitorCallback {
|
|||||||
*/
|
*/
|
||||||
public void onRequireUnlockForNfc() { }
|
public void onRequireUnlockForNfc() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the notification shade is expanded or collapsed.
|
||||||
|
*/
|
||||||
|
public void onShadeExpandedChanged(boolean expanded) { }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static com.android.systemui.doze.DozeMachine.State.DOZE_AOD_PAUSED;
|
|||||||
|
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@@ -34,6 +35,7 @@ import com.android.systemui.dagger.qualifiers.Main;
|
|||||||
import com.android.systemui.doze.dagger.DozeScope;
|
import com.android.systemui.doze.dagger.DozeScope;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||||
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.tuner.TunerService;
|
import com.android.systemui.tuner.TunerService;
|
||||||
import com.android.systemui.util.AlarmTimeout;
|
import com.android.systemui.util.AlarmTimeout;
|
||||||
import com.android.systemui.util.wakelock.WakeLock;
|
import com.android.systemui.util.wakelock.WakeLock;
|
||||||
@@ -48,7 +50,8 @@ import dagger.Lazy;
|
|||||||
* The policy controlling doze.
|
* The policy controlling doze.
|
||||||
*/
|
*/
|
||||||
@DozeScope
|
@DozeScope
|
||||||
public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
public class DozeUi implements DozeMachine.Part, TunerService.Tunable,
|
||||||
|
ConfigurationController.ConfigurationListener {
|
||||||
// if enabled, calls dozeTimeTick() whenever the time changes:
|
// if enabled, calls dozeTimeTick() whenever the time changes:
|
||||||
private static final boolean BURN_IN_TESTING_ENABLED = false;
|
private static final boolean BURN_IN_TESTING_ENABLED = false;
|
||||||
private static final long TIME_TICK_DEADLINE_MILLIS = 90 * 1000; // 1.5min
|
private static final long TIME_TICK_DEADLINE_MILLIS = 90 * 1000; // 1.5min
|
||||||
@@ -63,6 +66,7 @@ public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
|||||||
private final DozeLog mDozeLog;
|
private final DozeLog mDozeLog;
|
||||||
private final Lazy<StatusBarStateController> mStatusBarStateController;
|
private final Lazy<StatusBarStateController> mStatusBarStateController;
|
||||||
private final TunerService mTunerService;
|
private final TunerService mTunerService;
|
||||||
|
private final ConfigurationController mConfigurationController;
|
||||||
|
|
||||||
private boolean mKeyguardShowing;
|
private boolean mKeyguardShowing;
|
||||||
private final KeyguardUpdateMonitorCallback mKeyguardVisibilityCallback =
|
private final KeyguardUpdateMonitorCallback mKeyguardVisibilityCallback =
|
||||||
@@ -84,6 +88,11 @@ public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
|||||||
mHandler.post(mWakeLock.wrap(() -> {}));
|
mHandler.post(mWakeLock.wrap(() -> {}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onShadeExpandedChanged(boolean expanded) {
|
||||||
|
updateAnimateScreenOff();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private long mLastTimeTickElapsed = 0;
|
private long mLastTimeTickElapsed = 0;
|
||||||
@@ -93,7 +102,8 @@ public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
|||||||
WakeLock wakeLock, DozeHost host, @Main Handler handler,
|
WakeLock wakeLock, DozeHost host, @Main Handler handler,
|
||||||
DozeParameters params, KeyguardUpdateMonitor keyguardUpdateMonitor,
|
DozeParameters params, KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||||
DozeLog dozeLog, TunerService tunerService,
|
DozeLog dozeLog, TunerService tunerService,
|
||||||
Lazy<StatusBarStateController> statusBarStateController) {
|
Lazy<StatusBarStateController> statusBarStateController,
|
||||||
|
ConfigurationController configurationController) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mWakeLock = wakeLock;
|
mWakeLock = wakeLock;
|
||||||
mHost = host;
|
mHost = host;
|
||||||
@@ -107,11 +117,15 @@ public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
|||||||
mStatusBarStateController = statusBarStateController;
|
mStatusBarStateController = statusBarStateController;
|
||||||
|
|
||||||
mTunerService.addTunable(this, Settings.Secure.DOZE_ALWAYS_ON);
|
mTunerService.addTunable(this, Settings.Secure.DOZE_ALWAYS_ON);
|
||||||
|
|
||||||
|
mConfigurationController = configurationController;
|
||||||
|
mConfigurationController.addCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
mTunerService.removeTunable(this);
|
mTunerService.removeTunable(this);
|
||||||
|
mConfigurationController.removeCallback(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -274,4 +288,9 @@ public class DozeUi implements DozeMachine.Part, TunerService.Tunable {
|
|||||||
updateAnimateScreenOff();
|
updateAnimateScreenOff();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigChanged(Configuration newConfig) {
|
||||||
|
updateAnimateScreenOff();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStateChanged(newState: Int) {
|
override fun onStateChanged(newState: Int) {
|
||||||
if (unlockedScreenOffAnimationController.shouldPlayScreenOffAnimation()) {
|
if (dozeParameters.shouldControlUnlockedScreenOff()) {
|
||||||
if (unlockedScreenOffAnimationController.isScreenOffAnimationPlaying() &&
|
if (unlockedScreenOffAnimationController.isScreenOffAnimationPlaying() &&
|
||||||
state == StatusBarState.KEYGUARD &&
|
state == StatusBarState.KEYGUARD &&
|
||||||
newState == StatusBarState.SHADE) {
|
newState == StatusBarState.SHADE) {
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class DozeParameters implements TunerService.Tunable,
|
|||||||
private final Resources mResources;
|
private final Resources mResources;
|
||||||
private final BatteryController mBatteryController;
|
private final BatteryController mBatteryController;
|
||||||
private final FeatureFlags mFeatureFlags;
|
private final FeatureFlags mFeatureFlags;
|
||||||
|
private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||||
|
|
||||||
private final Set<Callback> mCallbacks = new HashSet<>();
|
private final Set<Callback> mCallbacks = new HashSet<>();
|
||||||
|
|
||||||
@@ -78,7 +79,8 @@ public class DozeParameters implements TunerService.Tunable,
|
|||||||
BatteryController batteryController,
|
BatteryController batteryController,
|
||||||
TunerService tunerService,
|
TunerService tunerService,
|
||||||
DumpManager dumpManager,
|
DumpManager dumpManager,
|
||||||
FeatureFlags featureFlags) {
|
FeatureFlags featureFlags,
|
||||||
|
UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
|
||||||
mResources = resources;
|
mResources = resources;
|
||||||
mAmbientDisplayConfiguration = ambientDisplayConfiguration;
|
mAmbientDisplayConfiguration = ambientDisplayConfiguration;
|
||||||
mAlwaysOnPolicy = alwaysOnDisplayPolicy;
|
mAlwaysOnPolicy = alwaysOnDisplayPolicy;
|
||||||
@@ -89,6 +91,7 @@ public class DozeParameters implements TunerService.Tunable,
|
|||||||
mPowerManager = powerManager;
|
mPowerManager = powerManager;
|
||||||
mPowerManager.setDozeAfterScreenOff(!mControlScreenOffAnimation);
|
mPowerManager.setDozeAfterScreenOff(!mControlScreenOffAnimation);
|
||||||
mFeatureFlags = featureFlags;
|
mFeatureFlags = featureFlags;
|
||||||
|
mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
|
||||||
|
|
||||||
tunerService.addTunable(
|
tunerService.addTunable(
|
||||||
this,
|
this,
|
||||||
@@ -220,7 +223,8 @@ public class DozeParameters implements TunerService.Tunable,
|
|||||||
* then abruptly showing AOD.
|
* then abruptly showing AOD.
|
||||||
*/
|
*/
|
||||||
public boolean shouldControlUnlockedScreenOff() {
|
public boolean shouldControlUnlockedScreenOff() {
|
||||||
return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations();
|
return getAlwaysOn() && mFeatureFlags.useNewLockscreenAnimations()
|
||||||
|
&& mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getBoolean(String propName, int resId) {
|
private boolean getBoolean(String propName, int resId) {
|
||||||
|
|||||||
@@ -4236,7 +4236,7 @@ public class NotificationPanelViewController extends PanelViewController {
|
|||||||
int oldState = mBarState;
|
int oldState = mBarState;
|
||||||
boolean keyguardShowing = statusBarState == KEYGUARD;
|
boolean keyguardShowing = statusBarState == KEYGUARD;
|
||||||
|
|
||||||
if (mUnlockedScreenOffAnimationController.shouldPlayScreenOffAnimation()
|
if (mDozeParameters.shouldControlUnlockedScreenOff()
|
||||||
&& oldState == StatusBarState.SHADE
|
&& oldState == StatusBarState.SHADE
|
||||||
&& statusBarState == KEYGUARD) {
|
&& statusBarState == KEYGUARD) {
|
||||||
// This means we're doing the screen off animation - position the keyguard status
|
// This means we're doing the screen off animation - position the keyguard status
|
||||||
|
|||||||
@@ -26,11 +26,9 @@ import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENAB
|
|||||||
import android.app.IActivityManager;
|
import android.app.IActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.PixelFormat;
|
import android.graphics.PixelFormat;
|
||||||
import android.os.Binder;
|
import android.os.Binder;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemProperties;
|
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
@@ -53,6 +51,7 @@ import com.android.systemui.statusbar.StatusBarState;
|
|||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
||||||
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
|
|
||||||
import com.google.android.collect.Lists;
|
import com.google.android.collect.Lists;
|
||||||
|
|
||||||
@@ -108,12 +107,14 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
StatusBarStateController statusBarStateController,
|
StatusBarStateController statusBarStateController,
|
||||||
ConfigurationController configurationController,
|
ConfigurationController configurationController,
|
||||||
KeyguardViewMediator keyguardViewMediator,
|
KeyguardViewMediator keyguardViewMediator,
|
||||||
KeyguardBypassController keyguardBypassController, SysuiColorExtractor colorExtractor,
|
KeyguardBypassController keyguardBypassController,
|
||||||
DumpManager dumpManager) {
|
SysuiColorExtractor colorExtractor,
|
||||||
|
DumpManager dumpManager,
|
||||||
|
KeyguardStateController keyguardStateController) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mWindowManager = windowManager;
|
mWindowManager = windowManager;
|
||||||
mActivityManager = activityManager;
|
mActivityManager = activityManager;
|
||||||
mKeyguardScreenRotation = shouldEnableKeyguardScreenRotation();
|
mKeyguardScreenRotation = keyguardStateController.isKeyguardScreenRotationAllowed();
|
||||||
mDozeParameters = dozeParameters;
|
mDozeParameters = dozeParameters;
|
||||||
mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
|
mScreenBrightnessDoze = mDozeParameters.getScreenBrightnessDoze();
|
||||||
mLpChanged = new LayoutParams();
|
mLpChanged = new LayoutParams();
|
||||||
@@ -173,12 +174,6 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldEnableKeyguardScreenRotation() {
|
|
||||||
Resources res = mContext.getResources();
|
|
||||||
return SystemProperties.getBoolean("lockscreen.rot_override", false)
|
|
||||||
|| res.getBoolean(R.bool.config_enableLockScreenRotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the notification shade view to the window manager.
|
* Adds the notification shade view to the window manager.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -4054,7 +4054,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
|
|
||||||
// The screen off animation uses our LightRevealScrim - we need to be expanded for it to
|
// The screen off animation uses our LightRevealScrim - we need to be expanded for it to
|
||||||
// be visible.
|
// be visible.
|
||||||
if (mUnlockedScreenOffAnimationController.shouldPlayScreenOffAnimation()) {
|
if (mDozeParameters.shouldControlUnlockedScreenOff()) {
|
||||||
makeExpandedVisible(true);
|
makeExpandedVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.android.systemui.statusbar.phone
|
|||||||
import android.animation.Animator
|
import android.animation.Animator
|
||||||
import android.animation.AnimatorListenerAdapter
|
import android.animation.AnimatorListenerAdapter
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.Configuration
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
@@ -16,6 +18,7 @@ import com.android.systemui.statusbar.notification.AnimatableProperty
|
|||||||
import com.android.systemui.statusbar.notification.PropertyAnimator
|
import com.android.systemui.statusbar.notification.PropertyAnimator
|
||||||
import com.android.systemui.statusbar.notification.stack.AnimationProperties
|
import com.android.systemui.statusbar.notification.stack.AnimationProperties
|
||||||
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
|
import com.android.systemui.statusbar.notification.stack.StackStateAnimator
|
||||||
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,10 +41,11 @@ private const val LIGHT_REVEAL_ANIMATION_DURATION = 750L
|
|||||||
*/
|
*/
|
||||||
@SysUISingleton
|
@SysUISingleton
|
||||||
class UnlockedScreenOffAnimationController @Inject constructor(
|
class UnlockedScreenOffAnimationController @Inject constructor(
|
||||||
|
private val context: Context,
|
||||||
private val wakefulnessLifecycle: WakefulnessLifecycle,
|
private val wakefulnessLifecycle: WakefulnessLifecycle,
|
||||||
private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
|
private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
|
||||||
private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
|
private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
|
||||||
private val dozeParameters: DozeParameters
|
private val keyguardStateController: KeyguardStateController
|
||||||
) : WakefulnessLifecycle.Observer {
|
) : WakefulnessLifecycle.Observer {
|
||||||
private val handler = Handler()
|
private val handler = Handler()
|
||||||
|
|
||||||
@@ -142,7 +146,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onStartedGoingToSleep() {
|
override fun onStartedGoingToSleep() {
|
||||||
if (shouldPlayScreenOffAnimation()) {
|
if (shouldPlayUnlockedScreenOffAnimation()) {
|
||||||
lightRevealAnimationPlaying = true
|
lightRevealAnimationPlaying = true
|
||||||
lightRevealAnimator.start()
|
lightRevealAnimator.start()
|
||||||
|
|
||||||
@@ -156,13 +160,31 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether we should play the screen off animation when the phone starts going to sleep. We can
|
* Whether we want to play the screen off animation when the phone starts going to sleep, based
|
||||||
* do that if dozeParameters says we can control the unlocked screen off animation and we are in
|
* on the current state of the device.
|
||||||
* the SHADE state. If we're in KEYGUARD or SHADE_LOCKED, the regular
|
|
||||||
*/
|
*/
|
||||||
fun shouldPlayScreenOffAnimation(): Boolean {
|
fun shouldPlayUnlockedScreenOffAnimation(): Boolean {
|
||||||
return dozeParameters.shouldControlUnlockedScreenOff() &&
|
// We only play the unlocked screen off animation if we are... unlocked.
|
||||||
statusBarStateControllerImpl.state == StatusBarState.SHADE
|
if (statusBarStateControllerImpl.state != StatusBarState.SHADE) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// We currently draw both the light reveal scrim, and the AOD UI, in the shade. If it's
|
||||||
|
// already expanded and showing notifications/QS, the animation looks really messy. For now,
|
||||||
|
// disable it if the notification panel is expanded.
|
||||||
|
if (statusBar.notificationPanelViewController.isFullyExpanded) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we're not allowed to rotate the keyguard, then only do the screen off animation if
|
||||||
|
// we're in portrait. Otherwise, AOD will animate in sideways, which looks weird.
|
||||||
|
if (!keyguardStateController.isKeyguardScreenRotationAllowed &&
|
||||||
|
context.resources.configuration.orientation != Configuration.ORIENTATION_PORTRAIT) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise, good to go.
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -56,6 +56,11 @@ public interface KeyguardStateController extends CallbackController<Callback> {
|
|||||||
*/
|
*/
|
||||||
boolean canPerformSmartSpaceTransition();
|
boolean canPerformSmartSpaceTransition();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the keyguard is allowed to rotate, or needs to be locked to the default orientation.
|
||||||
|
*/
|
||||||
|
boolean isKeyguardScreenRotationAllowed();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If the device has PIN/pattern/password or a lock screen at all.
|
* If the device has PIN/pattern/password or a lock screen at all.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import android.content.Intent;
|
|||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.hardware.biometrics.BiometricSourceType;
|
import android.hardware.biometrics.BiometricSourceType;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.SystemProperties;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
|
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
@@ -31,6 +32,7 @@ import com.android.internal.widget.LockPatternUtils;
|
|||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||||
import com.android.systemui.Dumpable;
|
import com.android.systemui.Dumpable;
|
||||||
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController;
|
import com.android.systemui.shared.system.smartspace.SmartspaceTransitionController;
|
||||||
|
|
||||||
@@ -50,6 +52,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
|
private static final String AUTH_BROADCAST_KEY = "debug_trigger_auth";
|
||||||
|
|
||||||
private final ArrayList<Callback> mCallbacks = new ArrayList<>();
|
private final ArrayList<Callback> mCallbacks = new ArrayList<>();
|
||||||
|
private final Context mContext;
|
||||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
private final LockPatternUtils mLockPatternUtils;
|
private final LockPatternUtils mLockPatternUtils;
|
||||||
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =
|
||||||
@@ -100,6 +103,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
public KeyguardStateControllerImpl(Context context,
|
public KeyguardStateControllerImpl(Context context,
|
||||||
KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils,
|
KeyguardUpdateMonitor keyguardUpdateMonitor, LockPatternUtils lockPatternUtils,
|
||||||
SmartspaceTransitionController smartspaceTransitionController) {
|
SmartspaceTransitionController smartspaceTransitionController) {
|
||||||
|
mContext = context;
|
||||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||||
mLockPatternUtils = lockPatternUtils;
|
mLockPatternUtils = lockPatternUtils;
|
||||||
mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
|
mKeyguardUpdateMonitor.registerCallback(mKeyguardUpdateMonitorCallback);
|
||||||
@@ -242,6 +246,12 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
&& mSmartspaceTransitionController.isSmartspaceTransitionPossible();
|
&& mSmartspaceTransitionController.isSmartspaceTransitionPossible();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isKeyguardScreenRotationAllowed() {
|
||||||
|
return SystemProperties.getBoolean("lockscreen.rot_override", false)
|
||||||
|
|| mContext.getResources().getBoolean(R.bool.config_enableLockScreenRotation);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFaceAuthEnabled() {
|
public boolean isFaceAuthEnabled() {
|
||||||
return mFaceAuthEnabled;
|
return mFaceAuthEnabled;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
|
|||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||||
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.tuner.TunerService;
|
import com.android.systemui.tuner.TunerService;
|
||||||
import com.android.systemui.util.wakelock.WakeLockFake;
|
import com.android.systemui.util.wakelock.WakeLockFake;
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ public class DozeUiTest extends SysuiTestCase {
|
|||||||
private DozeUi mDozeUi;
|
private DozeUi mDozeUi;
|
||||||
@Mock
|
@Mock
|
||||||
private StatusBarStateController mStatusBarStateController;
|
private StatusBarStateController mStatusBarStateController;
|
||||||
|
@Mock
|
||||||
|
private ConfigurationController mConfigurationController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
@@ -89,7 +92,7 @@ public class DozeUiTest extends SysuiTestCase {
|
|||||||
|
|
||||||
mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
|
mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
|
||||||
mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService,
|
mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService,
|
||||||
() -> mStatusBarStateController);
|
() -> mStatusBarStateController, mConfigurationController);
|
||||||
mDozeUi.setDozeMachine(mMachine);
|
mDozeUi.setDozeMachine(mMachine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +149,7 @@ public class DozeUiTest extends SysuiTestCase {
|
|||||||
when(mDozeParameters.getDisplayNeedsBlanking()).thenReturn(true);
|
when(mDozeParameters.getDisplayNeedsBlanking()).thenReturn(true);
|
||||||
mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
|
mDozeUi = new DozeUi(mContext, mAlarmManager, mWakeLock, mHost, mHandler,
|
||||||
mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService,
|
mDozeParameters, mKeyguardUpdateMonitor, mDozeLog, mTunerService,
|
||||||
() -> mStatusBarStateController);
|
() -> mStatusBarStateController, mConfigurationController);
|
||||||
mDozeUi.setDozeMachine(mMachine);
|
mDozeUi.setDozeMachine(mMachine);
|
||||||
|
|
||||||
// Never animate if display doesn't support it.
|
// Never animate if display doesn't support it.
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class DozeParametersTest extends SysuiTestCase {
|
|||||||
@Mock private BatteryController mBatteryController;
|
@Mock private BatteryController mBatteryController;
|
||||||
@Mock private FeatureFlags mFeatureFlags;
|
@Mock private FeatureFlags mFeatureFlags;
|
||||||
@Mock private DumpManager mDumpManager;
|
@Mock private DumpManager mDumpManager;
|
||||||
|
@Mock private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
@@ -75,7 +76,8 @@ public class DozeParametersTest extends SysuiTestCase {
|
|||||||
mBatteryController,
|
mBatteryController,
|
||||||
mTunerService,
|
mTunerService,
|
||||||
mDumpManager,
|
mDumpManager,
|
||||||
mFeatureFlags
|
mFeatureFlags,
|
||||||
|
mUnlockedScreenOffAnimationController
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@Test
|
@Test
|
||||||
@@ -125,7 +127,8 @@ public class DozeParametersTest extends SysuiTestCase {
|
|||||||
when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(true);
|
when(mAmbientDisplayConfiguration.alwaysOnEnabled(anyInt())).thenReturn(true);
|
||||||
mDozeParameters.onTuningChanged(Settings.Secure.DOZE_ALWAYS_ON, "1");
|
mDozeParameters.onTuningChanged(Settings.Secure.DOZE_ALWAYS_ON, "1");
|
||||||
when(mFeatureFlags.useNewLockscreenAnimations()).thenReturn(true);
|
when(mFeatureFlags.useNewLockscreenAnimations()).thenReturn(true);
|
||||||
|
when(mUnlockedScreenOffAnimationController.shouldPlayUnlockedScreenOffAnimation())
|
||||||
|
.thenReturn(true);
|
||||||
assertTrue(mDozeParameters.shouldControlUnlockedScreenOff());
|
assertTrue(mDozeParameters.shouldControlUnlockedScreenOff());
|
||||||
|
|
||||||
// Trigger the setter for the current value.
|
// Trigger the setter for the current value.
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.android.systemui.dump.DumpManager;
|
|||||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -70,6 +71,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
@Mock private SysuiColorExtractor mColorExtractor;
|
@Mock private SysuiColorExtractor mColorExtractor;
|
||||||
@Mock ColorExtractor.GradientColors mGradientColors;
|
@Mock ColorExtractor.GradientColors mGradientColors;
|
||||||
@Mock private DumpManager mDumpManager;
|
@Mock private DumpManager mDumpManager;
|
||||||
|
@Mock private KeyguardStateController mKeyguardStateController;
|
||||||
@Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;
|
@Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;
|
||||||
|
|
||||||
private NotificationShadeWindowControllerImpl mNotificationShadeWindowController;
|
private NotificationShadeWindowControllerImpl mNotificationShadeWindowController;
|
||||||
@@ -83,7 +85,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
|
|||||||
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager);
|
mColorExtractor, mDumpManager, mKeyguardStateController);
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
|
|
||||||
mNotificationShadeWindowController.attach();
|
mNotificationShadeWindowController.attach();
|
||||||
|
|||||||
@@ -132,4 +132,9 @@ public class FakeKeyguardStateController implements KeyguardStateController {
|
|||||||
public boolean canPerformSmartSpaceTransition() {
|
public boolean canPerformSmartSpaceTransition() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isKeyguardScreenRotationAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ import com.android.systemui.statusbar.phone.ShadeController;
|
|||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||||
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||||
import com.android.wm.shell.R;
|
import com.android.wm.shell.R;
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
@@ -227,6 +228,8 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
private TaskStackListenerImpl mTaskStackListener;
|
private TaskStackListenerImpl mTaskStackListener;
|
||||||
@Mock
|
@Mock
|
||||||
private ShellTaskOrganizer mShellTaskOrganizer;
|
private ShellTaskOrganizer mShellTaskOrganizer;
|
||||||
|
@Mock
|
||||||
|
private KeyguardStateController mKeyguardStateController;
|
||||||
|
|
||||||
private TestableBubblePositioner mPositioner;
|
private TestableBubblePositioner mPositioner;
|
||||||
|
|
||||||
@@ -249,7 +252,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager);
|
mColorExtractor, mDumpManager, mKeyguardStateController);
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
mNotificationShadeWindowController.attach();
|
mNotificationShadeWindowController.attach();
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ import com.android.systemui.statusbar.phone.ShadeController;
|
|||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||||
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
import com.android.systemui.statusbar.policy.ZenModeController;
|
import com.android.systemui.statusbar.policy.ZenModeController;
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
import com.android.wm.shell.ShellTaskOrganizer;
|
||||||
import com.android.wm.shell.WindowManagerShellWrapper;
|
import com.android.wm.shell.WindowManagerShellWrapper;
|
||||||
@@ -192,6 +193,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
private TaskStackListenerImpl mTaskStackListener;
|
private TaskStackListenerImpl mTaskStackListener;
|
||||||
@Mock
|
@Mock
|
||||||
private ShellTaskOrganizer mShellTaskOrganizer;
|
private ShellTaskOrganizer mShellTaskOrganizer;
|
||||||
|
@Mock
|
||||||
|
private KeyguardStateController mKeyguardStateController;
|
||||||
|
|
||||||
private TestableBubblePositioner mPositioner;
|
private TestableBubblePositioner mPositioner;
|
||||||
|
|
||||||
@@ -213,7 +216,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
|
||||||
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
|
||||||
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
|
||||||
mColorExtractor, mDumpManager);
|
mColorExtractor, mDumpManager, mKeyguardStateController);
|
||||||
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
|
||||||
mNotificationShadeWindowController.attach();
|
mNotificationShadeWindowController.attach();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user