Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4372d91 authored by gaochong's avatar gaochong
Browse files

Fix Screen Magnification recursive draw

When invoke the method View#setLayoutParams(), ViewRootImpl
will run method ViewRootImpl#performTraversals(). And
OnGlobalLayoutListener#onGlobalLayout() will be invoked.
When the method View#setLayoutParams() is invoked in
OnGlobalLayoutListener#onGlobalLayout(), there will be recursive
call. The view will be draw on and on. This situation happen in
Screen Magnification. It should remove the listener after
work completion.

Bug: https://issuetracker.google.com/issues/62613000



Test: use systrace when enter Screen Magnification,and view the
"traversal" times.

Change-Id: I01b1fcccb8b915ec436fb95f1d30c8ec0c0de0a9
Signed-off-by: default avatargaochong <gaochong@xiaomi.com>
parent 46f7199c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ public class ToggleScreenMagnificationPreferenceFragment extends ToggleFeaturePr
                    videoView.setLayoutParams(videoLp);
                    videoView.invalidate();
                    videoView.start();
                    mVideoBackgroundView.getViewTreeObserver()
                            .removeOnGlobalLayoutListener(mLayoutListener);
                }
            };