@@ -847,7 +847,6 @@ && isScreenMagnificationAutoUpdateEnabled(mContext)) {
847847 private static final class DisplayContentObserver {
848848
849849 private static final int MESSAGE_SHOW_VIEWPORT_FRAME = 1 ;
850- private static final int MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS = 2 ;
851850 private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 3 ;
852851 private static final int MESSAGE_ON_WINDOW_TRANSITION = 4 ;
853852 private static final int MESSAGE_ON_ROTATION_CHANGED = 5 ;
@@ -893,7 +892,9 @@ public void onWindowTransition(int displayId, int transition, WindowInfo info) {
893892 || info .type == WindowManager .LayoutParams .TYPE_KEYGUARD_DIALOG
894893 && (transition == WindowManagerPolicy .TRANSIT_EXIT
895894 || transition == WindowManagerPolicy .TRANSIT_HIDE )) {
896- mHandler .sendMessageDelayed (message , mLongAnimationDuration );
895+ final long delay = (long ) (2 * mLongAnimationDuration
896+ * mWindowAnimationScale );
897+ mHandler .sendMessageDelayed (message , delay );
897898 } else {
898899 message .sendToTarget ();
899900 }
@@ -1171,10 +1172,6 @@ public void handleMessage(Message message) {
11711172 case MESSAGE_SHOW_VIEWPORT_FRAME : {
11721173 mViewport .setFrameShown (true , true );
11731174 } break ;
1174- case MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS : {
1175- final boolean animate = message .arg1 == 1 ;
1176- mViewport .recomputeBounds (animate );
1177- } break ;
11781175 case MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED : {
11791176 SomeArgs args = (SomeArgs ) message .obj ;
11801177 try {
@@ -1527,8 +1524,10 @@ public void recomputeBounds(boolean animate) {
15271524 Rect magnifiedFrame = mTempRect1 ;
15281525 magnifiedFrame .set (0 , 0 , 0 , 0 );
15291526
1530- Rect notMagnifiedFrame = mTempRect2 ;
1531- notMagnifiedFrame .set (0 , 0 , 0 , 0 );
1527+ DisplayInfo displayInfo = mDisplayProvider .getDisplayInfo ();
1528+
1529+ Rect availableFrame = mTempRect2 ;
1530+ availableFrame .set (0 , 0 , displayInfo .logicalWidth , displayInfo .logicalHeight );
15321531
15331532 ArrayList <WindowInfo > infos = mTempWindowInfoList ;
15341533 infos .clear ();
@@ -1543,18 +1542,16 @@ public void recomputeBounds(boolean animate) {
15431542 if (info .type == WindowManager .LayoutParams .TYPE_MAGNIFICATION_OVERLAY ) {
15441543 continue ;
15451544 }
1545+ Rect windowFrame = mTempRect3 ;
1546+ windowFrame .set (info .touchableRegion );
15461547 if (isWindowMagnified (info .type )) {
1547- Rect clippedFrame = mTempRect3 ;
1548- clippedFrame .set (info .touchableRegion );
1549- subtract (clippedFrame , notMagnifiedFrame );
1550- magnifiedFrame .union (clippedFrame );
1548+ magnifiedFrame .union (windowFrame );
1549+ magnifiedFrame .intersect (availableFrame );
15511550 } else {
1552- Rect clippedFrame = mTempRect3 ;
1553- clippedFrame .set (info .touchableRegion );
1554- subtract (clippedFrame , magnifiedFrame );
1555- notMagnifiedFrame .union (clippedFrame );
1551+ subtract (windowFrame , magnifiedFrame );
1552+ subtract (availableFrame , windowFrame );
15561553 }
1557- if (magnifiedFrame . bottom >= notMagnifiedFrame . top ) {
1554+ if (availableFrame . equals ( magnifiedFrame ) ) {
15581555 break ;
15591556 }
15601557 }
0 commit comments