1 /* 2 * Copyright (C) 2020 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 com.android.systemui.accessibility; 18 19 import static com.android.systemui.accessibility.WindowMagnificationSettings.MagnificationSize; 20 21 import android.graphics.Rect; 22 23 /** 24 * A callback to inform {@link com.android.server.accessibility.AccessibilityManagerService} about 25 * the UI state change or the user interaction. 26 */ 27 interface WindowMagnifierCallback { 28 /** 29 * Called when the bounds of window magnifier is changed. 30 * @param displayId The logical display id. 31 * @param bounds The bounds of window magnifier on the screen. 32 */ onWindowMagnifierBoundsChanged(int displayId, Rect bounds)33 void onWindowMagnifierBoundsChanged(int displayId, Rect bounds); 34 35 /** 36 * Called when the magnified bounds is changed. 37 * 38 * @param displayId The logical display id. 39 * @param sourceBounds The magnified bounds in screen coordinates. 40 */ onSourceBoundsChanged(int displayId, Rect sourceBounds)41 void onSourceBoundsChanged(int displayId, Rect sourceBounds); 42 43 /** 44 * Called when the accessibility action of scale requests to be performed. 45 * It is invoked from System UI. And the action is provided by the mirror window. 46 * 47 * @param displayId The logical display id. 48 * @param scale the target scale, or {@link Float#NaN} to leave unchanged 49 * @param updatePersistence whether the scale should be persisted 50 */ onPerformScaleAction(int displayId, float scale, boolean updatePersistence)51 void onPerformScaleAction(int displayId, float scale, boolean updatePersistence); 52 53 /** 54 * Called when the accessibility action is performed. 55 * 56 * @param displayId The logical display id. 57 */ onAccessibilityActionPerformed(int displayId)58 void onAccessibilityActionPerformed(int displayId); 59 60 /** 61 * Called when the user is performing a move action. 62 * 63 * @param displayId The logical display id. 64 */ onMove(int displayId)65 void onMove(int displayId); 66 67 /** 68 * Called when magnification settings button clicked. 69 * 70 * @param displayId The logical display id. 71 */ onClickSettingsButton(int displayId)72 void onClickSettingsButton(int displayId); 73 74 /** 75 * Called when restoring the magnification window size. 76 */ onWindowMagnifierBoundsRestored(int displayId, @MagnificationSize int index)77 void onWindowMagnifierBoundsRestored(int displayId, @MagnificationSize int index); 78 } 79