Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +20 −12 Original line number Diff line number Diff line Loading @@ -169,6 +169,11 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold */ private SurfaceControlViewHost mSurfaceControlViewHost; /** * The SurfaceControl provided by SurfaceControlViewHost. */ private SurfaceControl mMirrorViewLeash; // The root of the mirrored content private SurfaceControl mMirrorSurface; Loading Loading @@ -469,6 +474,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mSurfaceControlViewHost = null; } if (mMirrorViewLeash != null) { mTransaction.reparent(mMirrorViewLeash, null).apply(); mMirrorViewLeash.release(); mMirrorViewLeash = null; } mMirrorViewBounds.setEmpty(); mSourceBounds.setEmpty(); updateSystemUIStateIfNeeded(); Loading Loading @@ -659,23 +670,22 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mSurfaceControlViewHost = mScvhSupplier.get(); mSurfaceControlViewHost.setView(mMirrorView, params); SurfaceControl surfaceControl = mSurfaceControlViewHost .getSurfacePackage().getSurfaceControl(); mMirrorViewLeash = mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(); int x = mMagnificationFrame.left - mMirrorSurfaceMargin; int y = mMagnificationFrame.top - mMirrorSurfaceMargin; mTransaction .setCrop(surfaceControl, new Rect(0, 0, windowWidth, windowHeight)) .setPosition(surfaceControl, x, y) .setLayer(surfaceControl, Integer.MAX_VALUE) .show(surfaceControl) .setCrop(mMirrorViewLeash, new Rect(0, 0, windowWidth, windowHeight)) .setPosition(mMirrorViewLeash, x, y) .setLayer(mMirrorViewLeash, Integer.MAX_VALUE) .show(mMirrorViewLeash) .apply(); mMirrorViewBounds.set(x, y, x + windowWidth, y + windowHeight); AccessibilityManager accessibilityManager = mContext .getSystemService(AccessibilityManager.class); accessibilityManager.attachAccessibilityOverlayToDisplay(mDisplayId, surfaceControl); accessibilityManager.attachAccessibilityOverlayToDisplay(mDisplayId, mMirrorViewLeash); SurfaceHolder holder = mMirrorSurfaceView.getHolder(); holder.addCallback(this); Loading Loading @@ -964,13 +974,11 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold params.width = width; params.height = height; mSurfaceControlViewHost.relayout(params); mTransaction.setCrop(mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(), new Rect(0, 0, width, height)); mTransaction.setCrop(mMirrorViewLeash, new Rect(0, 0, width, height)); } mMirrorViewBounds.set(x, y, x + width, y + height); mTransaction.setPosition( mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(), x, y); mTransaction.setPosition(mMirrorViewLeash, x, y); if (computeWindowSize) { mSurfaceControlViewHost.getRootSurfaceControl().applyTransactionOnDraw(mTransaction); } else { Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa import static com.android.server.accessibility.AccessibilityUserState.doesShortcutTargetsStringContain; import static com.android.server.pm.UserManagerService.enforceCurrentUserIfVisibleBackgroundEnabled; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import static com.android.window.flags.Flags.scvhSurfaceControlLifetimeFix; import android.accessibilityservice.AccessibilityGestureEvent; import android.accessibilityservice.AccessibilityService; Loading Loading @@ -6788,6 +6789,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub result = AccessibilityService.OVERLAY_RESULT_SUCCESS; } if (scvhSurfaceControlLifetimeFix()) { sc.release(); } if (callback != null) { // Send the result back to the service. try { Loading Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +20 −12 Original line number Diff line number Diff line Loading @@ -169,6 +169,11 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold */ private SurfaceControlViewHost mSurfaceControlViewHost; /** * The SurfaceControl provided by SurfaceControlViewHost. */ private SurfaceControl mMirrorViewLeash; // The root of the mirrored content private SurfaceControl mMirrorSurface; Loading Loading @@ -469,6 +474,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mSurfaceControlViewHost = null; } if (mMirrorViewLeash != null) { mTransaction.reparent(mMirrorViewLeash, null).apply(); mMirrorViewLeash.release(); mMirrorViewLeash = null; } mMirrorViewBounds.setEmpty(); mSourceBounds.setEmpty(); updateSystemUIStateIfNeeded(); Loading Loading @@ -659,23 +670,22 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mSurfaceControlViewHost = mScvhSupplier.get(); mSurfaceControlViewHost.setView(mMirrorView, params); SurfaceControl surfaceControl = mSurfaceControlViewHost .getSurfacePackage().getSurfaceControl(); mMirrorViewLeash = mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(); int x = mMagnificationFrame.left - mMirrorSurfaceMargin; int y = mMagnificationFrame.top - mMirrorSurfaceMargin; mTransaction .setCrop(surfaceControl, new Rect(0, 0, windowWidth, windowHeight)) .setPosition(surfaceControl, x, y) .setLayer(surfaceControl, Integer.MAX_VALUE) .show(surfaceControl) .setCrop(mMirrorViewLeash, new Rect(0, 0, windowWidth, windowHeight)) .setPosition(mMirrorViewLeash, x, y) .setLayer(mMirrorViewLeash, Integer.MAX_VALUE) .show(mMirrorViewLeash) .apply(); mMirrorViewBounds.set(x, y, x + windowWidth, y + windowHeight); AccessibilityManager accessibilityManager = mContext .getSystemService(AccessibilityManager.class); accessibilityManager.attachAccessibilityOverlayToDisplay(mDisplayId, surfaceControl); accessibilityManager.attachAccessibilityOverlayToDisplay(mDisplayId, mMirrorViewLeash); SurfaceHolder holder = mMirrorSurfaceView.getHolder(); holder.addCallback(this); Loading Loading @@ -964,13 +974,11 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold params.width = width; params.height = height; mSurfaceControlViewHost.relayout(params); mTransaction.setCrop(mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(), new Rect(0, 0, width, height)); mTransaction.setCrop(mMirrorViewLeash, new Rect(0, 0, width, height)); } mMirrorViewBounds.set(x, y, x + width, y + height); mTransaction.setPosition( mSurfaceControlViewHost.getSurfacePackage().getSurfaceControl(), x, y); mTransaction.setPosition(mMirrorViewLeash, x, y); if (computeWindowSize) { mSurfaceControlViewHost.getRootSurfaceControl().applyTransactionOnDraw(mTransaction); } else { Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import static com.android.internal.util.function.pooled.PooledLambda.obtainMessa import static com.android.server.accessibility.AccessibilityUserState.doesShortcutTargetsStringContain; import static com.android.server.pm.UserManagerService.enforceCurrentUserIfVisibleBackgroundEnabled; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import static com.android.window.flags.Flags.scvhSurfaceControlLifetimeFix; import android.accessibilityservice.AccessibilityGestureEvent; import android.accessibilityservice.AccessibilityService; Loading Loading @@ -6788,6 +6789,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub result = AccessibilityService.OVERLAY_RESULT_SUCCESS; } if (scvhSurfaceControlLifetimeFix()) { sc.release(); } if (callback != null) { // Send the result back to the service. try { Loading