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.IWindowMagnificationConnectionCallback;
22 import android.view.accessibility.IRemoteMagnificationAnimationCallback;
23 
24 /**
25  * Interface for interaction between {@link AccessibilityManagerService}
26  * and {@link WindowMagnification} in SystemUI.
27  *
28  * @hide
29  */
30 oneway interface IWindowMagnificationConnection {
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 callback The callback called when the animation is completed or interrupted.
42      */
enableWindowMagnification(int displayId, float scale, float centerX, float centerY, in IRemoteMagnificationAnimationCallback callback)43     void enableWindowMagnification(int displayId, float scale, float centerX, float centerY,
44         in IRemoteMagnificationAnimationCallback callback);
45 
46     /**
47      * Sets the scale of the window magnifier on specified display.
48      *
49      * @param displayId The logical display id.
50      * @param scale magnification scale.
51      */
setScale(int displayId, float scale)52     void setScale(int displayId, float scale);
53 
54      /**
55      * Disables window magnification on specified display with animation.
56      *
57      * @param displayId The logical display id.
58      * @param callback The callback called when the animation is completed or interrupted.
59      */
disableWindowMagnification(int displayId, in IRemoteMagnificationAnimationCallback callback)60     void disableWindowMagnification(int displayId,
61         in IRemoteMagnificationAnimationCallback callback);
62 
63     /**
64      * Moves the window magnifier on the specified display. It has no effect while animating.
65      *
66      * @param offsetX the amount in pixels to offset the window magnifier in the X direction, in
67      *                current screen pixels.
68      * @param offsetY the amount in pixels to offset the window magnifier in the Y direction, in
69      *                current screen pixels.
70      */
moveWindowMagnifier(int displayId, float offsetX, float offsetY)71     void moveWindowMagnifier(int displayId, float offsetX, float offsetY);
72 
73     /**
74      * Requests System UI show magnification mode button UI on the specified display.
75      *
76      * @param displayId The logical display id.
77      * @param magnificationMode the current magnification mode.
78      */
showMagnificationButton(int displayId, int magnificationMode)79     void showMagnificationButton(int displayId, int magnificationMode);
80 
81     /**
82      * Requests System UI remove magnification mode button UI on the specified display.
83      *
84      * @param displayId The logical display id.
85      */
removeMagnificationButton(int displayId)86     void removeMagnificationButton(int displayId);
87 
88     /**
89      * Sets {@link IWindowMagnificationConnectionCallback} to receive the request or the callback.
90      *
91      * @param callback the interface to be called.
92      */
setConnectionCallback(in IWindowMagnificationConnectionCallback callback)93     void setConnectionCallback(in IWindowMagnificationConnectionCallback callback);
94 }
95