Use CounterRotator for wallpaper animation targets when unlocking
To avoid seeing the portrait wallpaper being placed on the Landscape display bounds without fiting the screen when unlocking keyguard in phone devices from Portrait to Landscape mode, Using CounterRotator to ensure the closing wallpaper orientation unchanged during transition animation for fixing this flicker case. See: http://recall/-/bN53iXCwu0DIehsmJlTyWk/craq03f8iJXcaFXGWR8mBM Bug: 283963801 Test: atest WMShellFlickerTests:UnlockKeyguardToSplitScreen \ --rerun-until failure 10 Test: manual by issue steps: 1) Launch apps to enter split-screen mode 2) Turn off/on the screen with power key to show the lockscreen 3) Rotate the device in landscape 4) Swipe up to dismiss the lockscreen 5) Expect the split-tasks animates fade-in without seeing a weird cross-fade out animation on top of the split-tasks Change-Id: I50550fd2a7fc488d743794fb1044dfe9d126521a
This commit is contained in:
@@ -185,6 +185,9 @@ public class KeyguardTransitionHandler implements Transitions.TransitionHandler
|
||||
@Override
|
||||
public void onTransitionFinished(
|
||||
WindowContainerTransaction wct, SurfaceControl.Transaction sct) {
|
||||
if (sct != null) {
|
||||
finishTransaction.merge(sct);
|
||||
}
|
||||
mMainExecutor.execute(() -> {
|
||||
mStartedTransitions.remove(transition);
|
||||
finishCallback.onTransitionFinished(wct, null);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.android.wm.shell.flicker.splitscreen
|
||||
|
||||
import android.platform.test.annotations.Postsubmit
|
||||
import android.tools.common.NavBar
|
||||
import android.tools.common.Rotation
|
||||
import android.tools.common.flicker.subject.region.RegionSubject
|
||||
import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
|
||||
import android.tools.device.flicker.legacy.FlickerBuilder
|
||||
@@ -105,8 +104,6 @@ class UnlockKeyguardToSplitScreen(override val flicker: FlickerTest) :
|
||||
@JvmStatic
|
||||
fun getParams(): List<FlickerTest> {
|
||||
return FlickerTestFactory.nonRotationTests(
|
||||
// TODO(b/283963801) address entireScreenCovered test faliure in landscape.
|
||||
supportedRotations = listOf(Rotation.ROTATION_0),
|
||||
supportedNavigationModes = listOf(NavBar.MODE_GESTURAL)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_OCCLUDE_BY_DREAM;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_KEYGUARD_UNOCCLUDE;
|
||||
import static android.view.WindowManager.TRANSIT_OLD_NONE;
|
||||
import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.view.WindowManager.TransitionFlags;
|
||||
import static android.view.WindowManager.TransitionOldType;
|
||||
import static android.view.WindowManager.TransitionType;
|
||||
@@ -49,6 +50,7 @@ import android.os.RemoteException;
|
||||
import android.os.Trace;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.RotationUtils;
|
||||
import android.util.Slog;
|
||||
import android.view.IRemoteAnimationFinishedCallback;
|
||||
import android.view.IRemoteAnimationRunner;
|
||||
@@ -73,6 +75,7 @@ import com.android.systemui.SystemUIApplication;
|
||||
import com.android.systemui.settings.DisplayTracker;
|
||||
import com.android.wm.shell.transition.ShellTransitions;
|
||||
import com.android.wm.shell.transition.Transitions;
|
||||
import com.android.wm.shell.util.CounterRotator;
|
||||
import com.android.wm.shell.util.TransitionUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -103,7 +106,8 @@ public class KeyguardService extends Service {
|
||||
}
|
||||
|
||||
private static RemoteAnimationTarget[] wrap(TransitionInfo info, boolean wallpapers,
|
||||
SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
|
||||
SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap,
|
||||
CounterRotator counterWallpaper) {
|
||||
final ArrayList<RemoteAnimationTarget> out = new ArrayList<>();
|
||||
for (int i = 0; i < info.getChanges().size(); i++) {
|
||||
boolean changeIsWallpaper =
|
||||
@@ -133,6 +137,25 @@ public class KeyguardService extends Service {
|
||||
(change.getFlags() & TransitionInfo.FLAG_SHOW_WALLPAPER) != 0,
|
||||
info, t, leashMap);
|
||||
|
||||
if (changeIsWallpaper) {
|
||||
int rotateDelta = RotationUtils.deltaRotation(change.getStartRotation(),
|
||||
change.getEndRotation());
|
||||
if (rotateDelta != 0 && change.getParent() != null
|
||||
&& change.getMode() == TRANSIT_TO_BACK) {
|
||||
final TransitionInfo.Change parent = info.getChange(change.getParent());
|
||||
if (parent != null) {
|
||||
float displayW = parent.getEndAbsBounds().width();
|
||||
float displayH = parent.getEndAbsBounds().height();
|
||||
counterWallpaper.setup(t, parent.getLeash(), rotateDelta, displayW,
|
||||
displayH);
|
||||
}
|
||||
if (counterWallpaper.getSurface() != null) {
|
||||
t.setLayer(counterWallpaper.getSurface(), -1);
|
||||
counterWallpaper.addChild(t, leashMap.get(change.getLeash()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out.add(target);
|
||||
}
|
||||
return out.toArray(new RemoteAnimationTarget[out.size()]);
|
||||
@@ -163,6 +186,8 @@ public class KeyguardService extends Service {
|
||||
return new IRemoteTransition.Stub() {
|
||||
|
||||
private final ArrayMap<SurfaceControl, SurfaceControl> mLeashMap = new ArrayMap<>();
|
||||
private final CounterRotator mCounterRotator = new CounterRotator();
|
||||
|
||||
|
||||
@GuardedBy("mLeashMap")
|
||||
private IRemoteTransitionFinishedCallback mFinishCallback = null;
|
||||
@@ -175,9 +200,9 @@ public class KeyguardService extends Service {
|
||||
|
||||
synchronized (mLeashMap) {
|
||||
final RemoteAnimationTarget[] apps =
|
||||
wrap(info, false /* wallpapers */, t, mLeashMap);
|
||||
wrap(info, false /* wallpapers */, t, mLeashMap, mCounterRotator);
|
||||
final RemoteAnimationTarget[] wallpapers =
|
||||
wrap(info, true /* wallpapers */, t, mLeashMap);
|
||||
wrap(info, true /* wallpapers */, t, mLeashMap, mCounterRotator);
|
||||
final RemoteAnimationTarget[] nonApps = new RemoteAnimationTarget[0];
|
||||
|
||||
// Set alpha back to 1 for the independent changes because we will be animating
|
||||
@@ -231,11 +256,19 @@ public class KeyguardService extends Service {
|
||||
|
||||
@GuardedBy("mLeashMap")
|
||||
private void finish() throws RemoteException {
|
||||
SurfaceControl.Transaction finishTransaction = null;
|
||||
if (mCounterRotator.getSurface() != null
|
||||
&& mCounterRotator.getSurface().isValid()) {
|
||||
finishTransaction = new SurfaceControl.Transaction();
|
||||
mCounterRotator.cleanUp(finishTransaction);
|
||||
}
|
||||
mLeashMap.clear();
|
||||
final IRemoteTransitionFinishedCallback finishCallback = mFinishCallback;
|
||||
if (finishCallback != null) {
|
||||
mFinishCallback = null;
|
||||
finishCallback.onTransitionFinished(null /* wct */, null /* t */);
|
||||
finishCallback.onTransitionFinished(null /* wct */, finishTransaction);
|
||||
} else if (finishTransaction != null) {
|
||||
finishTransaction.apply();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user