Move displaying mag bounds into surface transation

Bug: 30960346
Test: Manually enabled magnification and explored
Change-Id: Ida16979ecf0263b1c1288aa92385af29928f2d9e
diff --git a/services/core/java/com/android/server/wm/AccessibilityController.java b/services/core/java/com/android/server/wm/AccessibilityController.java
index 5abc4e4..f138add 100644
--- a/services/core/java/com/android/server/wm/AccessibilityController.java
+++ b/services/core/java/com/android/server/wm/AccessibilityController.java
@@ -222,11 +222,10 @@
                 || mWindowsForAccessibilityObserver != null);
     }
 
-    /** NOTE: This has to be called within a surface transaction. */
     public void setForceShowMagnifiableBoundsLocked(boolean show) {
         if (mDisplayMagnifier != null) {
             mDisplayMagnifier.setForceShowMagnifiableBoundsLocked(show);
-            mDisplayMagnifier.drawMagnifiedRegionBorderIfNeededLocked();
+            mDisplayMagnifier.showMagnificationBoundsIfNeeded();
         }
     }
 
@@ -440,6 +439,12 @@
             mMagnifedViewport.destroyWindow();
         }
 
+        // Can be called outside of a surface transaction
+        public void showMagnificationBoundsIfNeeded() {
+            mHandler.obtainMessage(MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)
+                    .sendToTarget();
+        }
+
         /** NOTE: This has to be called within a surface transaction. */
         public void drawMagnifiedRegionBorderIfNeededLocked() {
             mMagnifedViewport.drawWindowIfNeededLocked();