@@ -846,7 +846,6 @@ && isScreenMagnificationAutoUpdateEnabled(mContext)) {
846846 private static final class DisplayContentObserver {
847847
848848 private static final int MESSAGE_SHOW_VIEWPORT_FRAME = 1 ;
849- private static final int MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS = 2 ;
850849 private static final int MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED = 3 ;
851850 private static final int MESSAGE_ON_WINDOW_TRANSITION = 4 ;
852851 private static final int MESSAGE_ON_ROTATION_CHANGED = 5 ;
@@ -892,7 +891,9 @@ public void onWindowTransition(int displayId, int transition, WindowInfo info) {
892891 || info .type == WindowManager .LayoutParams .TYPE_KEYGUARD_DIALOG
893892 && (transition == WindowManagerPolicy .TRANSIT_EXIT
894893 || transition == WindowManagerPolicy .TRANSIT_HIDE )) {
895- mHandler .sendMessageDelayed (message , mLongAnimationDuration );
894+ final long delay = (long ) (2 * mLongAnimationDuration
895+ * mWindowAnimationScale );
896+ mHandler .sendMessageDelayed (message , delay );
896897 } else {
897898 message .sendToTarget ();
898899 }
@@ -1170,10 +1171,6 @@ public void handleMessage(Message message) {
11701171 case MESSAGE_SHOW_VIEWPORT_FRAME : {
11711172 mViewport .setFrameShown (true , true );
11721173 } break ;
1173- case MESSAGE_RECOMPUTE_VIEWPORT_BOUNDS : {
1174- final boolean animate = message .arg1 == 1 ;
1175- mViewport .recomputeBounds (animate );
1176- } break ;
11771174 case MESSAGE_ON_RECTANGLE_ON_SCREEN_REQUESTED : {
11781175 SomeArgs args = (SomeArgs ) message .obj ;
11791176 try {
@@ -1526,8 +1523,10 @@ public void recomputeBounds(boolean animate) {
15261523 Rect magnifiedFrame = mTempRect1 ;
15271524 magnifiedFrame .set (0 , 0 , 0 , 0 );
15281525
1529- Rect notMagnifiedFrame = mTempRect2 ;
1530- notMagnifiedFrame .set (0 , 0 , 0 , 0 );
1526+ DisplayInfo displayInfo = mDisplayProvider .getDisplayInfo ();
1527+
1528+ Rect availableFrame = mTempRect2 ;
1529+ availableFrame .set (0 , 0 , displayInfo .logicalWidth , displayInfo .logicalHeight );
15311530
15321531 ArrayList <WindowInfo > infos = mTempWindowInfoList ;
15331532 infos .clear ();
@@ -1542,18 +1541,16 @@ public void recomputeBounds(boolean animate) {
15421541 if (info .type == WindowManager .LayoutParams .TYPE_MAGNIFICATION_OVERLAY ) {
15431542 continue ;
15441543 }
1544+ Rect windowFrame = mTempRect3 ;
1545+ windowFrame .set (info .touchableRegion );
15451546 if (isWindowMagnified (info .type )) {
1546- Rect clippedFrame = mTempRect3 ;
1547- clippedFrame .set (info .touchableRegion );
1548- subtract (clippedFrame , notMagnifiedFrame );
1549- magnifiedFrame .union (clippedFrame );
1547+ magnifiedFrame .union (windowFrame );
1548+ magnifiedFrame .intersect (availableFrame );
15501549 } else {
1551- Rect clippedFrame = mTempRect3 ;
1552- clippedFrame .set (info .touchableRegion );
1553- subtract (clippedFrame , magnifiedFrame );
1554- notMagnifiedFrame .union (clippedFrame );
1550+ subtract (windowFrame , magnifiedFrame );
1551+ subtract (availableFrame , windowFrame );
15551552 }
1556- if (magnifiedFrame . bottom >= notMagnifiedFrame . top ) {
1553+ if (availableFrame . equals ( magnifiedFrame ) ) {
15571554 break ;
15581555 }
15591556 }
0 commit comments