Merge "Attemp to fix Launcher stay invisible after keyguard unlock." into tm-qpr-dev
This commit is contained in:
@@ -158,7 +158,7 @@ public class KeyguardService extends Service {
|
|||||||
Rect localBounds = new Rect(change.getEndAbsBounds());
|
Rect localBounds = new Rect(change.getEndAbsBounds());
|
||||||
localBounds.offsetTo(change.getEndRelOffset().x, change.getEndRelOffset().y);
|
localBounds.offsetTo(change.getEndRelOffset().x, change.getEndRelOffset().y);
|
||||||
|
|
||||||
out.add(new RemoteAnimationTarget(
|
final RemoteAnimationTarget target = new RemoteAnimationTarget(
|
||||||
taskId,
|
taskId,
|
||||||
newModeToLegacyMode(change.getMode()),
|
newModeToLegacyMode(change.getMode()),
|
||||||
change.getLeash(),
|
change.getLeash(),
|
||||||
@@ -169,7 +169,15 @@ public class KeyguardService extends Service {
|
|||||||
info.getChanges().size() - i,
|
info.getChanges().size() - i,
|
||||||
new Point(), localBounds, new Rect(change.getEndAbsBounds()),
|
new Point(), localBounds, new Rect(change.getEndAbsBounds()),
|
||||||
windowConfiguration, isNotInRecents, null /* startLeash */,
|
windowConfiguration, isNotInRecents, null /* startLeash */,
|
||||||
change.getStartAbsBounds(), taskInfo, false /* allowEnterPip */));
|
change.getStartAbsBounds(), taskInfo, false /* allowEnterPip */);
|
||||||
|
// Use hasAnimatingParent to mark the anything below root task
|
||||||
|
if (taskId != -1 && change.getParent() != null) {
|
||||||
|
final TransitionInfo.Change parentChange = info.getChange(change.getParent());
|
||||||
|
if (parentChange != null && parentChange.getTaskInfo() != null) {
|
||||||
|
target.hasAnimatingParent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out.add(target);
|
||||||
}
|
}
|
||||||
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
||||||
}
|
}
|
||||||
@@ -190,6 +198,7 @@ public class KeyguardService extends Service {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wrap Keyguard going away animation
|
||||||
private static IRemoteTransition wrap(IRemoteAnimationRunner runner) {
|
private static IRemoteTransition wrap(IRemoteAnimationRunner runner) {
|
||||||
return new IRemoteTransition.Stub() {
|
return new IRemoteTransition.Stub() {
|
||||||
final ArrayMap<IBinder, IRemoteTransitionFinishedCallback> mFinishCallbacks =
|
final ArrayMap<IBinder, IRemoteTransitionFinishedCallback> mFinishCallbacks =
|
||||||
@@ -204,9 +213,24 @@ public class KeyguardService extends Service {
|
|||||||
final RemoteAnimationTarget[] wallpapers = wrap(info, true /* wallpapers */);
|
final RemoteAnimationTarget[] wallpapers = wrap(info, true /* wallpapers */);
|
||||||
final RemoteAnimationTarget[] nonApps = new RemoteAnimationTarget[0];
|
final RemoteAnimationTarget[] nonApps = new RemoteAnimationTarget[0];
|
||||||
|
|
||||||
// TODO: Remove this, and update alpha value in the IAnimationRunner.
|
// Sets the alpha to 0 for the opening root task for fade in animation. And since
|
||||||
for (TransitionInfo.Change change : info.getChanges()) {
|
// the fade in animation can only apply on the first opening app, so set alpha to 1
|
||||||
t.setAlpha(change.getLeash(), 1.0f);
|
// for anything else.
|
||||||
|
boolean foundOpening = false;
|
||||||
|
for (RemoteAnimationTarget target : apps) {
|
||||||
|
if (target.taskId != -1
|
||||||
|
&& target.mode == RemoteAnimationTarget.MODE_OPENING
|
||||||
|
&& !target.hasAnimatingParent) {
|
||||||
|
if (foundOpening) {
|
||||||
|
Log.w(TAG, "More than one opening target");
|
||||||
|
t.setAlpha(target.leash, 1.0f);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
t.setAlpha(target.leash, 0.0f);
|
||||||
|
foundOpening = true;
|
||||||
|
} else {
|
||||||
|
t.setAlpha(target.leash, 1.0f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
t.apply();
|
t.apply();
|
||||||
synchronized (mFinishCallbacks) {
|
synchronized (mFinishCallbacks) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.os.Handler
|
|||||||
import android.os.RemoteException
|
import android.os.RemoteException
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.RemoteAnimationTarget
|
import android.view.RemoteAnimationTarget
|
||||||
|
import android.view.SurfaceControl
|
||||||
import android.view.SyncRtSurfaceTransactionApplier
|
import android.view.SyncRtSurfaceTransactionApplier
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.annotation.VisibleForTesting
|
import androidx.annotation.VisibleForTesting
|
||||||
@@ -293,6 +294,8 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
|
|
||||||
private val handler = Handler()
|
private val handler = Handler()
|
||||||
|
|
||||||
|
private val tmpFloat = FloatArray(9)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
with(surfaceBehindAlphaAnimator) {
|
with(surfaceBehindAlphaAnimator) {
|
||||||
duration = SURFACE_BEHIND_SWIPE_FADE_DURATION_MS
|
duration = SURFACE_BEHIND_SWIPE_FADE_DURATION_MS
|
||||||
@@ -723,13 +726,27 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
if (keyguardStateController.isSnappingKeyguardBackAfterSwipe) amount
|
if (keyguardStateController.isSnappingKeyguardBackAfterSwipe) amount
|
||||||
else surfaceBehindAlpha
|
else surfaceBehindAlpha
|
||||||
|
|
||||||
applyParamsToSurface(
|
// SyncRtSurfaceTransactionApplier cannot apply transaction when the target view is unable
|
||||||
SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(
|
// to draw
|
||||||
surfaceBehindRemoteAnimationTarget!!.leash)
|
val sc: SurfaceControl? = surfaceBehindRemoteAnimationTarget?.leash
|
||||||
.withMatrix(surfaceBehindMatrix)
|
if (keyguardViewController.viewRootImpl.view?.visibility != View.VISIBLE &&
|
||||||
.withCornerRadius(roundedCornerRadius)
|
sc?.isValid == true) {
|
||||||
.withAlpha(animationAlpha)
|
with(SurfaceControl.Transaction()) {
|
||||||
.build())
|
setMatrix(sc, surfaceBehindMatrix, tmpFloat)
|
||||||
|
setCornerRadius(sc, roundedCornerRadius)
|
||||||
|
setAlpha(sc, animationAlpha)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
applyParamsToSurface(
|
||||||
|
SyncRtSurfaceTransactionApplier.SurfaceParams.Builder(
|
||||||
|
surfaceBehindRemoteAnimationTarget!!.leash)
|
||||||
|
.withMatrix(surfaceBehindMatrix)
|
||||||
|
.withCornerRadius(roundedCornerRadius)
|
||||||
|
.withAlpha(animationAlpha)
|
||||||
|
.build()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -744,8 +761,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
handler.removeCallbacksAndMessages(null)
|
handler.removeCallbacksAndMessages(null)
|
||||||
|
|
||||||
// Make sure we made the surface behind fully visible, just in case. It should already be
|
// Make sure we made the surface behind fully visible, just in case. It should already be
|
||||||
// fully visible. If the launcher is doing its own animation, let it continue without
|
// fully visible. The exit animation is finished, and we should not hold the leash anymore,
|
||||||
// forcing it to 1f.
|
// so forcing it to 1f.
|
||||||
|
surfaceBehindAlphaAnimator.cancel()
|
||||||
|
surfaceBehindEntryAnimator.cancel()
|
||||||
|
surfaceBehindAlpha = 1f
|
||||||
setSurfaceBehindAppearAmount(1f)
|
setSurfaceBehindAppearAmount(1f)
|
||||||
launcherUnlockController?.setUnlockAmount(1f, false /* forceIfAnimating */)
|
launcherUnlockController?.setUnlockAmount(1f, false /* forceIfAnimating */)
|
||||||
|
|
||||||
@@ -910,4 +930,4 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
return context.resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty()
|
return context.resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2503,10 +2503,18 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
mInteractionJankMonitor.begin(
|
mInteractionJankMonitor.begin(
|
||||||
createInteractionJankMonitorConf("DismissPanel"));
|
createInteractionJankMonitorConf("DismissPanel"));
|
||||||
|
|
||||||
|
// Apply the opening animation on root task if exists
|
||||||
|
RemoteAnimationTarget aniTarget = apps[0];
|
||||||
|
for (RemoteAnimationTarget tmpTarget : apps) {
|
||||||
|
if (tmpTarget.taskId != -1 && !tmpTarget.hasAnimatingParent) {
|
||||||
|
aniTarget = tmpTarget;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Pass the surface and metadata to the unlock animation controller.
|
// Pass the surface and metadata to the unlock animation controller.
|
||||||
mKeyguardUnlockAnimationControllerLazy.get()
|
mKeyguardUnlockAnimationControllerLazy.get()
|
||||||
.notifyStartSurfaceBehindRemoteAnimation(
|
.notifyStartSurfaceBehindRemoteAnimation(
|
||||||
apps[0], startTime, mSurfaceBehindRemoteAnimationRequested);
|
aniTarget, startTime, mSurfaceBehindRemoteAnimationRequested);
|
||||||
} else {
|
} else {
|
||||||
mInteractionJankMonitor.begin(
|
mInteractionJankMonitor.begin(
|
||||||
createInteractionJankMonitorConf("RemoteAnimationDisabled"));
|
createInteractionJankMonitorConf("RemoteAnimationDisabled"));
|
||||||
|
|||||||
Reference in New Issue
Block a user