Merge "Apply wake up animation to wallpaper window" into rvc-dev am: 0e26234de4 am: 7f0e64536e
Change-Id: I4f857331d33d51efcd92286f461dc8f2e17944e4
This commit is contained in:
@@ -120,7 +120,7 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
private void init(DozeParameters dozeParameters) {
|
private void init(DozeParameters dozeParameters) {
|
||||||
mIsHighEndGfx = ActivityManager.isHighEndGfx();
|
mIsHighEndGfx = ActivityManager.isHighEndGfx();
|
||||||
mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking();
|
mDisplayNeedsBlanking = dozeParameters.getDisplayNeedsBlanking();
|
||||||
mNeedTransition = mIsHighEndGfx && !mDisplayNeedsBlanking;
|
mNeedTransition = false;
|
||||||
|
|
||||||
// We will preserve EGL context when we are in lock screen or aod
|
// We will preserve EGL context when we are in lock screen or aod
|
||||||
// to avoid janking in following transition, we need to release when back to home.
|
// to avoid janking in following transition, we need to release when back to home.
|
||||||
@@ -137,7 +137,7 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
mRenderer = getRendererInstance();
|
mRenderer = getRendererInstance();
|
||||||
getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo);
|
getDisplayContext().getDisplay().getDisplayInfo(mDisplayInfo);
|
||||||
setFixedSizeAllowed(true);
|
setFixedSizeAllowed(true);
|
||||||
setOffsetNotificationsEnabled(true);
|
setOffsetNotificationsEnabled(mNeedTransition);
|
||||||
updateSurfaceSize();
|
updateSurfaceSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import com.android.systemui.statusbar.phone.BiometricUnlockController
|
|||||||
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
|
import com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK
|
||||||
import com.android.systemui.statusbar.phone.NotificationShadeWindowController
|
import com.android.systemui.statusbar.phone.NotificationShadeWindowController
|
||||||
import com.android.systemui.statusbar.phone.PanelExpansionListener
|
import com.android.systemui.statusbar.phone.PanelExpansionListener
|
||||||
|
import com.android.systemui.statusbar.phone.ScrimController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import java.io.FileDescriptor
|
import java.io.FileDescriptor
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
@@ -106,6 +107,16 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
shadeSpring.finishIfRunning()
|
shadeSpring.finishIfRunning()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force stop blur effect when necessary.
|
||||||
|
*/
|
||||||
|
private var scrimsVisible: Boolean = false
|
||||||
|
set(value) {
|
||||||
|
if (field == value) return
|
||||||
|
field = value
|
||||||
|
scheduleUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Blur radius of the wake-up animation on this frame.
|
* Blur radius of the wake-up animation on this frame.
|
||||||
*/
|
*/
|
||||||
@@ -142,7 +153,13 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
if (showingHomeControls) {
|
if (showingHomeControls) {
|
||||||
globalActionsRadius = 0
|
globalActionsRadius = 0
|
||||||
}
|
}
|
||||||
val blur = max(shadeRadius.toInt(), globalActionsRadius)
|
var blur = max(shadeRadius.toInt(), globalActionsRadius)
|
||||||
|
|
||||||
|
// Make blur be 0 if it is necessary to stop blur effect.
|
||||||
|
if (scrimsVisible) {
|
||||||
|
blur = 0
|
||||||
|
}
|
||||||
|
|
||||||
blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur)
|
blurUtils.applyBlur(blurRoot?.viewRootImpl ?: root.viewRootImpl, blur)
|
||||||
try {
|
try {
|
||||||
wallpaperManager.setWallpaperZoomOut(root.windowToken,
|
wallpaperManager.setWallpaperZoomOut(root.windowToken,
|
||||||
@@ -202,6 +219,10 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
brightnessMirrorSpring.finishIfRunning()
|
brightnessMirrorSpring.finishIfRunning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDozeAmountChanged(linear: Float, eased: Float) {
|
||||||
|
wakeAndUnlockBlurRadius = blurUtils.blurRadiusOfRatio(eased)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -210,6 +231,10 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
keyguardStateController.addCallback(keyguardStateCallback)
|
keyguardStateController.addCallback(keyguardStateCallback)
|
||||||
}
|
}
|
||||||
statusBarStateController.addCallback(statusBarStateCallback)
|
statusBarStateController.addCallback(statusBarStateCallback)
|
||||||
|
notificationShadeWindowController.setScrimsVisibilityListener {
|
||||||
|
// Stop blur effect when scrims is opaque to avoid unnecessary GPU composition.
|
||||||
|
visibility -> scrimsVisible = visibility == ScrimController.OPAQUE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -225,7 +250,8 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
|
|
||||||
private fun updateShadeBlur() {
|
private fun updateShadeBlur() {
|
||||||
var newBlur = 0
|
var newBlur = 0
|
||||||
if (statusBarStateController.state == StatusBarState.SHADE) {
|
val state = statusBarStateController.state
|
||||||
|
if (state == StatusBarState.SHADE || state == StatusBarState.SHADE_LOCKED) {
|
||||||
val animatedBlur =
|
val animatedBlur =
|
||||||
Interpolators.SHADE_ANIMATION.getInterpolation(
|
Interpolators.SHADE_ANIMATION.getInterpolation(
|
||||||
MathUtils.constrain(shadeExpansion / 0.15f, 0f, 1f))
|
MathUtils.constrain(shadeExpansion / 0.15f, 0f, 1f))
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import java.lang.ref.WeakReference;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -92,6 +93,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
|
|||||||
private final State mCurrentState = new State();
|
private final State mCurrentState = new State();
|
||||||
private OtherwisedCollapsedListener mListener;
|
private OtherwisedCollapsedListener mListener;
|
||||||
private ForcePluginOpenListener mForcePluginOpenListener;
|
private ForcePluginOpenListener mForcePluginOpenListener;
|
||||||
|
private Consumer<Integer> mScrimsVisibilityListener;
|
||||||
private final ArrayList<WeakReference<StatusBarWindowCallback>>
|
private final ArrayList<WeakReference<StatusBarWindowCallback>>
|
||||||
mCallbacks = Lists.newArrayList();
|
mCallbacks = Lists.newArrayList();
|
||||||
|
|
||||||
@@ -150,6 +152,16 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
|
|||||||
mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
|
mCallbacks.add(new WeakReference<StatusBarWindowCallback>(callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a listener to monitor scrims visibility
|
||||||
|
* @param listener A listener to monitor scrims visibility
|
||||||
|
*/
|
||||||
|
public void setScrimsVisibilityListener(Consumer<Integer> listener) {
|
||||||
|
if (listener != null && mScrimsVisibilityListener != listener) {
|
||||||
|
mScrimsVisibilityListener = listener;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean shouldEnableKeyguardScreenRotation() {
|
private boolean shouldEnableKeyguardScreenRotation() {
|
||||||
Resources res = mContext.getResources();
|
Resources res = mContext.getResources();
|
||||||
return SystemProperties.getBoolean("lockscreen.rot_override", false)
|
return SystemProperties.getBoolean("lockscreen.rot_override", false)
|
||||||
@@ -477,6 +489,7 @@ public class NotificationShadeWindowController implements Callback, Dumpable,
|
|||||||
public void setScrimsVisibility(int scrimsVisibility) {
|
public void setScrimsVisibility(int scrimsVisibility) {
|
||||||
mCurrentState.mScrimsVisibility = scrimsVisibility;
|
mCurrentState.mScrimsVisibility = scrimsVisibility;
|
||||||
apply(mCurrentState);
|
apply(mCurrentState);
|
||||||
|
mScrimsVisibilityListener.accept(scrimsVisibility);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class ImageWallpaperTest extends SysuiTestCase {
|
|||||||
LOW_BMP_HEIGHT /* bmpHeight */,
|
LOW_BMP_HEIGHT /* bmpHeight */,
|
||||||
LOW_BMP_WIDTH /* surfaceWidth */,
|
LOW_BMP_WIDTH /* surfaceWidth */,
|
||||||
LOW_BMP_HEIGHT /* surfaceHeight */,
|
LOW_BMP_HEIGHT /* surfaceHeight */,
|
||||||
true /* assertion */);
|
false /* assertion */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -172,7 +172,7 @@ public class ImageWallpaperTest extends SysuiTestCase {
|
|||||||
INVALID_BMP_HEIGHT /* bmpHeight */,
|
INVALID_BMP_HEIGHT /* bmpHeight */,
|
||||||
ImageWallpaper.GLEngine.MIN_SURFACE_WIDTH /* surfaceWidth */,
|
ImageWallpaper.GLEngine.MIN_SURFACE_WIDTH /* surfaceWidth */,
|
||||||
ImageWallpaper.GLEngine.MIN_SURFACE_HEIGHT /* surfaceHeight */,
|
ImageWallpaper.GLEngine.MIN_SURFACE_HEIGHT /* surfaceHeight */,
|
||||||
true /* assertion */);
|
false /* assertion */);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifySurfaceSizeAndAssertTransition(int bmpWidth, int bmpHeight,
|
private void verifySurfaceSizeAndAssertTransition(int bmpWidth, int bmpHeight,
|
||||||
|
|||||||
Reference in New Issue
Block a user