Skip to content

Commit 187f3f9

Browse files
committed
Magnified frame not properly computed when keyguard goes away.
1. The keyguard force hides some windows when it is shown and as soon as the keyguard goes away there windows are made visible. However, the window transition that the keyguard is moving away is reported before the force hidden windows are shown which makes the screen magnifier compute the magnified region with an incomplete list of windows of interest. bug:7215285 Change-Id: I3abc4d97b7a74de8183ad20477dadf66c82da037
1 parent bc391d5 commit 187f3f9

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

services/java/com/android/server/accessibility/ScreenMagnifier.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,8 +869,22 @@ public DisplayContentObserver(Context context, Viewport viewport,
869869
mDisplayContentChangeListener = new IDisplayContentChangeListener.Stub() {
870870
@Override
871871
public void onWindowTransition(int displayId, int transition, WindowInfo info) {
872-
mHandler.obtainMessage(MESSAGE_ON_WINDOW_TRANSITION, transition, 0,
873-
WindowInfo.obtain(info)).sendToTarget();
872+
Message message = mHandler.obtainMessage(MESSAGE_ON_WINDOW_TRANSITION,
873+
transition, 0, WindowInfo.obtain(info));
874+
// TODO: This makes me quite unhappy but for the time being the
875+
// least risky fix for cases where the keyguard is removed but
876+
// the windows it force hides are not made visible yet. Hence,
877+
// we would compute the magnified frame before we have a stable
878+
// state. One more reason to move the magnified frame computation
879+
// in the window manager!
880+
if (info.type == WindowManager.LayoutParams.TYPE_KEYGUARD
881+
|| info.type == WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG
882+
&& (transition == WindowManagerPolicy.TRANSIT_EXIT
883+
|| transition == WindowManagerPolicy.TRANSIT_HIDE)) {
884+
mHandler.sendMessageDelayed(message, mLongAnimationDuration);
885+
} else {
886+
message.sendToTarget();
887+
}
874888
}
875889

876890
@Override

0 commit comments

Comments
 (0)