summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Evan Rosky <erosky@google.com> 2023-05-12 22:53:32 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-05-12 22:53:32 +0000
commitc8196383a29e67e65848c69b811b3e28e19bef3b (patch)
tree9a4858876a4f8ca482d88f24e8a2e6f3c804b95a
parente0a5db492f26d6ae6052b5d0e92805fb64279742 (diff)
parent27c8c5ec7d7d1723b2a43253c03c2fc1c7f02739 (diff)
Merge "Fix graphical glitches on keyguard-unlock with PIP" into udc-dev
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java52
2 files changed, 34 insertions, 39 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java b/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java
index ef0c7a8a755b..6d37e58c59ad 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/util/TransitionUtil.java
@@ -235,11 +235,20 @@ public class TransitionUtil {
public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
TransitionInfo info, SurfaceControl.Transaction t,
@Nullable ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
+ return newTarget(change, order, false /* forceTranslucent */, info, t, leashMap);
+ }
+
+ /**
+ * Creates a new RemoteAnimationTarget from the provided change info
+ */
+ public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
+ boolean forceTranslucent, TransitionInfo info, SurfaceControl.Transaction t,
+ @Nullable ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
final SurfaceControl leash = createLeash(info, change, order, t);
if (leashMap != null) {
leashMap.put(change.getLeash(), leash);
}
- return newTarget(change, order, leash);
+ return newTarget(change, order, leash, forceTranslucent);
}
/**
@@ -247,6 +256,14 @@ public class TransitionUtil {
*/
public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
SurfaceControl leash) {
+ return newTarget(change, order, leash, false /* forceTranslucent */);
+ }
+
+ /**
+ * Creates a new RemoteAnimationTarget from the provided change and leash
+ */
+ public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
+ SurfaceControl leash, boolean forceTranslucent) {
if (isDividerBar(change)) {
return getDividerTarget(change, leash);
}
@@ -276,7 +293,7 @@ public class TransitionUtil {
// TODO: once we can properly sync transactions across process,
// then get rid of this leash.
leash,
- (change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0,
+ forceTranslucent || (change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0,
null,
// TODO(shell-transitions): we need to send content insets? evaluate how its used.
new Rect(0, 0, 0, 0),
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
index 6e77dcbd75cf..54da680d8a68 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardService.java
@@ -42,8 +42,6 @@ import android.app.ActivityTaskManager;
import android.app.Service;
import android.app.WindowConfiguration;
import android.content.Intent;
-import android.graphics.Point;
-import android.graphics.Rect;
import android.os.Binder;
import android.os.Bundle;
import android.os.Debug;
@@ -77,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.TransitionUtil;
import java.util.ArrayList;
@@ -105,7 +104,8 @@ public class KeyguardService extends Service {
}
}
- private static RemoteAnimationTarget[] wrap(TransitionInfo info, boolean wallpapers) {
+ private static RemoteAnimationTarget[] wrap(TransitionInfo info, boolean wallpapers,
+ SurfaceControl.Transaction t, ArrayMap<SurfaceControl, SurfaceControl> leashMap) {
final ArrayList<RemoteAnimationTarget> out = new ArrayList<>();
for (int i = 0; i < info.getChanges().size(); i++) {
boolean changeIsWallpaper =
@@ -115,32 +115,14 @@ public class KeyguardService extends Service {
final TransitionInfo.Change change = info.getChanges().get(i);
final ActivityManager.RunningTaskInfo taskInfo = change.getTaskInfo();
final int taskId = taskInfo != null ? change.getTaskInfo().taskId : -1;
- boolean isNotInRecents;
- WindowConfiguration windowConfiguration = null;
- if (taskInfo != null) {
- if (taskInfo.getConfiguration() != null) {
- windowConfiguration =
- change.getTaskInfo().getConfiguration().windowConfiguration;
- }
- isNotInRecents = !change.getTaskInfo().isRunning;
- } else {
- isNotInRecents = true;
- }
- Rect localBounds = new Rect(change.getEndAbsBounds());
- localBounds.offsetTo(change.getEndRelOffset().x, change.getEndRelOffset().y);
-
- final RemoteAnimationTarget target = new RemoteAnimationTarget(
- taskId,
- newModeToLegacyMode(change.getMode()),
- change.getLeash(),
- (change.getFlags() & TransitionInfo.FLAG_TRANSLUCENT) != 0
- || (change.getFlags() & TransitionInfo.FLAG_SHOW_WALLPAPER) != 0,
- null /* clipRect */,
- new Rect(0, 0, 0, 0) /* contentInsets */,
+
+ final RemoteAnimationTarget target = TransitionUtil.newTarget(change,
+ // wallpapers go into the "below" layer space
info.getChanges().size() - i,
- new Point(), localBounds, new Rect(change.getEndAbsBounds()),
- windowConfiguration, isNotInRecents, null /* startLeash */,
- change.getStartAbsBounds(), taskInfo, false /* allowEnterPip */);
+ // keyguard treats wallpaper as translucent
+ (change.getFlags() & TransitionInfo.FLAG_SHOW_WALLPAPER) != 0,
+ info, t, leashMap);
+
// Use hasAnimatingParent to mark the anything below root task
if (taskId != -1 && change.getParent() != null) {
final TransitionInfo.Change parentChange = info.getChange(change.getParent());
@@ -178,31 +160,27 @@ public class KeyguardService extends Service {
return new IRemoteTransition.Stub() {
final ArrayMap<IBinder, IRemoteTransitionFinishedCallback> mFinishCallbacks =
new ArrayMap<>();
+ private final ArrayMap<SurfaceControl, SurfaceControl> mLeashMap = new ArrayMap<>();
@Override
public void startAnimation(IBinder transition, TransitionInfo info,
SurfaceControl.Transaction t, IRemoteTransitionFinishedCallback finishCallback)
throws RemoteException {
Slog.d(TAG, "Starts IRemoteAnimationRunner: info=" + info);
- final RemoteAnimationTarget[] apps = wrap(info, false /* wallpapers */);
- final RemoteAnimationTarget[] wallpapers = wrap(info, true /* wallpapers */);
+ final RemoteAnimationTarget[] apps =
+ wrap(info, false /* wallpapers */, t, mLeashMap);
+ final RemoteAnimationTarget[] wallpapers =
+ wrap(info, true /* wallpapers */, t, mLeashMap);
final RemoteAnimationTarget[] nonApps = new RemoteAnimationTarget[0];
// Sets the alpha to 0 for the opening root task for fade in animation. And since
// the fade in animation can only apply on the first opening app, so set alpha to 1
// 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);
}