1 /* 2 * Copyright (C) 2019 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.view.accessibility; 18 19 import android.graphics.PointF; 20 import android.graphics.Rect; 21 import android.view.accessibility.IMagnificationConnectionCallback; 22 import android.view.accessibility.IRemoteMagnificationAnimationCallback; 23 24 /** 25 * Interface for interaction between {@link AccessibilityManagerService} 26 * and {@link Magnification} in SystemUI. 27 * 28 * @hide 29 */ 30 oneway interface IMagnificationConnection { 31 32 /** 33 * Enables window magnification on specified display with given center and scale and animation. 34 * 35 * @param displayId the logical display id. 36 * @param scale magnification scale. 37 * @param centerX the screen-relative X coordinate around which to center, 38 * or {@link Float#NaN} to leave unchanged. 39 * @param centerY the screen-relative Y coordinate around which to center, 40 * or {@link Float#NaN} to leave unchanged. 41 * @param magnificationFrameOffsetRatioX Indicate the X coordinate offset between 42 * frame position X and centerX 43 * @param magnificationFrameOffsetRatioY Indicate the Y coordinate offset between 44 * frame position Y and centerY 45 * @param callback The callback called when the animation is completed or interrupted. 46 */ enableWindowMagnification(int displayId, float scale, float centerX, float centerY, float magnificationFrameOffsetRatioX, float magnificationFrameOffsetRatioY, in IRemoteMagnificationAnimationCallback callback)47 void enableWindowMagnification(int displayId, float scale, float centerX, float centerY, 48 float magnificationFrameOffsetRatioX, float magnificationFrameOffsetRatioY, 49 in IRemoteMagnificationAnimationCallback callback); 50 51 /** 52 * Sets the scale of the window magnifier on specified display. 53 * 54 * @param displayId the logical display id. 55 * @param scale magnification scale. 56 */ setScaleForWindowMagnification(int displayId, float scale)57 void setScaleForWindowMagnification(int displayId, float scale); 58 59 /** 60 * Disables window magnification on specified display with animation. 61 * 62 * @param displayId the logical display id. 63 * @param callback The callback called when the animation is completed or interrupted. 64 */ disableWindowMagnification(int displayId, in IRemoteMagnificationAnimationCallback callback)65 void disableWindowMagnification(int displayId, 66 in IRemoteMagnificationAnimationCallback callback); 67 68 /** 69 * Moves the window magnifier on the specified display. It has no effect while animating. 70 * 71 * @param displayId the logical display id. 72 * @param offsetX the amount in pixels to offset the window magnifier in the X direction, in 73 * current screen pixels. 74 * @param offsetY the amount in pixels to offset the window magnifier in the Y direction, in 75 * current screen pixels. 76 */ moveWindowMagnifier(int displayId, float offsetX, float offsetY)77 void moveWindowMagnifier(int displayId, float offsetX, float offsetY); 78 79 /** 80 * Moves the window magnifier on the given display. 81 * 82 * @param displayId the logical display id. 83 * @param positionX the x-axis position of the center of the magnified source bounds. 84 * @param positionY the y-axis position of the center of the magnified source bounds. 85 * @param callback the callback called when the animation is completed or interrupted. 86 */ moveWindowMagnifierToPosition(int displayId, float positionX, float positionY, in IRemoteMagnificationAnimationCallback callback)87 void moveWindowMagnifierToPosition(int displayId, float positionX, float positionY, 88 in IRemoteMagnificationAnimationCallback callback); 89 90 /** 91 * Requests System UI show magnification mode button UI on the specified display. 92 * 93 * @param displayId the logical display id. 94 * @param magnificationMode the current magnification mode. 95 */ showMagnificationButton(int displayId, int magnificationMode)96 void showMagnificationButton(int displayId, int magnificationMode); 97 98 /** 99 * Requests System UI remove magnification mode button UI on the specified display. 100 * 101 * @param displayId the logical display id. 102 */ removeMagnificationButton(int displayId)103 void removeMagnificationButton(int displayId); 104 105 /** 106 * Requests System UI remove magnification settings panel on the specified display. 107 * 108 * @param displayId the logical display id. 109 */ removeMagnificationSettingsPanel(int displayId)110 void removeMagnificationSettingsPanel(int displayId); 111 112 /** 113 * Sets {@link IMagnificationConnectionCallback} to receive the request or the callback. 114 * 115 * @param callback the interface to be called. 116 */ setConnectionCallback(in IMagnificationConnectionCallback callback)117 void setConnectionCallback(in IMagnificationConnectionCallback callback); 118 119 /** 120 * Notify System UI the magnification scale on the specified display for userId is changed. 121 * 122 * @param userId the user id. 123 * @param displayId the logical display id. 124 * @param scale magnification scale. 125 */ onUserMagnificationScaleChanged(int userId, int displayId, float scale)126 void onUserMagnificationScaleChanged(int userId, int displayId, float scale); 127 128 /** 129 * Notify the changes of fullscreen magnification activation on the specified display 130 */ onFullscreenMagnificationActivationChanged(int displayId, boolean activated)131 void onFullscreenMagnificationActivationChanged(int displayId, boolean activated); 132 } 133