Merge "AnimateKeyguardInDelay should use the animator duration scale" into sc-qpr1-dev am: 872ae9e154
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15686697 Change-Id: Ib9750365cdade56f94ba0b2fd16322a6a4bc1d67
This commit is contained in:
@@ -132,8 +132,7 @@ public class KeyguardVisibilityHelper {
|
|||||||
.alpha(1f)
|
.alpha(1f)
|
||||||
.withEndAction(mAnimateKeyguardStatusViewVisibleEndRunnable)
|
.withEndAction(mAnimateKeyguardStatusViewVisibleEndRunnable)
|
||||||
.start();
|
.start();
|
||||||
} else if (mUnlockedScreenOffAnimationController
|
} else if (mUnlockedScreenOffAnimationController.shouldAnimateInKeyguard()) {
|
||||||
.isScreenOffLightRevealAnimationPlaying()) {
|
|
||||||
mKeyguardViewVisibilityAnimating = true;
|
mKeyguardViewVisibilityAnimating = true;
|
||||||
|
|
||||||
// Ask the screen off animation controller to animate the keyguard visibility for us
|
// Ask the screen off animation controller to animate the keyguard visibility for us
|
||||||
|
|||||||
@@ -5,20 +5,23 @@ import android.animation.AnimatorListenerAdapter
|
|||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
|
import android.database.ContentObserver
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
|
import android.provider.Settings
|
||||||
|
import com.android.systemui.statusbar.StatusBarState
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
import com.android.systemui.dagger.SysUISingleton
|
import com.android.systemui.dagger.SysUISingleton
|
||||||
import com.android.systemui.keyguard.KeyguardViewMediator
|
import com.android.systemui.keyguard.KeyguardViewMediator
|
||||||
import com.android.systemui.keyguard.WakefulnessLifecycle
|
import com.android.systemui.keyguard.WakefulnessLifecycle
|
||||||
import com.android.systemui.statusbar.LightRevealScrim
|
import com.android.systemui.statusbar.LightRevealScrim
|
||||||
import com.android.systemui.statusbar.StatusBarState
|
|
||||||
import com.android.systemui.statusbar.StatusBarStateControllerImpl
|
import com.android.systemui.statusbar.StatusBarStateControllerImpl
|
||||||
import com.android.systemui.statusbar.notification.AnimatableProperty
|
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 com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
|
import com.android.systemui.util.settings.GlobalSettings
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,13 +49,16 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
|
private val statusBarStateControllerImpl: StatusBarStateControllerImpl,
|
||||||
private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
|
private val keyguardViewMediatorLazy: dagger.Lazy<KeyguardViewMediator>,
|
||||||
private val keyguardStateController: KeyguardStateController,
|
private val keyguardStateController: KeyguardStateController,
|
||||||
private val dozeParameters: dagger.Lazy<DozeParameters>
|
private val dozeParameters: dagger.Lazy<DozeParameters>,
|
||||||
|
private val globalSettings: GlobalSettings
|
||||||
) : WakefulnessLifecycle.Observer {
|
) : WakefulnessLifecycle.Observer {
|
||||||
private val handler = Handler()
|
private val handler = Handler()
|
||||||
|
|
||||||
private lateinit var statusBar: StatusBar
|
private lateinit var statusBar: StatusBar
|
||||||
private lateinit var lightRevealScrim: LightRevealScrim
|
private lateinit var lightRevealScrim: LightRevealScrim
|
||||||
|
|
||||||
|
private var animatorDurationScale = 1f
|
||||||
|
private var shouldAnimateInKeyguard = false
|
||||||
private var lightRevealAnimationPlaying = false
|
private var lightRevealAnimationPlaying = false
|
||||||
private var aodUiAnimationPlaying = false
|
private var aodUiAnimationPlaying = false
|
||||||
|
|
||||||
@@ -79,6 +85,12 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val animatorDurationScaleObserver = object : ContentObserver(null) {
|
||||||
|
override fun onChange(selfChange: Boolean) {
|
||||||
|
updateAnimatorDurationScale()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun initialize(
|
fun initialize(
|
||||||
statusBar: StatusBar,
|
statusBar: StatusBar,
|
||||||
lightRevealScrim: LightRevealScrim
|
lightRevealScrim: LightRevealScrim
|
||||||
@@ -86,14 +98,25 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
this.lightRevealScrim = lightRevealScrim
|
this.lightRevealScrim = lightRevealScrim
|
||||||
this.statusBar = statusBar
|
this.statusBar = statusBar
|
||||||
|
|
||||||
|
updateAnimatorDurationScale()
|
||||||
|
globalSettings.registerContentObserver(
|
||||||
|
Settings.Global.getUriFor(Settings.Global.ANIMATOR_DURATION_SCALE),
|
||||||
|
/* notify for descendants */ false,
|
||||||
|
animatorDurationScaleObserver)
|
||||||
wakefulnessLifecycle.addObserver(this)
|
wakefulnessLifecycle.addObserver(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateAnimatorDurationScale() {
|
||||||
|
animatorDurationScale =
|
||||||
|
globalSettings.getFloat(Settings.Global.ANIMATOR_DURATION_SCALE, 1f)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animates in the provided keyguard view, ending in the same position that it will be in on
|
* Animates in the provided keyguard view, ending in the same position that it will be in on
|
||||||
* AOD.
|
* AOD.
|
||||||
*/
|
*/
|
||||||
fun animateInKeyguard(keyguardView: View, after: Runnable) {
|
fun animateInKeyguard(keyguardView: View, after: Runnable) {
|
||||||
|
shouldAnimateInKeyguard = false
|
||||||
keyguardView.alpha = 0f
|
keyguardView.alpha = 0f
|
||||||
keyguardView.visibility = View.VISIBLE
|
keyguardView.visibility = View.VISIBLE
|
||||||
|
|
||||||
@@ -138,6 +161,7 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
// Waking up, so reset this flag.
|
// Waking up, so reset this flag.
|
||||||
decidedToAnimateGoingToSleep = null
|
decidedToAnimateGoingToSleep = null
|
||||||
|
|
||||||
|
shouldAnimateInKeyguard = false
|
||||||
lightRevealAnimator.cancel()
|
lightRevealAnimator.cancel()
|
||||||
handler.removeCallbacksAndMessages(null)
|
handler.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
@@ -146,7 +170,6 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
// Set this to false in onFinishedWakingUp rather than onStartedWakingUp so that other
|
// Set this to false in onFinishedWakingUp rather than onStartedWakingUp so that other
|
||||||
// observers (such as StatusBar) can ask us whether we were playing the screen off animation
|
// observers (such as StatusBar) can ask us whether we were playing the screen off animation
|
||||||
// and reset accordingly.
|
// and reset accordingly.
|
||||||
lightRevealAnimationPlaying = false
|
|
||||||
aodUiAnimationPlaying = false
|
aodUiAnimationPlaying = false
|
||||||
|
|
||||||
// If we can't control the screen off animation, we shouldn't mess with the StatusBar's
|
// If we can't control the screen off animation, we shouldn't mess with the StatusBar's
|
||||||
@@ -167,15 +190,15 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
|
if (dozeParameters.get().shouldControlUnlockedScreenOff()) {
|
||||||
decidedToAnimateGoingToSleep = true
|
decidedToAnimateGoingToSleep = true
|
||||||
|
|
||||||
|
shouldAnimateInKeyguard = true
|
||||||
lightRevealAnimationPlaying = true
|
lightRevealAnimationPlaying = true
|
||||||
lightRevealAnimator.start()
|
lightRevealAnimator.start()
|
||||||
|
|
||||||
handler.postDelayed({
|
handler.postDelayed({
|
||||||
aodUiAnimationPlaying = true
|
aodUiAnimationPlaying = true
|
||||||
|
|
||||||
// Show AOD. That'll cause the KeyguardVisibilityHelper to call #animateInKeyguard.
|
// Show AOD. That'll cause the KeyguardVisibilityHelper to call #animateInKeyguard.
|
||||||
statusBar.notificationPanelViewController.showAodUi()
|
statusBar.notificationPanelViewController.showAodUi()
|
||||||
}, ANIMATE_IN_KEYGUARD_DELAY)
|
}, (ANIMATE_IN_KEYGUARD_DELAY * animatorDurationScale).toLong())
|
||||||
} else {
|
} else {
|
||||||
decidedToAnimateGoingToSleep = false
|
decidedToAnimateGoingToSleep = false
|
||||||
}
|
}
|
||||||
@@ -228,6 +251,10 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
return lightRevealAnimationPlaying || aodUiAnimationPlaying
|
return lightRevealAnimationPlaying || aodUiAnimationPlaying
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun shouldAnimateInKeyguard(): Boolean {
|
||||||
|
return shouldAnimateInKeyguard
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the light reveal animation is playing. The second part of the screen off animation,
|
* Whether the light reveal animation is playing. The second part of the screen off animation,
|
||||||
* where AOD animates in, might still be playing if this returns false.
|
* where AOD animates in, might still be playing if this returns false.
|
||||||
@@ -235,4 +262,4 @@ class UnlockedScreenOffAnimationController @Inject constructor(
|
|||||||
fun isScreenOffLightRevealAnimationPlaying(): Boolean {
|
fun isScreenOffLightRevealAnimationPlaying(): Boolean {
|
||||||
return lightRevealAnimationPlaying
|
return lightRevealAnimationPlaying
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user