blob: 14dc35646539801d04745e7336776214c3de99c1 [file] [log] [blame]
Jeff Brown4ccb8232014-01-16 22:16:42 -08001/*
2 * Copyright (C) 2014 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
17package android.view;
18
Svetoslav8e3feb12014-02-24 13:46:47 -080019import android.graphics.Rect;
20import android.graphics.Region;
Jeff Brown4ccb8232014-01-16 22:16:42 -080021import android.hardware.display.DisplayManagerInternal;
Svetoslav8e3feb12014-02-24 13:46:47 -080022import android.os.IBinder;
23
24import java.util.List;
Jeff Brown4ccb8232014-01-16 22:16:42 -080025
26/**
27 * Window manager local system service interface.
28 *
29 * @hide Only for use within the system server.
30 */
31public abstract class WindowManagerInternal {
Svetoslav8e3feb12014-02-24 13:46:47 -080032
33 /**
34 * Interface to receive a callback when the windows reported for
35 * accessibility changed.
36 */
37 public interface WindowsForAccessibilityCallback {
38
39 /**
40 * Called when the windows for accessibility changed.
41 *
42 * @param windows The windows for accessibility.
43 */
44 public void onWindowsForAccessibilityChanged(List<WindowInfo> windows);
45 }
46
47 /**
48 * Callbacks for contextual changes that affect the screen magnification
49 * feature.
50 */
51 public interface MagnificationCallbacks {
52
53 /**
54 * Called when the bounds of the screen content that is magnified changed.
55 * Note that not the entire screen is magnified.
56 *
57 * @param bounds The bounds.
58 */
59 public void onMagnifedBoundsChanged(Region bounds);
60
61 /**
62 * Called when an application requests a rectangle on the screen to allow
63 * the client to apply the appropriate pan and scale.
64 *
65 * @param left The rectangle left.
66 * @param top The rectangle top.
67 * @param right The rectangle right.
68 * @param bottom The rectangle bottom.
69 */
70 public void onRectangleOnScreenRequested(int left, int top, int right, int bottom);
71
72 /**
73 * Notifies that the rotation changed.
74 *
75 * @param rotation The current rotation.
76 */
77 public void onRotationChanged(int rotation);
78
79 /**
80 * Notifies that the context of the user changed. For example, an application
81 * was started.
82 */
83 public void onUserContextChanged();
84 }
85
Jeff Brown4ccb8232014-01-16 22:16:42 -080086 /**
87 * Request that the window manager call
88 * {@link DisplayManagerInternal#performTraversalInTransactionFromWindowManager}
89 * within a surface transaction at a later time.
90 */
91 public abstract void requestTraversalFromDisplayManager();
Svetoslav8e3feb12014-02-24 13:46:47 -080092
93 /**
94 * Set by the accessibility layer to observe changes in the magnified region,
95 * rotation, and other window transformations related to display magnification
96 * as the window manager is responsible for doing the actual magnification
97 * and has access to the raw window data while the accessibility layer serves
98 * as a controller.
99 *
100 * @param callbacks The callbacks to invoke.
101 */
102 public abstract void setMagnificationCallbacks(MagnificationCallbacks callbacks);
103
104 /**
105 * Set by the accessibility layer to specify the magnification and panning to
106 * be applied to all windows that should be magnified.
107 *
108 * @param callbacks The callbacks to invoke.
109 *
110 * @see #setMagnificationCallbacks(MagnificationCallbacks)
111 */
112 public abstract void setMagnificationSpec(MagnificationSpec spec);
113
114 /**
115 * Gets the magnification and translation applied to a window given its token.
116 * Not all windows are magnified and the window manager policy determines which
117 * windows are magnified. The returned result also takes into account the compat
118 * scale if necessary.
119 *
120 * @param windowToken The window's token.
121 *
122 * @return The magnification spec for the window.
123 *
124 * @see #setMagnificationCallbacks(MagnificationCallbacks)
125 */
126 public abstract MagnificationSpec getCompatibleMagnificationSpecForWindow(
127 IBinder windowToken);
128
129 /**
130 * Sets a callback for observing which windows are touchable for the purposes
131 * of accessibility.
132 *
133 * @param callback The callback.
134 */
135 public abstract void setWindowsForAccessibilityCallback(
136 WindowsForAccessibilityCallback callback);
137
138 /**
139 * Sets a filter for manipulating the input event stream.
140 *
141 * @param filter The filter implementation.
142 */
143 public abstract void setInputFilter(IInputFilter filter);
144
145 /**
146 * Gets the token of the window that has input focus.
147 *
148 * @return The token.
149 */
150 public abstract IBinder getFocusedWindowToken();
151
152 /**
153 * @return Whether the keyguard is engaged.
154 */
155 public abstract boolean isKeyguardLocked();
156
157 /**
158 * Gets the frame of a window given its token.
159 *
160 * @param token The token.
161 * @param outBounds The frame to populate.
162 */
163 public abstract void getWindowFrame(IBinder token, Rect outBounds);
164}