diff options
Diffstat (limited to 'core/java/android')
4 files changed, 144 insertions, 0 deletions
diff --git a/core/java/android/view/accessibility/AccessibilityManager.java b/core/java/android/view/accessibility/AccessibilityManager.java index 2e5a4b57da18..5e652460362c 100644 --- a/core/java/android/view/accessibility/AccessibilityManager.java +++ b/core/java/android/view/accessibility/AccessibilityManager.java @@ -1416,6 +1416,29 @@ public final class AccessibilityManager { return null; } + /** + * + * Sets an {@link IWindowMagnificationConnection} that manipulates window magnification. + * + * @param connection The connection that manipulates window magnification. + * @hide + */ + public void setWindowMagnificationConnection(@Nullable + IWindowMagnificationConnection connection) { + final IAccessibilityManager service; + synchronized (mLock) { + service = getServiceLocked(); + if (service == null) { + return; + } + } + try { + service.setWindowMagnificationConnection(connection); + } catch (RemoteException re) { + Log.e(LOG_TAG, "Error setting window magnfication connection", re); + } + } + private IAccessibilityManager getServiceLocked() { if (mService == null) { tryConnectToServiceLocked(null); diff --git a/core/java/android/view/accessibility/IAccessibilityManager.aidl b/core/java/android/view/accessibility/IAccessibilityManager.aidl index 392db574d988..28b42531c472 100644 --- a/core/java/android/view/accessibility/IAccessibilityManager.aidl +++ b/core/java/android/view/accessibility/IAccessibilityManager.aidl @@ -25,6 +25,7 @@ import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.accessibility.IAccessibilityInteractionConnection; import android.view.accessibility.IAccessibilityManagerClient; +import android.view.accessibility.IWindowMagnificationConnection; import android.view.IWindow; /** @@ -86,4 +87,5 @@ interface IAccessibilityManager { oneway void registerSystemAction(in RemoteAction action, int actionId); oneway void unregisterSystemAction(int actionId); + oneway void setWindowMagnificationConnection(in IWindowMagnificationConnection connection); } diff --git a/core/java/android/view/accessibility/IWindowMagnificationConnection.aidl b/core/java/android/view/accessibility/IWindowMagnificationConnection.aidl new file mode 100644 index 000000000000..0b45c6bed9bd --- /dev/null +++ b/core/java/android/view/accessibility/IWindowMagnificationConnection.aidl @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view.accessibility; + +import android.graphics.PointF; +import android.graphics.Rect; +import android.view.accessibility.IWindowMagnificationConnectionCallback; + +/** + * Interface for interaction between {@link AccessibilityManagerService} + * and {@link WindowMagnification} in SystemUI. + * + * @hide + */ +oneway interface IWindowMagnificationConnection { + + /** + * Enables window magnification on specifed display with specified center and scale. + * + * @param displayId The logical display id. + * @param scale magnification scale. + * @param centerX the screen-relative X coordinate around which to center, + * or {@link Float#NaN} to leave unchanged. + * @param centerY the screen-relative Y coordinate around which to center, + * or {@link Float#NaN} to leave unchanged. + */ + void enableWindowMagnification(int displayId, float scale, float centerX, float centerY); + + /** + * Sets the scale of the window magnifier on specifed display. + * + * @param displayId The logical display id. + * @param scale magnification scale. + */ + void setScale(int displayId, float scale); + + /** + * Disables window magnification on specifed display. + * + * @param displayId The logical display id. + */ + void disableWindowMagnification(int displayId); + + /** + * Moves the window magnifier on the specifed display. + * + * @param offsetX the amount in pixels to offset the window magnifier in the X direction, in + * current screen pixels. + * @param offsetY the amount in pixels to offset the window magnifier in the Y direction, in + * current screen pixels. + */ + void moveWindowMagnifier(int displayId, float offsetX, float offsetY); + + /** + * Sets {@link IWindowMagnificationConnectionCallback} to receive the request or the callback. + * + * + * @param callback the interface to be called. + */ + void setConnectionCallback(in IWindowMagnificationConnectionCallback callback); +} diff --git a/core/java/android/view/accessibility/IWindowMagnificationConnectionCallback.aidl b/core/java/android/view/accessibility/IWindowMagnificationConnectionCallback.aidl new file mode 100644 index 000000000000..7327bb571d59 --- /dev/null +++ b/core/java/android/view/accessibility/IWindowMagnificationConnectionCallback.aidl @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.view.accessibility; + +import android.graphics.Rect; + +/** + * interface to notify the change of the window magnifier bounds and request to change + * the magnification mode. + * + * @hide + */ + oneway interface IWindowMagnificationConnectionCallback { + + /** + * Called when the bounds of the window magnifier is changed. + * + * @param displayId The logical display id. + * @param bounds The window magnifier bounds in screen coordinates. + */ + void onWindowMagnifierBoundsChanged(int display, in Rect bounds); + /** + * Changes the magnification mode on specified display. It is invoked by System UI when the + * switch button is toggled. + * + * @param displayId The logical display id. + * @param magnificationMode new magnification mode. + */ + void onChangeMagnificationMode(int display, int magnificationMode); +} |
