Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3143,6 +3143,7 @@ package android.accessibilityservice { public static interface AccessibilityService.MagnificationController.OnMagnificationChangedListener { method public void onMagnificationChanged(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController, @NonNull android.graphics.Region, float, float, float); method public default void onMagnificationChanged(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController, @NonNull android.graphics.Region, @NonNull android.accessibilityservice.MagnificationConfig); } public static final class AccessibilityService.ScreenshotResult { core/java/android/accessibilityservice/AccessibilityService.java +52 −25 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ public abstract class AccessibilityService extends Service { boolean onKeyEvent(KeyEvent event); /** Magnification changed callbacks for different displays */ void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY); MagnificationConfig config); /** Callbacks for receiving motion events. */ void onMotionEvent(MotionEvent event); /** Callback for tuch state changes. */ Loading Loading @@ -1183,14 +1183,14 @@ public abstract class AccessibilityService extends Service { } } private void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { private void onMagnificationChanged(int displayId, @NonNull Region region, MagnificationConfig config) { MagnificationController controller; synchronized (mLock) { controller = mMagnificationControllers.get(displayId); } if (controller != null) { controller.dispatchMagnificationChanged(region, scale, centerX, centerY); controller.dispatchMagnificationChanged(region, config); } } Loading Loading @@ -1328,8 +1328,8 @@ public abstract class AccessibilityService extends Service { * Dispatches magnification changes to any registered listeners. This * should be called on the service's main thread. */ void dispatchMagnificationChanged(final @NonNull Region region, final float scale, final float centerX, final float centerY) { void dispatchMagnificationChanged(final @NonNull Region region, final MagnificationConfig config) { final ArrayMap<OnMagnificationChangedListener, Handler> entries; synchronized (mLock) { if (mListeners == null || mListeners.isEmpty()) { Loading @@ -1348,16 +1348,13 @@ public abstract class AccessibilityService extends Service { final OnMagnificationChangedListener listener = entries.keyAt(i); final Handler handler = entries.valueAt(i); if (handler != null) { handler.post(new Runnable() { @Override public void run() { handler.post(() -> { listener.onMagnificationChanged(MagnificationController.this, region, scale, centerX, centerY); } region, config); }); } else { // We're already on the main thread, just run the listener. listener.onMagnificationChanged(this, region, scale, centerX, centerY); listener.onMagnificationChanged(this, region, config); } } } Loading Loading @@ -1665,6 +1662,10 @@ public abstract class AccessibilityService extends Service { public interface OnMagnificationChangedListener { /** * Called when the magnified region, scale, or center changes. * <p> * <strong>Note:</strong> This legacy callback notifies only full-screen * magnification change. * </p> * * @param controller the magnification controller * @param region the magnification region Loading @@ -1676,6 +1677,38 @@ public abstract class AccessibilityService extends Service { */ void onMagnificationChanged(@NonNull MagnificationController controller, @NonNull Region region, float scale, float centerX, float centerY); /** * Called when the magnified region, mode, scale, or center changes of * all magnification modes. * <p> * <strong>Note:</strong> This method can be overridden to listen to the * magnification changes of all magnification modes then the legacy callback * would not receive the notifications. * Skipping calling super when overriding this method results in * {@link #onMagnificationChanged(MagnificationController, Region, float, float, float)} * not getting called. * </p> * * @param controller the magnification controller * @param region the magnification region * If the config mode is * {@link MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN}, * it is the region of the screen currently active for magnification. * that is the same region as {@link #getMagnificationRegion()}. * If the config mode is * {@link MagnificationConfig#MAGNIFICATION_MODE_WINDOW}, * it is the region of screen projected on the magnification window. * @param config The magnification config. That has the controlling magnification * mode, the new scale and the new screen-relative center position */ default void onMagnificationChanged(@NonNull MagnificationController controller, @NonNull Region region, @NonNull MagnificationConfig config) { if (config.getMode() == MAGNIFICATION_MODE_FULLSCREEN) { onMagnificationChanged(controller, region, config.getScale(), config.getCenterX(), config.getCenterY()); } } } } Loading Loading @@ -2449,9 +2482,8 @@ public abstract class AccessibilityService extends Service { @Override public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { AccessibilityService.this.onMagnificationChanged(displayId, region, scale, centerX, centerY); MagnificationConfig config) { AccessibilityService.this.onMagnificationChanged(displayId, region, config); } @Override Loading Loading @@ -2575,12 +2607,10 @@ public abstract class AccessibilityService extends Service { /** Magnification changed callbacks for different displays */ public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { MagnificationConfig config) { final SomeArgs args = SomeArgs.obtain(); args.arg1 = region; args.arg2 = scale; args.arg3 = centerX; args.arg4 = centerY; args.arg2 = config; args.argi1 = displayId; final Message message = mCaller.obtainMessageO(DO_ON_MAGNIFICATION_CHANGED, args); Loading Loading @@ -2739,13 +2769,10 @@ public abstract class AccessibilityService extends Service { if (mConnectionId != AccessibilityInteractionClient.NO_ID) { final SomeArgs args = (SomeArgs) message.obj; final Region region = (Region) args.arg1; final float scale = (float) args.arg2; final float centerX = (float) args.arg3; final float centerY = (float) args.arg4; final MagnificationConfig config = (MagnificationConfig) args.arg2; final int displayId = args.argi1; args.recycle(); mCallback.onMagnificationChanged(displayId, region, scale, centerX, centerY); mCallback.onMagnificationChanged(displayId, region, config); } return; } Loading core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.graphics.Region; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityWindowInfo; import android.accessibilityservice.AccessibilityGestureEvent; import android.accessibilityservice.MagnificationConfig; import android.view.KeyEvent; import android.view.MotionEvent; Loading @@ -43,7 +44,7 @@ import android.view.MotionEvent; void onKeyEvent(in KeyEvent event, int sequence); void onMagnificationChanged(int displayId, in Region region, float scale, float centerX, float centerY); void onMagnificationChanged(int displayId, in Region region, in MagnificationConfig config); void onMotionEvent(in MotionEvent event); Loading core/java/android/app/UiAutomation.java +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.accessibilityservice.AccessibilityService.IAccessibilityServiceCl import android.accessibilityservice.AccessibilityServiceInfo; import android.accessibilityservice.IAccessibilityServiceClient; import android.accessibilityservice.IAccessibilityServiceConnection; import android.accessibilityservice.MagnificationConfig; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -1581,7 +1582,7 @@ public final class UiAutomation { @Override public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { MagnificationConfig config) { /* do nothing */ } Loading packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +7 −3 Original line number Diff line number Diff line Loading @@ -252,7 +252,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mMagnificationFrame.height()); mTransaction.setGeometry(mMirrorSurface, mSourceBounds, mTmpRect, Surface.ROTATION_0).apply(); mWindowMagnifierCallback.onSourceBoundsChanged(mDisplayId, mSourceBounds); // Notify source bounds change when the magnifier is not animating. if (!mAnimationController.isAnimating()) { mWindowMagnifierCallback.onSourceBoundsChanged(mDisplayId, mSourceBounds); } } }; mUpdateStateDescriptionRunnable = () -> { Loading Loading @@ -596,7 +601,6 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold private void modifyWindowMagnification(SurfaceControl.Transaction t) { mSfVsyncFrameProvider.postFrameCallback(mMirrorViewGeometryVsyncCallback); updateMirrorViewLayout(); } /** Loading Loading @@ -800,7 +804,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold * are as same as current values, or the transition is interrupted * due to the new transition request. */ void enableWindowMagnification(float scale, float centerX, float centerY, public void enableWindowMagnification(float scale, float centerX, float centerY, float magnificationFrameOffsetRatioX, float magnificationFrameOffsetRatioY, @Nullable IRemoteMagnificationAnimationCallback animationCallback) { mAnimationController.enableWindowMagnification(scale, centerX, centerY, Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -3143,6 +3143,7 @@ package android.accessibilityservice { public static interface AccessibilityService.MagnificationController.OnMagnificationChangedListener { method public void onMagnificationChanged(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController, @NonNull android.graphics.Region, float, float, float); method public default void onMagnificationChanged(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController, @NonNull android.graphics.Region, @NonNull android.accessibilityservice.MagnificationConfig); } public static final class AccessibilityService.ScreenshotResult {
core/java/android/accessibilityservice/AccessibilityService.java +52 −25 Original line number Diff line number Diff line Loading @@ -588,7 +588,7 @@ public abstract class AccessibilityService extends Service { boolean onKeyEvent(KeyEvent event); /** Magnification changed callbacks for different displays */ void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY); MagnificationConfig config); /** Callbacks for receiving motion events. */ void onMotionEvent(MotionEvent event); /** Callback for tuch state changes. */ Loading Loading @@ -1183,14 +1183,14 @@ public abstract class AccessibilityService extends Service { } } private void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { private void onMagnificationChanged(int displayId, @NonNull Region region, MagnificationConfig config) { MagnificationController controller; synchronized (mLock) { controller = mMagnificationControllers.get(displayId); } if (controller != null) { controller.dispatchMagnificationChanged(region, scale, centerX, centerY); controller.dispatchMagnificationChanged(region, config); } } Loading Loading @@ -1328,8 +1328,8 @@ public abstract class AccessibilityService extends Service { * Dispatches magnification changes to any registered listeners. This * should be called on the service's main thread. */ void dispatchMagnificationChanged(final @NonNull Region region, final float scale, final float centerX, final float centerY) { void dispatchMagnificationChanged(final @NonNull Region region, final MagnificationConfig config) { final ArrayMap<OnMagnificationChangedListener, Handler> entries; synchronized (mLock) { if (mListeners == null || mListeners.isEmpty()) { Loading @@ -1348,16 +1348,13 @@ public abstract class AccessibilityService extends Service { final OnMagnificationChangedListener listener = entries.keyAt(i); final Handler handler = entries.valueAt(i); if (handler != null) { handler.post(new Runnable() { @Override public void run() { handler.post(() -> { listener.onMagnificationChanged(MagnificationController.this, region, scale, centerX, centerY); } region, config); }); } else { // We're already on the main thread, just run the listener. listener.onMagnificationChanged(this, region, scale, centerX, centerY); listener.onMagnificationChanged(this, region, config); } } } Loading Loading @@ -1665,6 +1662,10 @@ public abstract class AccessibilityService extends Service { public interface OnMagnificationChangedListener { /** * Called when the magnified region, scale, or center changes. * <p> * <strong>Note:</strong> This legacy callback notifies only full-screen * magnification change. * </p> * * @param controller the magnification controller * @param region the magnification region Loading @@ -1676,6 +1677,38 @@ public abstract class AccessibilityService extends Service { */ void onMagnificationChanged(@NonNull MagnificationController controller, @NonNull Region region, float scale, float centerX, float centerY); /** * Called when the magnified region, mode, scale, or center changes of * all magnification modes. * <p> * <strong>Note:</strong> This method can be overridden to listen to the * magnification changes of all magnification modes then the legacy callback * would not receive the notifications. * Skipping calling super when overriding this method results in * {@link #onMagnificationChanged(MagnificationController, Region, float, float, float)} * not getting called. * </p> * * @param controller the magnification controller * @param region the magnification region * If the config mode is * {@link MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN}, * it is the region of the screen currently active for magnification. * that is the same region as {@link #getMagnificationRegion()}. * If the config mode is * {@link MagnificationConfig#MAGNIFICATION_MODE_WINDOW}, * it is the region of screen projected on the magnification window. * @param config The magnification config. That has the controlling magnification * mode, the new scale and the new screen-relative center position */ default void onMagnificationChanged(@NonNull MagnificationController controller, @NonNull Region region, @NonNull MagnificationConfig config) { if (config.getMode() == MAGNIFICATION_MODE_FULLSCREEN) { onMagnificationChanged(controller, region, config.getScale(), config.getCenterX(), config.getCenterY()); } } } } Loading Loading @@ -2449,9 +2482,8 @@ public abstract class AccessibilityService extends Service { @Override public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { AccessibilityService.this.onMagnificationChanged(displayId, region, scale, centerX, centerY); MagnificationConfig config) { AccessibilityService.this.onMagnificationChanged(displayId, region, config); } @Override Loading Loading @@ -2575,12 +2607,10 @@ public abstract class AccessibilityService extends Service { /** Magnification changed callbacks for different displays */ public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { MagnificationConfig config) { final SomeArgs args = SomeArgs.obtain(); args.arg1 = region; args.arg2 = scale; args.arg3 = centerX; args.arg4 = centerY; args.arg2 = config; args.argi1 = displayId; final Message message = mCaller.obtainMessageO(DO_ON_MAGNIFICATION_CHANGED, args); Loading Loading @@ -2739,13 +2769,10 @@ public abstract class AccessibilityService extends Service { if (mConnectionId != AccessibilityInteractionClient.NO_ID) { final SomeArgs args = (SomeArgs) message.obj; final Region region = (Region) args.arg1; final float scale = (float) args.arg2; final float centerX = (float) args.arg3; final float centerY = (float) args.arg4; final MagnificationConfig config = (MagnificationConfig) args.arg2; final int displayId = args.argi1; args.recycle(); mCallback.onMagnificationChanged(displayId, region, scale, centerX, centerY); mCallback.onMagnificationChanged(displayId, region, config); } return; } Loading
core/java/android/accessibilityservice/IAccessibilityServiceClient.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.graphics.Region; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityWindowInfo; import android.accessibilityservice.AccessibilityGestureEvent; import android.accessibilityservice.MagnificationConfig; import android.view.KeyEvent; import android.view.MotionEvent; Loading @@ -43,7 +44,7 @@ import android.view.MotionEvent; void onKeyEvent(in KeyEvent event, int sequence); void onMagnificationChanged(int displayId, in Region region, float scale, float centerX, float centerY); void onMagnificationChanged(int displayId, in Region region, in MagnificationConfig config); void onMotionEvent(in MotionEvent event); Loading
core/java/android/app/UiAutomation.java +2 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.accessibilityservice.AccessibilityService.IAccessibilityServiceCl import android.accessibilityservice.AccessibilityServiceInfo; import android.accessibilityservice.IAccessibilityServiceClient; import android.accessibilityservice.IAccessibilityServiceConnection; import android.accessibilityservice.MagnificationConfig; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; Loading Loading @@ -1581,7 +1582,7 @@ public final class UiAutomation { @Override public void onMagnificationChanged(int displayId, @NonNull Region region, float scale, float centerX, float centerY) { MagnificationConfig config) { /* do nothing */ } Loading
packages/SystemUI/src/com/android/systemui/accessibility/WindowMagnificationController.java +7 −3 Original line number Diff line number Diff line Loading @@ -252,7 +252,12 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold mMagnificationFrame.height()); mTransaction.setGeometry(mMirrorSurface, mSourceBounds, mTmpRect, Surface.ROTATION_0).apply(); mWindowMagnifierCallback.onSourceBoundsChanged(mDisplayId, mSourceBounds); // Notify source bounds change when the magnifier is not animating. if (!mAnimationController.isAnimating()) { mWindowMagnifierCallback.onSourceBoundsChanged(mDisplayId, mSourceBounds); } } }; mUpdateStateDescriptionRunnable = () -> { Loading Loading @@ -596,7 +601,6 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold private void modifyWindowMagnification(SurfaceControl.Transaction t) { mSfVsyncFrameProvider.postFrameCallback(mMirrorViewGeometryVsyncCallback); updateMirrorViewLayout(); } /** Loading Loading @@ -800,7 +804,7 @@ class WindowMagnificationController implements View.OnTouchListener, SurfaceHold * are as same as current values, or the transition is interrupted * due to the new transition request. */ void enableWindowMagnification(float scale, float centerX, float centerY, public void enableWindowMagnification(float scale, float centerX, float centerY, float magnificationFrameOffsetRatioX, float magnificationFrameOffsetRatioY, @Nullable IRemoteMagnificationAnimationCallback animationCallback) { mAnimationController.enableWindowMagnification(scale, centerX, centerY, Loading