Add a failsafe check to prevent display surfaces from remaining hidden
Since there appear to still be some races in the keyguard + dream
logic, add a failsafe to prevent display-areas from getting stuck in
hidden state. This should be pretty rare.
Bug: 289861878
Test: existing tests pass. This is a failsafe for a rare race.
Change-Id: I6f89d8b9a9e1aa1b8673fcaffe4c1b92c4c3d210
Merged-In: I6f89d8b9a9e1aa1b8673fcaffe4c1b92c4c3d210
diff --git a/services/core/java/com/android/server/wm/Transition.java b/services/core/java/com/android/server/wm/Transition.java
index 65c5c9b..2ac3125 100644
--- a/services/core/java/com/android/server/wm/Transition.java
+++ b/services/core/java/com/android/server/wm/Transition.java
@@ -1468,6 +1468,17 @@
mTargetDisplays.add(dc);
}
+ for (int i = 0; i < mTargets.size(); ++i) {
+ final DisplayArea da = mTargets.get(i).mContainer.asDisplayArea();
+ if (da == null) continue;
+ if (da.isVisibleRequested()) {
+ mController.mValidateDisplayVis.remove(da);
+ } else {
+ // In case something accidentally hides a displayarea and nothing shows it again.
+ mController.mValidateDisplayVis.add(da);
+ }
+ }
+
if (mOverrideOptions != null) {
info.setAnimationOptions(mOverrideOptions);
if (mOverrideOptions.getType() == ANIM_OPEN_CROSS_PROFILE_APPS) {
diff --git a/services/core/java/com/android/server/wm/TransitionController.java b/services/core/java/com/android/server/wm/TransitionController.java
index b05c6b4..7169c2c 100644
--- a/services/core/java/com/android/server/wm/TransitionController.java
+++ b/services/core/java/com/android/server/wm/TransitionController.java
@@ -150,6 +150,13 @@
final ArrayList<ActivityRecord> mValidateActivityCompat = new ArrayList<>();
/**
+ * List of display areas which were last sent as "closing"-type and haven't yet had a
+ * corresponding "opening"-type transition. A mismatch here is usually related to issues in
+ * keyguard unlock.
+ */
+ final ArrayList<DisplayArea> mValidateDisplayVis = new ArrayList<>();
+
+ /**
* Currently playing transitions (in the order they were started). When finished, records are
* removed from this list.
*/
@@ -922,6 +929,15 @@
ar.getSyncTransaction().setPosition(ar.getSurfaceControl(), tmpPos.x, tmpPos.y);
}
mValidateActivityCompat.clear();
+ for (int i = 0; i < mValidateDisplayVis.size(); ++i) {
+ final DisplayArea da = mValidateDisplayVis.get(i);
+ if (!da.isAttached() || da.getSurfaceControl() == null) continue;
+ if (da.isVisibleRequested()) {
+ Slog.e(TAG, "DisplayArea became visible outside of a transition: " + da);
+ da.getSyncTransaction().show(da.getSurfaceControl());
+ }
+ }
+ mValidateDisplayVis.clear();
}
/**