blob: de4fd7cd06b54f1213abba0f468535bab198af8e [file] [log] [blame]
Svetoslav8e3feb12014-02-24 13:46:47 -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 com.android.server.wm;
18
Phil Weaverd321075e2017-06-13 09:13:35 -070019import static android.view.WindowManager.LayoutParams.TYPE_MAGNIFICATION_OVERLAY;
Robert Carr132c9f52017-07-31 17:02:30 -070020import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
Phil Weaverd321075e2017-06-13 09:13:35 -070021
Filip Gruszczynski0bd180d2015-12-07 15:43:52 -080022import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
23import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
24
Svetoslav8e3feb12014-02-24 13:46:47 -080025import android.animation.ObjectAnimator;
26import android.animation.ValueAnimator;
Alan Viverette59e53a12016-03-28 13:41:32 -040027import android.annotation.NonNull;
Svetoslav8e3feb12014-02-24 13:46:47 -080028import android.app.Service;
29import android.content.Context;
30import android.graphics.Canvas;
31import android.graphics.Color;
32import android.graphics.Matrix;
33import android.graphics.Paint;
34import android.graphics.Path;
35import android.graphics.PixelFormat;
36import android.graphics.Point;
37import android.graphics.PorterDuff.Mode;
38import android.graphics.Rect;
39import android.graphics.RectF;
40import android.graphics.Region;
41import android.os.Handler;
42import android.os.IBinder;
43import android.os.Looper;
44import android.os.Message;
Phil Weaver396d5492016-03-22 17:53:50 -070045import android.text.TextUtils;
Svetoslav8e3feb12014-02-24 13:46:47 -080046import android.util.ArraySet;
47import android.util.Log;
48import android.util.Slog;
49import android.util.SparseArray;
50import android.util.TypedValue;
51import android.view.MagnificationSpec;
52import android.view.Surface;
53import android.view.Surface.OutOfResourcesException;
54import android.view.SurfaceControl;
Svetoslavf7174e82014-06-12 11:29:35 -070055import android.view.ViewConfiguration;
Svetoslav8e3feb12014-02-24 13:46:47 -080056import android.view.WindowInfo;
57import android.view.WindowManager;
58import android.view.WindowManagerInternal.MagnificationCallbacks;
59import android.view.WindowManagerInternal.WindowsForAccessibilityCallback;
60import android.view.WindowManagerPolicy;
61import android.view.animation.DecelerateInterpolator;
62import android.view.animation.Interpolator;
63
64import com.android.internal.R;
65import com.android.internal.os.SomeArgs;
66
67import java.util.ArrayList;
Allen Hairf20ac2c2016-02-11 17:42:59 -080068import java.util.HashSet;
Svetoslav8e3feb12014-02-24 13:46:47 -080069import java.util.List;
70import java.util.Set;
71
72/**
73 * This class contains the accessibility related logic of the window manger.
74 */
75final class AccessibilityController {
76
Robert Carre625fcf2017-09-01 12:36:28 -070077 private final WindowManagerService mService;
Svetoslav8e3feb12014-02-24 13:46:47 -080078
79 private static final float[] sTempFloats = new float[9];
80
81 public AccessibilityController(WindowManagerService service) {
Robert Carre625fcf2017-09-01 12:36:28 -070082 mService = service;
Svetoslav8e3feb12014-02-24 13:46:47 -080083 }
84
85 private DisplayMagnifier mDisplayMagnifier;
86
87 private WindowsForAccessibilityObserver mWindowsForAccessibilityObserver;
88
89 public void setMagnificationCallbacksLocked(MagnificationCallbacks callbacks) {
90 if (callbacks != null) {
91 if (mDisplayMagnifier != null) {
92 throw new IllegalStateException("Magnification callbacks already set!");
93 }
Robert Carre625fcf2017-09-01 12:36:28 -070094 mDisplayMagnifier = new DisplayMagnifier(mService, callbacks);
Svetoslav8e3feb12014-02-24 13:46:47 -080095 } else {
96 if (mDisplayMagnifier == null) {
97 throw new IllegalStateException("Magnification callbacks already cleared!");
98 }
99 mDisplayMagnifier.destroyLocked();
100 mDisplayMagnifier = null;
101 }
102 }
103
104 public void setWindowsForAccessibilityCallback(WindowsForAccessibilityCallback callback) {
105 if (callback != null) {
106 if (mWindowsForAccessibilityObserver != null) {
107 throw new IllegalStateException(
108 "Windows for accessibility callback already set!");
109 }
110 mWindowsForAccessibilityObserver = new WindowsForAccessibilityObserver(
Robert Carre625fcf2017-09-01 12:36:28 -0700111 mService, callback);
Svetoslav8e3feb12014-02-24 13:46:47 -0800112 } else {
113 if (mWindowsForAccessibilityObserver == null) {
114 throw new IllegalStateException(
115 "Windows for accessibility callback already cleared!");
116 }
117 mWindowsForAccessibilityObserver = null;
118 }
119 }
120
Svetoslav Ganovfd138892016-07-13 18:20:42 -0700121 public void performComputeChangedWindowsNotLocked() {
122 WindowsForAccessibilityObserver observer = null;
Robert Carre625fcf2017-09-01 12:36:28 -0700123 synchronized (mService) {
Svetoslav Ganovfd138892016-07-13 18:20:42 -0700124 observer = mWindowsForAccessibilityObserver;
125 }
126 if (observer != null) {
127 observer.performComputeChangedWindowsNotLocked();
128 }
129 }
130
Svetoslav8e3feb12014-02-24 13:46:47 -0800131 public void setMagnificationSpecLocked(MagnificationSpec spec) {
132 if (mDisplayMagnifier != null) {
133 mDisplayMagnifier.setMagnificationSpecLocked(spec);
134 }
135 if (mWindowsForAccessibilityObserver != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700136 mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800137 }
138 }
139
Phil Weaver70439242016-03-10 15:15:49 -0800140 public void getMagnificationRegionLocked(Region outMagnificationRegion) {
Alan Viverette59e53a12016-03-28 13:41:32 -0400141 if (mDisplayMagnifier != null) {
Phil Weaver70439242016-03-10 15:15:49 -0800142 mDisplayMagnifier.getMagnificationRegionLocked(outMagnificationRegion);
Alan Viverette59e53a12016-03-28 13:41:32 -0400143 }
144 }
145
Svetoslavf7174e82014-06-12 11:29:35 -0700146 public void onRectangleOnScreenRequestedLocked(Rect rectangle) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800147 if (mDisplayMagnifier != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700148 mDisplayMagnifier.onRectangleOnScreenRequestedLocked(rectangle);
Svetoslav8e3feb12014-02-24 13:46:47 -0800149 }
150 // Not relevant for the window observer.
151 }
152
153 public void onWindowLayersChangedLocked() {
154 if (mDisplayMagnifier != null) {
155 mDisplayMagnifier.onWindowLayersChangedLocked();
156 }
157 if (mWindowsForAccessibilityObserver != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700158 mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800159 }
160 }
161
Andrii Kulian8ee72852017-03-10 10:36:45 -0800162 public void onRotationChangedLocked(DisplayContent displayContent) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800163 if (mDisplayMagnifier != null) {
Andrii Kulian8ee72852017-03-10 10:36:45 -0800164 mDisplayMagnifier.onRotationChangedLocked(displayContent);
Svetoslav8e3feb12014-02-24 13:46:47 -0800165 }
166 if (mWindowsForAccessibilityObserver != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700167 mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800168 }
169 }
170
171 public void onAppWindowTransitionLocked(WindowState windowState, int transition) {
172 if (mDisplayMagnifier != null) {
173 mDisplayMagnifier.onAppWindowTransitionLocked(windowState, transition);
174 }
175 // Not relevant for the window observer.
176 }
177
178 public void onWindowTransitionLocked(WindowState windowState, int transition) {
179 if (mDisplayMagnifier != null) {
180 mDisplayMagnifier.onWindowTransitionLocked(windowState, transition);
181 }
182 if (mWindowsForAccessibilityObserver != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700183 mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800184 }
185 }
186
Svetoslav3a0d8782014-12-04 12:50:11 -0800187 public void onWindowFocusChangedNotLocked() {
Svetoslav8e3feb12014-02-24 13:46:47 -0800188 // Not relevant for the display magnifier.
189
Svetoslav3a0d8782014-12-04 12:50:11 -0800190 WindowsForAccessibilityObserver observer = null;
Robert Carre625fcf2017-09-01 12:36:28 -0700191 synchronized (mService) {
Svetoslav3a0d8782014-12-04 12:50:11 -0800192 observer = mWindowsForAccessibilityObserver;
193 }
194 if (observer != null) {
195 observer.performComputeChangedWindowsNotLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800196 }
197 }
198
Svetoslav4604abc2014-06-10 18:59:30 -0700199
Svetoslavf7174e82014-06-12 11:29:35 -0700200 public void onSomeWindowResizedOrMovedLocked() {
Svetoslav4604abc2014-06-10 18:59:30 -0700201 // Not relevant for the display magnifier.
202
203 if (mWindowsForAccessibilityObserver != null) {
Svetoslavf7174e82014-06-12 11:29:35 -0700204 mWindowsForAccessibilityObserver.scheduleComputeChangedWindowsLocked();
Svetoslav4604abc2014-06-10 18:59:30 -0700205 }
206 }
207
Svetoslav8e3feb12014-02-24 13:46:47 -0800208 /** NOTE: This has to be called within a surface transaction. */
209 public void drawMagnifiedRegionBorderIfNeededLocked() {
210 if (mDisplayMagnifier != null) {
211 mDisplayMagnifier.drawMagnifiedRegionBorderIfNeededLocked();
212 }
213 // Not relevant for the window observer.
214 }
215
216 public MagnificationSpec getMagnificationSpecForWindowLocked(WindowState windowState) {
217 if (mDisplayMagnifier != null) {
218 return mDisplayMagnifier.getMagnificationSpecForWindowLocked(windowState);
219 }
220 return null;
221 }
222
223 public boolean hasCallbacksLocked() {
224 return (mDisplayMagnifier != null
225 || mWindowsForAccessibilityObserver != null);
226 }
227
Casey Burkhardt74922c62017-02-13 12:43:16 -0800228 public void setForceShowMagnifiableBoundsLocked(boolean show) {
229 if (mDisplayMagnifier != null) {
230 mDisplayMagnifier.setForceShowMagnifiableBoundsLocked(show);
Phil Weaver251db072017-03-28 08:35:38 -0700231 mDisplayMagnifier.showMagnificationBoundsIfNeeded();
Casey Burkhardt74922c62017-02-13 12:43:16 -0800232 }
233 }
234
Svetoslav8e3feb12014-02-24 13:46:47 -0800235 private static void populateTransformationMatrixLocked(WindowState windowState,
236 Matrix outMatrix) {
237 sTempFloats[Matrix.MSCALE_X] = windowState.mWinAnimator.mDsDx;
238 sTempFloats[Matrix.MSKEW_Y] = windowState.mWinAnimator.mDtDx;
Robert Carr0edf18f2017-02-21 20:01:47 -0800239 sTempFloats[Matrix.MSKEW_X] = windowState.mWinAnimator.mDtDy;
240 sTempFloats[Matrix.MSCALE_Y] = windowState.mWinAnimator.mDsDy;
Filip Gruszczynski2a6a2c22015-10-14 12:00:53 -0700241 sTempFloats[Matrix.MTRANS_X] = windowState.mShownPosition.x;
242 sTempFloats[Matrix.MTRANS_Y] = windowState.mShownPosition.y;
Svetoslav8e3feb12014-02-24 13:46:47 -0800243 sTempFloats[Matrix.MPERSP_0] = 0;
244 sTempFloats[Matrix.MPERSP_1] = 0;
245 sTempFloats[Matrix.MPERSP_2] = 1;
246 outMatrix.setValues(sTempFloats);
247 }
248
249 /**
250 * This class encapsulates the functionality related to display magnification.
251 */
252 private static final class DisplayMagnifier {
253
Filip Gruszczynski0bd180d2015-12-07 15:43:52 -0800254 private static final String LOG_TAG = TAG_WITH_CLASS_NAME ? "DisplayMagnifier" : TAG_WM;
Svetoslav8e3feb12014-02-24 13:46:47 -0800255
256 private static final boolean DEBUG_WINDOW_TRANSITIONS = false;
257 private static final boolean DEBUG_ROTATION = false;
258 private static final boolean DEBUG_LAYERS = false;
259 private static final boolean DEBUG_RECTANGLE_REQUESTED = false;
260 private static final boolean DEBUG_VIEWPORT_WINDOW = false;
261
262 private final Rect mTempRect1 = new Rect();
263 private final Rect mTempRect2 = new Rect();
264
265 private final Region mTempRegion1 = new Region();
266 private final Region mTempRegion2 = new Region();
267 private final Region mTempRegion3 = new Region();
268 private final Region mTempRegion4 = new Region();
269
270 private final Context mContext;
Robert Carre625fcf2017-09-01 12:36:28 -0700271 private final WindowManagerService mService;
Svetoslav8e3feb12014-02-24 13:46:47 -0800272 private final MagnifiedViewport mMagnifedViewport;
273 private final Handler mHandler;
274
275 private final MagnificationCallbacks mCallbacks;
276
277 private final long mLongAnimationDuration;
278
Casey Burkhardt74922c62017-02-13 12:43:16 -0800279 private boolean mForceShowMagnifiableBounds = false;
280
Svetoslav8e3feb12014-02-24 13:46:47 -0800281 public DisplayMagnifier(WindowManagerService windowManagerService,
282 MagnificationCallbacks callbacks) {
283 mContext = windowManagerService.mContext;
Robert Carre625fcf2017-09-01 12:36:28 -0700284 mService = windowManagerService;
Svetoslav8e3feb12014-02-24 13:46:47 -0800285 mCallbacks = callbacks;
Robert Carre625fcf2017-09-01 12:36:28 -0700286 mHandler = new MyHandler(mService.mH.getLooper());
Svetoslav8e3feb12014-02-24 13:46:47 -0800287 mMagnifedViewport = new MagnifiedViewport();
288 mLongAnimationDuration = mContext.getResources().getInteger(
289 com.android.internal.R.integer.config_longAnimTime);
290 }
291
292 public void setMagnificationSpecLocked(MagnificationSpec spec) {
293 mMagnifedViewport.updateMagnificationSpecLocked(spec);
294 mMagnifedViewport.recomputeBoundsLocked();
Robert Carre625fcf2017-09-01 12:36:28 -0700295 mService.scheduleAnimationLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800296 }
297
Casey Burkhardt74922c62017-02-13 12:43:16 -0800298 public void setForceShowMagnifiableBoundsLocked(boolean show) {
299 mForceShowMagnifiableBounds = show;
300 mMagnifedViewport.setMagnifiedRegionBorderShownLocked(show, true);
301 }
302
303 public boolean isForceShowingMagnifiableBoundsLocked() {
304 return mForceShowMagnifiableBounds;
305 }
306
Svetoslavf7174e82014-06-12 11:29:35 -0700307 public void onRectangleOnScreenRequestedLocked(Rect rectangle) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800308 if (DEBUG_RECTANGLE_REQUESTED) {
309 Slog.i(LOG_TAG, "Rectangle on screen requested: " + rectangle);
310 }
311 if (!mMagnifedViewport.isMagnifyingLocked()) {
312 return;
313 }
314 Rect magnifiedRegionBounds = mTempRect2;
315 mMagnifedViewport.getMagnifiedFrameInContentCoordsLocked(magnifiedRegionBounds);
316 if (magnifiedRegionBounds.contains(rectangle)) {
317 return;
318 }
319 SomeArgs args = SomeArgs.obtain();
320 args.argi1 = rectangle.left;
321 args.argi2 = rectangle.top;
322 args.argi3 = rectangle.right;
323 args.argi4 = rectangle.bottom;
324 mHandler.obtainMessage(MyHandler.MESSAGE_NOTIFY_RECTANGLE_ON_SCREEN_REQUESTED,
325 args).sendToTarget();
326 }
327
328 public void onWindowLayersChangedLocked() {
329 if (DEBUG_LAYERS) {
330 Slog.i(LOG_TAG, "Layers changed.");
331 }
332 mMagnifedViewport.recomputeBoundsLocked();
Robert Carre625fcf2017-09-01 12:36:28 -0700333 mService.scheduleAnimationLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800334 }
335
Andrii Kulian8ee72852017-03-10 10:36:45 -0800336 public void onRotationChangedLocked(DisplayContent displayContent) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800337 if (DEBUG_ROTATION) {
Andrii Kulian8ee72852017-03-10 10:36:45 -0800338 final int rotation = displayContent.getRotation();
339 Slog.i(LOG_TAG, "Rotation: " + Surface.rotationToString(rotation)
Svetoslav8e3feb12014-02-24 13:46:47 -0800340 + " displayId: " + displayContent.getDisplayId());
341 }
342 mMagnifedViewport.onRotationChangedLocked();
343 mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_ROTATION_CHANGED);
344 }
345
346 public void onAppWindowTransitionLocked(WindowState windowState, int transition) {
347 if (DEBUG_WINDOW_TRANSITIONS) {
348 Slog.i(LOG_TAG, "Window transition: "
349 + AppTransition.appTransitionToString(transition)
350 + " displayId: " + windowState.getDisplayId());
351 }
352 final boolean magnifying = mMagnifedViewport.isMagnifyingLocked();
353 if (magnifying) {
354 switch (transition) {
355 case AppTransition.TRANSIT_ACTIVITY_OPEN:
356 case AppTransition.TRANSIT_TASK_OPEN:
357 case AppTransition.TRANSIT_TASK_TO_FRONT:
358 case AppTransition.TRANSIT_WALLPAPER_OPEN:
359 case AppTransition.TRANSIT_WALLPAPER_CLOSE:
360 case AppTransition.TRANSIT_WALLPAPER_INTRA_OPEN: {
361 mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_USER_CONTEXT_CHANGED);
362 }
363 }
364 }
365 }
366
367 public void onWindowTransitionLocked(WindowState windowState, int transition) {
368 if (DEBUG_WINDOW_TRANSITIONS) {
369 Slog.i(LOG_TAG, "Window transition: "
370 + AppTransition.appTransitionToString(transition)
371 + " displayId: " + windowState.getDisplayId());
372 }
373 final boolean magnifying = mMagnifedViewport.isMagnifyingLocked();
374 final int type = windowState.mAttrs.type;
375 switch (transition) {
376 case WindowManagerPolicy.TRANSIT_ENTER:
377 case WindowManagerPolicy.TRANSIT_SHOW: {
378 if (!magnifying) {
379 break;
380 }
381 switch (type) {
382 case WindowManager.LayoutParams.TYPE_APPLICATION:
Chong Zhangfea963e2016-08-15 17:14:16 -0700383 case WindowManager.LayoutParams.TYPE_DRAWN_APPLICATION:
Svetoslav8e3feb12014-02-24 13:46:47 -0800384 case WindowManager.LayoutParams.TYPE_APPLICATION_PANEL:
385 case WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA:
386 case WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL:
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700387 case WindowManager.LayoutParams.TYPE_APPLICATION_ABOVE_SUB_PANEL:
Svetoslav8e3feb12014-02-24 13:46:47 -0800388 case WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG:
389 case WindowManager.LayoutParams.TYPE_SEARCH_BAR:
390 case WindowManager.LayoutParams.TYPE_PHONE:
391 case WindowManager.LayoutParams.TYPE_SYSTEM_ALERT:
392 case WindowManager.LayoutParams.TYPE_TOAST:
393 case WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY:
Wale Ogunwale5cd907d2017-01-26 14:14:08 -0800394 case WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY:
Svetoslav8e3feb12014-02-24 13:46:47 -0800395 case WindowManager.LayoutParams.TYPE_PRIORITY_PHONE:
396 case WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG:
397 case WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG:
398 case WindowManager.LayoutParams.TYPE_SYSTEM_ERROR:
399 case WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY:
Jason Monk8f7f3182015-11-18 16:35:14 -0500400 case WindowManager.LayoutParams.TYPE_QS_DIALOG:
Adrian Roos9a645132014-10-08 02:59:56 +0200401 case WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL: {
Svetoslav8e3feb12014-02-24 13:46:47 -0800402 Rect magnifiedRegionBounds = mTempRect2;
403 mMagnifedViewport.getMagnifiedFrameInContentCoordsLocked(
404 magnifiedRegionBounds);
405 Rect touchableRegionBounds = mTempRect1;
406 windowState.getTouchableRegion(mTempRegion1);
407 mTempRegion1.getBounds(touchableRegionBounds);
408 if (!magnifiedRegionBounds.intersect(touchableRegionBounds)) {
409 mCallbacks.onRectangleOnScreenRequested(
410 touchableRegionBounds.left,
411 touchableRegionBounds.top,
412 touchableRegionBounds.right,
413 touchableRegionBounds.bottom);
414 }
415 } break;
416 } break;
417 }
418 }
419 }
420
421 public MagnificationSpec getMagnificationSpecForWindowLocked(WindowState windowState) {
422 MagnificationSpec spec = mMagnifedViewport.getMagnificationSpecLocked();
423 if (spec != null && !spec.isNop()) {
Robert Carre625fcf2017-09-01 12:36:28 -0700424 if (!mService.mPolicy.canMagnifyWindow(windowState.mAttrs.type)) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800425 return null;
426 }
427 }
428 return spec;
429 }
430
Phil Weaver70439242016-03-10 15:15:49 -0800431 public void getMagnificationRegionLocked(Region outMagnificationRegion) {
Phil Weaver53b690b2017-08-14 17:42:39 -0700432 // Make sure we're working with the most current bounds
433 mMagnifedViewport.recomputeBoundsLocked();
Phil Weaver70439242016-03-10 15:15:49 -0800434 mMagnifedViewport.getMagnificationRegionLocked(outMagnificationRegion);
Alan Viverette59e53a12016-03-28 13:41:32 -0400435 }
436
Svetoslav8e3feb12014-02-24 13:46:47 -0800437 public void destroyLocked() {
438 mMagnifedViewport.destroyWindow();
439 }
440
Phil Weaver251db072017-03-28 08:35:38 -0700441 // Can be called outside of a surface transaction
442 public void showMagnificationBoundsIfNeeded() {
443 mHandler.obtainMessage(MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)
444 .sendToTarget();
445 }
446
Svetoslav8e3feb12014-02-24 13:46:47 -0800447 /** NOTE: This has to be called within a surface transaction. */
448 public void drawMagnifiedRegionBorderIfNeededLocked() {
449 mMagnifedViewport.drawWindowIfNeededLocked();
450 }
451
452 private final class MagnifiedViewport {
453
Svetoslav8e3feb12014-02-24 13:46:47 -0800454 private final SparseArray<WindowState> mTempWindowStates =
455 new SparseArray<WindowState>();
456
457 private final RectF mTempRectF = new RectF();
458
459 private final Point mTempPoint = new Point();
460
461 private final Matrix mTempMatrix = new Matrix();
462
Phil Weaver70439242016-03-10 15:15:49 -0800463 private final Region mMagnificationRegion = new Region();
464 private final Region mOldMagnificationRegion = new Region();
Svetoslav8e3feb12014-02-24 13:46:47 -0800465
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800466 private final Path mCircularPath;
467
Svetoslav8e3feb12014-02-24 13:46:47 -0800468 private final MagnificationSpec mMagnificationSpec = MagnificationSpec.obtain();
469
470 private final WindowManager mWindowManager;
471
Svetoslav7505e332014-08-22 12:14:28 -0700472 private final float mBorderWidth;
Svetoslav8e3feb12014-02-24 13:46:47 -0800473 private final int mHalfBorderWidth;
Svetoslav7505e332014-08-22 12:14:28 -0700474 private final int mDrawBorderInset;
Svetoslav8e3feb12014-02-24 13:46:47 -0800475
476 private final ViewportWindow mWindow;
477
478 private boolean mFullRedrawNeeded;
479
480 public MagnifiedViewport() {
481 mWindowManager = (WindowManager) mContext.getSystemService(Service.WINDOW_SERVICE);
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800482 mBorderWidth = mContext.getResources().getDimension(
483 com.android.internal.R.dimen.accessibility_magnification_indicator_width);
Svetoslav7505e332014-08-22 12:14:28 -0700484 mHalfBorderWidth = (int) Math.ceil(mBorderWidth / 2);
485 mDrawBorderInset = (int) mBorderWidth / 2;
Svetoslav8e3feb12014-02-24 13:46:47 -0800486 mWindow = new ViewportWindow(mContext);
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800487
Adam Powell01f280d2015-05-18 16:07:42 -0700488 if (mContext.getResources().getConfiguration().isScreenRound()) {
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800489 mCircularPath = new Path();
490 mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
491 final int centerXY = mTempPoint.x / 2;
492 mCircularPath.addCircle(centerXY, centerXY, centerXY, Path.Direction.CW);
493 } else {
494 mCircularPath = null;
495 }
496
Svetoslav8e3feb12014-02-24 13:46:47 -0800497 recomputeBoundsLocked();
498 }
499
Phil Weaver70439242016-03-10 15:15:49 -0800500 public void getMagnificationRegionLocked(@NonNull Region outMagnificationRegion) {
501 outMagnificationRegion.set(mMagnificationRegion);
Alan Viverette59e53a12016-03-28 13:41:32 -0400502 }
503
Svetoslav8e3feb12014-02-24 13:46:47 -0800504 public void updateMagnificationSpecLocked(MagnificationSpec spec) {
505 if (spec != null) {
506 mMagnificationSpec.initialize(spec.scale, spec.offsetX, spec.offsetY);
507 } else {
508 mMagnificationSpec.clear();
509 }
510 // If this message is pending we are in a rotation animation and do not want
511 // to show the border. We will do so when the pending message is handled.
Svetoslav7505e332014-08-22 12:14:28 -0700512 if (!mHandler.hasMessages(
513 MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED)) {
Casey Burkhardt74922c62017-02-13 12:43:16 -0800514 setMagnifiedRegionBorderShownLocked(
515 isMagnifyingLocked() || isForceShowingMagnifiableBoundsLocked(), true);
Svetoslav8e3feb12014-02-24 13:46:47 -0800516 }
517 }
518
519 public void recomputeBoundsLocked() {
520 mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
521 final int screenWidth = mTempPoint.x;
522 final int screenHeight = mTempPoint.y;
523
Phil Weaver70439242016-03-10 15:15:49 -0800524 mMagnificationRegion.set(0, 0, 0, 0);
525 final Region availableBounds = mTempRegion1;
526 availableBounds.set(0, 0, screenWidth, screenHeight);
Svetoslav8e3feb12014-02-24 13:46:47 -0800527
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800528 if (mCircularPath != null) {
Phil Weaver70439242016-03-10 15:15:49 -0800529 availableBounds.setPath(mCircularPath, availableBounds);
Casey Burkhardtd29a1e42015-02-12 14:07:55 -0800530 }
531
Svetoslav8e3feb12014-02-24 13:46:47 -0800532 Region nonMagnifiedBounds = mTempRegion4;
Svet Ganovb21df802014-09-01 19:06:33 -0700533 nonMagnifiedBounds.set(0, 0, 0, 0);
Svetoslav8e3feb12014-02-24 13:46:47 -0800534
535 SparseArray<WindowState> visibleWindows = mTempWindowStates;
536 visibleWindows.clear();
537 populateWindowsOnScreenLocked(visibleWindows);
538
539 final int visibleWindowCount = visibleWindows.size();
540 for (int i = visibleWindowCount - 1; i >= 0; i--) {
541 WindowState windowState = visibleWindows.valueAt(i);
Phil Weaverd321075e2017-06-13 09:13:35 -0700542 if ((windowState.mAttrs.type == TYPE_MAGNIFICATION_OVERLAY)
543 || ((windowState.mAttrs.privateFlags
Robert Carr132c9f52017-07-31 17:02:30 -0700544 & PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY) != 0)) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800545 continue;
546 }
547
Phil Weaver65c06702016-03-15 15:33:46 -0700548 // Consider the touchable portion of the window
Svetoslav8e3feb12014-02-24 13:46:47 -0800549 Matrix matrix = mTempMatrix;
550 populateTransformationMatrixLocked(windowState, matrix);
Phil Weaver65c06702016-03-15 15:33:46 -0700551 Region touchableRegion = mTempRegion3;
552 windowState.getTouchableRegion(touchableRegion);
553 Rect touchableFrame = mTempRect1;
554 touchableRegion.getBounds(touchableFrame);
Svetoslav8e3feb12014-02-24 13:46:47 -0800555 RectF windowFrame = mTempRectF;
Phil Weaver65c06702016-03-15 15:33:46 -0700556 windowFrame.set(touchableFrame);
557 windowFrame.offset(-windowState.mFrame.left, -windowState.mFrame.top);
558 matrix.mapRect(windowFrame);
559 Region windowBounds = mTempRegion2;
560 windowBounds.set((int) windowFrame.left, (int) windowFrame.top,
561 (int) windowFrame.right, (int) windowFrame.bottom);
562 // Only update new regions
563 Region portionOfWindowAlreadyAccountedFor = mTempRegion3;
Phil Weaver70439242016-03-10 15:15:49 -0800564 portionOfWindowAlreadyAccountedFor.set(mMagnificationRegion);
Phil Weaver65c06702016-03-15 15:33:46 -0700565 portionOfWindowAlreadyAccountedFor.op(nonMagnifiedBounds, Region.Op.UNION);
566 windowBounds.op(portionOfWindowAlreadyAccountedFor, Region.Op.DIFFERENCE);
Svetoslav8e3feb12014-02-24 13:46:47 -0800567
Robert Carre625fcf2017-09-01 12:36:28 -0700568 if (mService.mPolicy.canMagnifyWindow(windowState.mAttrs.type)) {
Phil Weaver70439242016-03-10 15:15:49 -0800569 mMagnificationRegion.op(windowBounds, Region.Op.UNION);
570 mMagnificationRegion.op(availableBounds, Region.Op.INTERSECT);
Svetoslav8e3feb12014-02-24 13:46:47 -0800571 } else {
Svetoslav8e3feb12014-02-24 13:46:47 -0800572 nonMagnifiedBounds.op(windowBounds, Region.Op.UNION);
Phil Weaver70439242016-03-10 15:15:49 -0800573 availableBounds.op(windowBounds, Region.Op.DIFFERENCE);
Svetoslav8e3feb12014-02-24 13:46:47 -0800574 }
575
Phil Weaver65c06702016-03-15 15:33:46 -0700576 // Update accounted bounds
Svetoslav8e3feb12014-02-24 13:46:47 -0800577 Region accountedBounds = mTempRegion2;
Phil Weaver70439242016-03-10 15:15:49 -0800578 accountedBounds.set(mMagnificationRegion);
Svetoslav8e3feb12014-02-24 13:46:47 -0800579 accountedBounds.op(nonMagnifiedBounds, Region.Op.UNION);
580 accountedBounds.op(0, 0, screenWidth, screenHeight, Region.Op.INTERSECT);
581
582 if (accountedBounds.isRect()) {
583 Rect accountedFrame = mTempRect1;
584 accountedBounds.getBounds(accountedFrame);
585 if (accountedFrame.width() == screenWidth
586 && accountedFrame.height() == screenHeight) {
587 break;
588 }
589 }
590 }
591
592 visibleWindows.clear();
593
Phil Weaver70439242016-03-10 15:15:49 -0800594 mMagnificationRegion.op(mDrawBorderInset, mDrawBorderInset,
Svetoslav7505e332014-08-22 12:14:28 -0700595 screenWidth - mDrawBorderInset, screenHeight - mDrawBorderInset,
Svetoslav8e3feb12014-02-24 13:46:47 -0800596 Region.Op.INTERSECT);
597
Phil Weaver70439242016-03-10 15:15:49 -0800598 final boolean magnifiedChanged =
599 !mOldMagnificationRegion.equals(mMagnificationRegion);
600 if (magnifiedChanged) {
601 mWindow.setBounds(mMagnificationRegion);
602 final Rect dirtyRect = mTempRect1;
603 if (mFullRedrawNeeded) {
604 mFullRedrawNeeded = false;
605 dirtyRect.set(mDrawBorderInset, mDrawBorderInset,
606 screenWidth - mDrawBorderInset,
607 screenHeight - mDrawBorderInset);
608 mWindow.invalidate(dirtyRect);
609 } else {
610 final Region dirtyRegion = mTempRegion3;
611 dirtyRegion.set(mMagnificationRegion);
612 dirtyRegion.op(mOldMagnificationRegion, Region.Op.UNION);
613 dirtyRegion.op(nonMagnifiedBounds, Region.Op.INTERSECT);
614 dirtyRegion.getBounds(dirtyRect);
615 mWindow.invalidate(dirtyRect);
Svetoslav8e3feb12014-02-24 13:46:47 -0800616 }
617
Phil Weaver70439242016-03-10 15:15:49 -0800618 mOldMagnificationRegion.set(mMagnificationRegion);
Alan Viverette214fb682015-11-17 09:47:11 -0500619 final SomeArgs args = SomeArgs.obtain();
Phil Weaver70439242016-03-10 15:15:49 -0800620 args.arg1 = Region.obtain(mMagnificationRegion);
Alan Viverette214fb682015-11-17 09:47:11 -0500621 mHandler.obtainMessage(
Phil Weaver70439242016-03-10 15:15:49 -0800622 MyHandler.MESSAGE_NOTIFY_MAGNIFICATION_REGION_CHANGED, args)
623 .sendToTarget();
Svetoslav8e3feb12014-02-24 13:46:47 -0800624 }
625 }
626
627 public void onRotationChangedLocked() {
Casey Burkhardt74922c62017-02-13 12:43:16 -0800628 // If we are showing the magnification border, hide it immediately so
Svetoslav8e3feb12014-02-24 13:46:47 -0800629 // the user does not see strange artifacts during rotation. The screenshot
Casey Burkhardt74922c62017-02-13 12:43:16 -0800630 // used for rotation already has the border. After the rotation is complete
Svetoslav8e3feb12014-02-24 13:46:47 -0800631 // we will show the border.
Casey Burkhardt74922c62017-02-13 12:43:16 -0800632 if (isMagnifyingLocked() || isForceShowingMagnifiableBoundsLocked()) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800633 setMagnifiedRegionBorderShownLocked(false, false);
634 final long delay = (long) (mLongAnimationDuration
Robert Carre625fcf2017-09-01 12:36:28 -0700635 * mService.getWindowAnimationScaleLocked());
Svetoslav8e3feb12014-02-24 13:46:47 -0800636 Message message = mHandler.obtainMessage(
637 MyHandler.MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED);
638 mHandler.sendMessageDelayed(message, delay);
639 }
640 recomputeBoundsLocked();
641 mWindow.updateSize();
642 }
643
644 public void setMagnifiedRegionBorderShownLocked(boolean shown, boolean animate) {
645 if (shown) {
646 mFullRedrawNeeded = true;
Phil Weaver70439242016-03-10 15:15:49 -0800647 mOldMagnificationRegion.set(0, 0, 0, 0);
Svetoslav8e3feb12014-02-24 13:46:47 -0800648 }
649 mWindow.setShown(shown, animate);
650 }
651
652 public void getMagnifiedFrameInContentCoordsLocked(Rect rect) {
653 MagnificationSpec spec = mMagnificationSpec;
Phil Weaver70439242016-03-10 15:15:49 -0800654 mMagnificationRegion.getBounds(rect);
Svetoslav8e3feb12014-02-24 13:46:47 -0800655 rect.offset((int) -spec.offsetX, (int) -spec.offsetY);
656 rect.scale(1.0f / spec.scale);
657 }
658
659 public boolean isMagnifyingLocked() {
660 return mMagnificationSpec.scale > 1.0f;
661 }
662
663 public MagnificationSpec getMagnificationSpecLocked() {
664 return mMagnificationSpec;
665 }
666
667 /** NOTE: This has to be called within a surface transaction. */
668 public void drawWindowIfNeededLocked() {
669 recomputeBoundsLocked();
670 mWindow.drawIfNeeded();
671 }
672
673 public void destroyWindow() {
674 mWindow.releaseSurface();
675 }
676
677 private void populateWindowsOnScreenLocked(SparseArray<WindowState> outWindows) {
Robert Carre625fcf2017-09-01 12:36:28 -0700678 final DisplayContent dc = mService.getDefaultDisplayContentLocked();
Wale Ogunwaled1880962016-11-08 10:31:59 -0800679 dc.forAllWindows((w) -> {
680 if (w.isOnScreen() && w.isVisibleLw()
681 && !w.mWinAnimator.mEnterAnimationPending) {
682 outWindows.put(w.mLayer, w);
Svetoslav8e3feb12014-02-24 13:46:47 -0800683 }
Wale Ogunwaled1880962016-11-08 10:31:59 -0800684 }, false /* traverseTopToBottom */ );
Svetoslav8e3feb12014-02-24 13:46:47 -0800685 }
686
687 private final class ViewportWindow {
688 private static final String SURFACE_TITLE = "Magnification Overlay";
689
Svetoslav8e3feb12014-02-24 13:46:47 -0800690 private final Region mBounds = new Region();
691 private final Rect mDirtyRect = new Rect();
692 private final Paint mPaint = new Paint();
693
Svetoslav8e3feb12014-02-24 13:46:47 -0800694 private final SurfaceControl mSurfaceControl;
695 private final Surface mSurface = new Surface();
696
Svet Ganovb21df802014-09-01 19:06:33 -0700697 private final AnimationController mAnimationController;
698
Svetoslav8e3feb12014-02-24 13:46:47 -0800699 private boolean mShown;
700 private int mAlpha;
701
702 private boolean mInvalidated;
703
704 public ViewportWindow(Context context) {
705 SurfaceControl surfaceControl = null;
706 try {
707 mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
Robert Carre625fcf2017-09-01 12:36:28 -0700708 surfaceControl = new SurfaceControl.Builder(mService.mFxSession)
709 .setName(SURFACE_TITLE)
710 .setSize(mTempPoint.x, mTempPoint.y) // not a typo
711 .setFormat(PixelFormat.TRANSLUCENT)
712 .build();
Svetoslav8e3feb12014-02-24 13:46:47 -0800713 } catch (OutOfResourcesException oore) {
714 /* ignore */
715 }
716 mSurfaceControl = surfaceControl;
717 mSurfaceControl.setLayerStack(mWindowManager.getDefaultDisplay()
718 .getLayerStack());
Robert Carre625fcf2017-09-01 12:36:28 -0700719 mSurfaceControl.setLayer(mService.mPolicy.getWindowLayerFromTypeLw(
Phil Weaverd321075e2017-06-13 09:13:35 -0700720 TYPE_MAGNIFICATION_OVERLAY)
Svetoslav8e3feb12014-02-24 13:46:47 -0800721 * WindowManagerService.TYPE_LAYER_MULTIPLIER);
722 mSurfaceControl.setPosition(0, 0);
723 mSurface.copyFrom(mSurfaceControl);
724
Svet Ganovb21df802014-09-01 19:06:33 -0700725 mAnimationController = new AnimationController(context,
Robert Carre625fcf2017-09-01 12:36:28 -0700726 mService.mH.getLooper());
Svet Ganovb21df802014-09-01 19:06:33 -0700727
Svetoslav8e3feb12014-02-24 13:46:47 -0800728 TypedValue typedValue = new TypedValue();
729 context.getTheme().resolveAttribute(R.attr.colorActivatedHighlight,
730 typedValue, true);
Alan Viverette4a357cd2015-03-18 18:37:18 -0700731 final int borderColor = context.getColor(typedValue.resourceId);
Svetoslav8e3feb12014-02-24 13:46:47 -0800732
733 mPaint.setStyle(Paint.Style.STROKE);
734 mPaint.setStrokeWidth(mBorderWidth);
735 mPaint.setColor(borderColor);
736
Svetoslav8e3feb12014-02-24 13:46:47 -0800737 mInvalidated = true;
738 }
739
740 public void setShown(boolean shown, boolean animate) {
Robert Carre625fcf2017-09-01 12:36:28 -0700741 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800742 if (mShown == shown) {
743 return;
744 }
745 mShown = shown;
Svet Ganovb21df802014-09-01 19:06:33 -0700746 mAnimationController.onFrameShownStateChanged(shown, animate);
Svetoslav8e3feb12014-02-24 13:46:47 -0800747 if (DEBUG_VIEWPORT_WINDOW) {
748 Slog.i(LOG_TAG, "ViewportWindow shown: " + mShown);
749 }
750 }
751 }
752
753 @SuppressWarnings("unused")
754 // Called reflectively from an animator.
755 public int getAlpha() {
Robert Carre625fcf2017-09-01 12:36:28 -0700756 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800757 return mAlpha;
758 }
759 }
760
761 public void setAlpha(int alpha) {
Robert Carre625fcf2017-09-01 12:36:28 -0700762 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800763 if (mAlpha == alpha) {
764 return;
765 }
766 mAlpha = alpha;
767 invalidate(null);
768 if (DEBUG_VIEWPORT_WINDOW) {
769 Slog.i(LOG_TAG, "ViewportWindow set alpha: " + alpha);
770 }
771 }
772 }
773
774 public void setBounds(Region bounds) {
Robert Carre625fcf2017-09-01 12:36:28 -0700775 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800776 if (mBounds.equals(bounds)) {
777 return;
778 }
779 mBounds.set(bounds);
780 invalidate(mDirtyRect);
781 if (DEBUG_VIEWPORT_WINDOW) {
782 Slog.i(LOG_TAG, "ViewportWindow set bounds: " + bounds);
783 }
784 }
785 }
786
787 public void updateSize() {
Robert Carre625fcf2017-09-01 12:36:28 -0700788 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800789 mWindowManager.getDefaultDisplay().getRealSize(mTempPoint);
790 mSurfaceControl.setSize(mTempPoint.x, mTempPoint.y);
791 invalidate(mDirtyRect);
792 }
793 }
794
795 public void invalidate(Rect dirtyRect) {
796 if (dirtyRect != null) {
797 mDirtyRect.set(dirtyRect);
798 } else {
799 mDirtyRect.setEmpty();
800 }
801 mInvalidated = true;
Robert Carre625fcf2017-09-01 12:36:28 -0700802 mService.scheduleAnimationLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800803 }
804
805 /** NOTE: This has to be called within a surface transaction. */
806 public void drawIfNeeded() {
Robert Carre625fcf2017-09-01 12:36:28 -0700807 synchronized (mService.mWindowMap) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800808 if (!mInvalidated) {
809 return;
810 }
811 mInvalidated = false;
812 Canvas canvas = null;
813 try {
814 // Empty dirty rectangle means unspecified.
815 if (mDirtyRect.isEmpty()) {
816 mBounds.getBounds(mDirtyRect);
817 }
818 mDirtyRect.inset(- mHalfBorderWidth, - mHalfBorderWidth);
819 canvas = mSurface.lockCanvas(mDirtyRect);
820 if (DEBUG_VIEWPORT_WINDOW) {
821 Slog.i(LOG_TAG, "Dirty rect: " + mDirtyRect);
822 }
823 } catch (IllegalArgumentException iae) {
824 /* ignore */
825 } catch (Surface.OutOfResourcesException oore) {
826 /* ignore */
827 }
828 if (canvas == null) {
829 return;
830 }
831 if (DEBUG_VIEWPORT_WINDOW) {
832 Slog.i(LOG_TAG, "Bounds: " + mBounds);
833 }
834 canvas.drawColor(Color.TRANSPARENT, Mode.CLEAR);
835 mPaint.setAlpha(mAlpha);
836 Path path = mBounds.getBoundaryPath();
837 canvas.drawPath(path, mPaint);
838
839 mSurface.unlockCanvasAndPost(canvas);
840
841 if (mAlpha > 0) {
842 mSurfaceControl.show();
843 } else {
844 mSurfaceControl.hide();
845 }
846 }
847 }
848
849 public void releaseSurface() {
850 mSurfaceControl.release();
851 mSurface.release();
852 }
Svet Ganovb21df802014-09-01 19:06:33 -0700853
854 private final class AnimationController extends Handler {
855 private static final String PROPERTY_NAME_ALPHA = "alpha";
856
857 private static final int MIN_ALPHA = 0;
858 private static final int MAX_ALPHA = 255;
859
860 private static final int MSG_FRAME_SHOWN_STATE_CHANGED = 1;
861
862 private final ValueAnimator mShowHideFrameAnimator;
863
864 public AnimationController(Context context, Looper looper) {
865 super(looper);
866 mShowHideFrameAnimator = ObjectAnimator.ofInt(ViewportWindow.this,
867 PROPERTY_NAME_ALPHA, MIN_ALPHA, MAX_ALPHA);
868
869 Interpolator interpolator = new DecelerateInterpolator(2.5f);
870 final long longAnimationDuration = context.getResources().getInteger(
871 com.android.internal.R.integer.config_longAnimTime);
872
873 mShowHideFrameAnimator.setInterpolator(interpolator);
874 mShowHideFrameAnimator.setDuration(longAnimationDuration);
875 }
876
877 public void onFrameShownStateChanged(boolean shown, boolean animate) {
878 obtainMessage(MSG_FRAME_SHOWN_STATE_CHANGED,
879 shown ? 1 : 0, animate ? 1 : 0).sendToTarget();
880 }
881
882 @Override
883 public void handleMessage(Message message) {
884 switch (message.what) {
885 case MSG_FRAME_SHOWN_STATE_CHANGED: {
886 final boolean shown = message.arg1 == 1;
887 final boolean animate = message.arg2 == 1;
888
889 if (animate) {
890 if (mShowHideFrameAnimator.isRunning()) {
891 mShowHideFrameAnimator.reverse();
892 } else {
893 if (shown) {
894 mShowHideFrameAnimator.start();
895 } else {
896 mShowHideFrameAnimator.reverse();
897 }
898 }
899 } else {
900 mShowHideFrameAnimator.cancel();
901 if (shown) {
902 setAlpha(MAX_ALPHA);
903 } else {
904 setAlpha(MIN_ALPHA);
905 }
906 }
907 } break;
908 }
909 }
910 }
Svetoslav8e3feb12014-02-24 13:46:47 -0800911 }
912 }
913
914 private class MyHandler extends Handler {
Phil Weaver70439242016-03-10 15:15:49 -0800915 public static final int MESSAGE_NOTIFY_MAGNIFICATION_REGION_CHANGED = 1;
Svetoslav8e3feb12014-02-24 13:46:47 -0800916 public static final int MESSAGE_NOTIFY_RECTANGLE_ON_SCREEN_REQUESTED = 2;
917 public static final int MESSAGE_NOTIFY_USER_CONTEXT_CHANGED = 3;
918 public static final int MESSAGE_NOTIFY_ROTATION_CHANGED = 4;
919 public static final int MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED = 5;
920
921 public MyHandler(Looper looper) {
922 super(looper);
923 }
924
925 @Override
926 public void handleMessage(Message message) {
927 switch (message.what) {
Phil Weaver70439242016-03-10 15:15:49 -0800928 case MESSAGE_NOTIFY_MAGNIFICATION_REGION_CHANGED: {
Alan Viverette214fb682015-11-17 09:47:11 -0500929 final SomeArgs args = (SomeArgs) message.obj;
930 final Region magnifiedBounds = (Region) args.arg1;
Phil Weaver70439242016-03-10 15:15:49 -0800931 mCallbacks.onMagnificationRegionChanged(magnifiedBounds);
Alan Viverette214fb682015-11-17 09:47:11 -0500932 magnifiedBounds.recycle();
Svetoslav8e3feb12014-02-24 13:46:47 -0800933 } break;
934
935 case MESSAGE_NOTIFY_RECTANGLE_ON_SCREEN_REQUESTED: {
936 SomeArgs args = (SomeArgs) message.obj;
937 final int left = args.argi1;
938 final int top = args.argi2;
939 final int right = args.argi3;
940 final int bottom = args.argi4;
941 mCallbacks.onRectangleOnScreenRequested(left, top, right, bottom);
942 args.recycle();
943 } break;
944
945 case MESSAGE_NOTIFY_USER_CONTEXT_CHANGED: {
946 mCallbacks.onUserContextChanged();
947 } break;
948
949 case MESSAGE_NOTIFY_ROTATION_CHANGED: {
950 final int rotation = message.arg1;
951 mCallbacks.onRotationChanged(rotation);
952 } break;
953
954 case MESSAGE_SHOW_MAGNIFIED_REGION_BOUNDS_IF_NEEDED : {
Robert Carre625fcf2017-09-01 12:36:28 -0700955 synchronized (mService.mWindowMap) {
Casey Burkhardt74922c62017-02-13 12:43:16 -0800956 if (mMagnifedViewport.isMagnifyingLocked()
957 || isForceShowingMagnifiableBoundsLocked()) {
Svetoslav8e3feb12014-02-24 13:46:47 -0800958 mMagnifedViewport.setMagnifiedRegionBorderShownLocked(true, true);
Robert Carre625fcf2017-09-01 12:36:28 -0700959 mService.scheduleAnimationLocked();
Svetoslav8e3feb12014-02-24 13:46:47 -0800960 }
961 }
962 } break;
963 }
964 }
965 }
966 }
967
968 /**
969 * This class encapsulates the functionality related to computing the windows
970 * reported for accessibility purposes. These windows are all windows a sighted
971 * user can see on the screen.
972 */
973 private static final class WindowsForAccessibilityObserver {
Filip Gruszczynski0bd180d2015-12-07 15:43:52 -0800974 private static final String LOG_TAG = TAG_WITH_CLASS_NAME ?
975 "WindowsForAccessibilityObserver" : TAG_WM;
Svetoslav8e3feb12014-02-24 13:46:47 -0800976
977 private static final boolean DEBUG = false;
978
979 private final SparseArray<WindowState> mTempWindowStates =
980 new SparseArray<WindowState>();
981
982 private final List<WindowInfo> mOldWindows = new ArrayList<WindowInfo>();
983
984 private final Set<IBinder> mTempBinderSet = new ArraySet<IBinder>();
985
986 private final RectF mTempRectF = new RectF();
987
988 private final Matrix mTempMatrix = new Matrix();
989
990 private final Point mTempPoint = new Point();
991
992 private final Rect mTempRect = new Rect();
993
994 private final Region mTempRegion = new Region();
995
996 private final Region mTempRegion1 = new Region();
997
998 private final Context mContext;
999
Robert Carre625fcf2017-09-01 12:36:28 -07001000 private final WindowManagerService mService;
Svetoslav8e3feb12014-02-24 13:46:47 -08001001
1002 private final Handler mHandler;
1003
1004 private final WindowsForAccessibilityCallback mCallback;
1005
Svetoslavf7174e82014-06-12 11:29:35 -07001006 private final long mRecurringAccessibilityEventsIntervalMillis;
1007
Svetoslav8e3feb12014-02-24 13:46:47 -08001008 public WindowsForAccessibilityObserver(WindowManagerService windowManagerService,
1009 WindowsForAccessibilityCallback callback) {
1010 mContext = windowManagerService.mContext;
Robert Carre625fcf2017-09-01 12:36:28 -07001011 mService = windowManagerService;
Svetoslav8e3feb12014-02-24 13:46:47 -08001012 mCallback = callback;
Robert Carre625fcf2017-09-01 12:36:28 -07001013 mHandler = new MyHandler(mService.mH.getLooper());
Svetoslavf7174e82014-06-12 11:29:35 -07001014 mRecurringAccessibilityEventsIntervalMillis = ViewConfiguration
1015 .getSendRecurringAccessibilityEventsInterval();
Svetoslav8e3feb12014-02-24 13:46:47 -08001016 computeChangedWindows();
1017 }
1018
Svetoslav3a0d8782014-12-04 12:50:11 -08001019 public void performComputeChangedWindowsNotLocked() {
1020 mHandler.removeMessages(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS);
1021 computeChangedWindows();
1022 }
1023
Svetoslavf7174e82014-06-12 11:29:35 -07001024 public void scheduleComputeChangedWindowsLocked() {
Svetoslav3a0d8782014-12-04 12:50:11 -08001025 if (!mHandler.hasMessages(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS)) {
Svetoslavf7174e82014-06-12 11:29:35 -07001026 mHandler.sendEmptyMessageDelayed(MyHandler.MESSAGE_COMPUTE_CHANGED_WINDOWS,
1027 mRecurringAccessibilityEventsIntervalMillis);
1028 }
1029 }
1030
Svetoslav8e3feb12014-02-24 13:46:47 -08001031 public void computeChangedWindows() {
1032 if (DEBUG) {
1033 Slog.i(LOG_TAG, "computeChangedWindows()");
1034 }
1035
Svetoslav3a0d8782014-12-04 12:50:11 -08001036 boolean windowsChanged = false;
1037 List<WindowInfo> windows = new ArrayList<WindowInfo>();
1038
Robert Carre625fcf2017-09-01 12:36:28 -07001039 synchronized (mService.mWindowMap) {
Svetoslavf7174e82014-06-12 11:29:35 -07001040 // Do not send the windows if there is no current focus as
1041 // the window manager is still looking for where to put it.
1042 // We will do the work when we get a focus change callback.
Robert Carre625fcf2017-09-01 12:36:28 -07001043 if (mService.mCurrentFocus == null) {
Svetoslavf7174e82014-06-12 11:29:35 -07001044 return;
1045 }
1046
Svetoslav8e3feb12014-02-24 13:46:47 -08001047 WindowManager windowManager = (WindowManager)
1048 mContext.getSystemService(Context.WINDOW_SERVICE);
1049 windowManager.getDefaultDisplay().getRealSize(mTempPoint);
1050 final int screenWidth = mTempPoint.x;
1051 final int screenHeight = mTempPoint.y;
1052
1053 Region unaccountedSpace = mTempRegion;
1054 unaccountedSpace.set(0, 0, screenWidth, screenHeight);
1055
Wale Ogunwalef7cab102016-10-25 15:25:14 -07001056 final SparseArray<WindowState> visibleWindows = mTempWindowStates;
Svetoslav8e3feb12014-02-24 13:46:47 -08001057 populateVisibleWindowsOnScreenLocked(visibleWindows);
Svetoslav8e3feb12014-02-24 13:46:47 -08001058 Set<IBinder> addedWindows = mTempBinderSet;
1059 addedWindows.clear();
1060
Svetoslavf7174e82014-06-12 11:29:35 -07001061 boolean focusedWindowAdded = false;
1062
Svetoslav8e3feb12014-02-24 13:46:47 -08001063 final int visibleWindowCount = visibleWindows.size();
Allen Hairf20ac2c2016-02-11 17:42:59 -08001064 HashSet<Integer> skipRemainingWindowsForTasks = new HashSet<>();
Svetoslav8e3feb12014-02-24 13:46:47 -08001065 for (int i = visibleWindowCount - 1; i >= 0; i--) {
Alan Viverette9538eea2014-11-13 14:49:20 -08001066 final WindowState windowState = visibleWindows.valueAt(i);
Svetoslav8e3feb12014-02-24 13:46:47 -08001067 final int flags = windowState.mAttrs.flags;
Allen Hairf20ac2c2016-02-11 17:42:59 -08001068 final Task task = windowState.getTask();
1069
1070 // If the window is part of a task that we're finished with - ignore.
1071 if (task != null && skipRemainingWindowsForTasks.contains(task.mTaskId)) {
1072 continue;
1073 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001074
Svetoslav3a5c7212014-10-14 09:54:26 -07001075 // If the window is not touchable - ignore.
Svetoslavf7174e82014-06-12 11:29:35 -07001076 if ((flags & WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE) != 0) {
Svetoslav8e3feb12014-02-24 13:46:47 -08001077 continue;
1078 }
1079
Alan Viverette9538eea2014-11-13 14:49:20 -08001080 // Compute the bounds in the screen.
1081 final Rect boundsInScreen = mTempRect;
1082 computeWindowBoundsInScreen(windowState, boundsInScreen);
1083
Svetoslav8e3feb12014-02-24 13:46:47 -08001084 // If the window is completely covered by other windows - ignore.
1085 if (unaccountedSpace.quickReject(boundsInScreen)) {
1086 continue;
1087 }
1088
1089 // Add windows of certain types not covered by modal windows.
1090 if (isReportedWindowType(windowState.mAttrs.type)) {
1091 // Add the window to the ones to be reported.
Svetoslavf7174e82014-06-12 11:29:35 -07001092 WindowInfo window = obtainPopulatedWindowInfo(windowState, boundsInScreen);
Svetoslav8e3feb12014-02-24 13:46:47 -08001093 addedWindows.add(window.token);
Svetoslav8e3feb12014-02-24 13:46:47 -08001094 windows.add(window);
Svetoslavf7174e82014-06-12 11:29:35 -07001095 if (windowState.isFocused()) {
1096 focusedWindowAdded = true;
1097 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001098 }
1099
Alan Viveretted0c73f42014-11-18 10:25:04 -08001100 // Account for the space this window takes if the window
1101 // is not an accessibility overlay which does not change
1102 // the reported windows.
1103 if (windowState.mAttrs.type !=
1104 WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY) {
1105 unaccountedSpace.op(boundsInScreen, unaccountedSpace,
1106 Region.Op.REVERSE_DIFFERENCE);
1107 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001108
Allen Hairf20ac2c2016-02-11 17:42:59 -08001109 // If a window is modal it prevents other windows from being touched
Svetoslav8e3feb12014-02-24 13:46:47 -08001110 if ((flags & (WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
1111 | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL)) == 0) {
Phil Weaverac9ad702016-07-27 18:03:10 -07001112 // Account for all space in the task, whether the windows in it are
1113 // touchable or not. The modal window blocks all touches from the task's
1114 // area.
1115 unaccountedSpace.op(windowState.getDisplayFrameLw(), unaccountedSpace,
1116 Region.Op.REVERSE_DIFFERENCE);
1117
Allen Hairf20ac2c2016-02-11 17:42:59 -08001118 if (task != null) {
1119 // If the window is associated with a particular task, we can skip the
1120 // rest of the windows for that task.
1121 skipRemainingWindowsForTasks.add(task.mTaskId);
1122 continue;
1123 } else {
1124 // If the window is not associated with a particular task, then it is
1125 // globally modal. In this case we can skip all remaining windows.
1126 break;
1127 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001128 }
Phil Weaverac9ad702016-07-27 18:03:10 -07001129 // We figured out what is touchable for the entire screen - done.
1130 if (unaccountedSpace.isEmpty()) {
1131 break;
1132 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001133 }
1134
Svetoslavf7174e82014-06-12 11:29:35 -07001135 // Always report the focused window.
1136 if (!focusedWindowAdded) {
1137 for (int i = visibleWindowCount - 1; i >= 0; i--) {
1138 WindowState windowState = visibleWindows.valueAt(i);
1139 if (windowState.isFocused()) {
1140 // Compute the bounds in the screen.
1141 Rect boundsInScreen = mTempRect;
1142 computeWindowBoundsInScreen(windowState, boundsInScreen);
1143
1144 // Add the window to the ones to be reported.
1145 WindowInfo window = obtainPopulatedWindowInfo(windowState,
1146 boundsInScreen);
1147 addedWindows.add(window.token);
1148 windows.add(window);
1149 break;
1150 }
1151 }
1152 }
1153
Svetoslav8e3feb12014-02-24 13:46:47 -08001154 // Remove child/parent references to windows that were not added.
1155 final int windowCount = windows.size();
1156 for (int i = 0; i < windowCount; i++) {
1157 WindowInfo window = windows.get(i);
1158 if (!addedWindows.contains(window.parentToken)) {
1159 window.parentToken = null;
1160 }
1161 if (window.childTokens != null) {
1162 final int childTokenCount = window.childTokens.size();
1163 for (int j = childTokenCount - 1; j >= 0; j--) {
1164 if (!addedWindows.contains(window.childTokens.get(j))) {
1165 window.childTokens.remove(j);
1166 }
1167 }
1168 // Leave the child token list if empty.
1169 }
1170 }
1171
1172 visibleWindows.clear();
1173 addedWindows.clear();
1174
1175 // We computed the windows and if they changed notify the client.
Svetoslav8e3feb12014-02-24 13:46:47 -08001176 if (mOldWindows.size() != windows.size()) {
1177 // Different size means something changed.
1178 windowsChanged = true;
1179 } else if (!mOldWindows.isEmpty() || !windows.isEmpty()) {
1180 // Since we always traverse windows from high to low layer
1181 // the old and new windows at the same index should be the
1182 // same, otherwise something changed.
1183 for (int i = 0; i < windowCount; i++) {
1184 WindowInfo oldWindow = mOldWindows.get(i);
1185 WindowInfo newWindow = windows.get(i);
1186 // We do not care for layer changes given the window
1187 // order does not change. This brings no new information
1188 // to the clients.
1189 if (windowChangedNoLayer(oldWindow, newWindow)) {
1190 windowsChanged = true;
1191 break;
1192 }
1193 }
1194 }
1195
1196 if (windowsChanged) {
Svetoslav8e3feb12014-02-24 13:46:47 -08001197 cacheWindows(windows);
Svetoslav8e3feb12014-02-24 13:46:47 -08001198 }
1199 }
Svetoslav3a0d8782014-12-04 12:50:11 -08001200
1201 // Now we do not hold the lock, so send the windows over.
1202 if (windowsChanged) {
1203 if (DEBUG) {
1204 Log.i(LOG_TAG, "Windows changed:" + windows);
1205 }
1206 mCallback.onWindowsForAccessibilityChanged(windows);
1207 } else {
1208 if (DEBUG) {
1209 Log.i(LOG_TAG, "No windows changed.");
1210 }
1211 }
1212
1213 // Recycle the windows as we do not need them.
1214 clearAndRecycleWindows(windows);
Svetoslav8e3feb12014-02-24 13:46:47 -08001215 }
1216
Svetoslavf7174e82014-06-12 11:29:35 -07001217 private void computeWindowBoundsInScreen(WindowState windowState, Rect outBounds) {
1218 // Get the touchable frame.
1219 Region touchableRegion = mTempRegion1;
1220 windowState.getTouchableRegion(touchableRegion);
1221 Rect touchableFrame = mTempRect;
1222 touchableRegion.getBounds(touchableFrame);
1223
1224 // Move to origin as all transforms are captured by the matrix.
1225 RectF windowFrame = mTempRectF;
1226 windowFrame.set(touchableFrame);
1227 windowFrame.offset(-windowState.mFrame.left, -windowState.mFrame.top);
1228
1229 // Map the frame to get what appears on the screen.
1230 Matrix matrix = mTempMatrix;
1231 populateTransformationMatrixLocked(windowState, matrix);
1232 matrix.mapRect(windowFrame);
1233
1234 // Got the bounds.
1235 outBounds.set((int) windowFrame.left, (int) windowFrame.top,
1236 (int) windowFrame.right, (int) windowFrame.bottom);
1237 }
1238
Wale Ogunwaleadde52e2016-07-16 13:11:55 -07001239 private static WindowInfo obtainPopulatedWindowInfo(
1240 WindowState windowState, Rect boundsInScreen) {
1241 final WindowInfo window = windowState.getWindowInfo();
Svetoslavf7174e82014-06-12 11:29:35 -07001242 window.boundsInScreen.set(boundsInScreen);
Svetoslavf7174e82014-06-12 11:29:35 -07001243 return window;
1244 }
1245
Svetoslav8e3feb12014-02-24 13:46:47 -08001246 private void cacheWindows(List<WindowInfo> windows) {
1247 final int oldWindowCount = mOldWindows.size();
1248 for (int i = oldWindowCount - 1; i >= 0; i--) {
1249 mOldWindows.remove(i).recycle();
1250 }
1251 final int newWindowCount = windows.size();
1252 for (int i = 0; i < newWindowCount; i++) {
1253 WindowInfo newWindow = windows.get(i);
1254 mOldWindows.add(WindowInfo.obtain(newWindow));
1255 }
1256 }
1257
1258 private boolean windowChangedNoLayer(WindowInfo oldWindow, WindowInfo newWindow) {
1259 if (oldWindow == newWindow) {
1260 return false;
1261 }
Svetoslavf7174e82014-06-12 11:29:35 -07001262 if (oldWindow == null) {
Svetoslav8e3feb12014-02-24 13:46:47 -08001263 return true;
1264 }
Svetoslavf7174e82014-06-12 11:29:35 -07001265 if (newWindow == null) {
Svetoslav8e3feb12014-02-24 13:46:47 -08001266 return true;
1267 }
1268 if (oldWindow.type != newWindow.type) {
1269 return true;
1270 }
1271 if (oldWindow.focused != newWindow.focused) {
1272 return true;
1273 }
1274 if (oldWindow.token == null) {
1275 if (newWindow.token != null) {
1276 return true;
1277 }
1278 } else if (!oldWindow.token.equals(newWindow.token)) {
1279 return true;
1280 }
1281 if (oldWindow.parentToken == null) {
1282 if (newWindow.parentToken != null) {
1283 return true;
1284 }
1285 } else if (!oldWindow.parentToken.equals(newWindow.parentToken)) {
1286 return true;
1287 }
1288 if (!oldWindow.boundsInScreen.equals(newWindow.boundsInScreen)) {
1289 return true;
1290 }
1291 if (oldWindow.childTokens != null && newWindow.childTokens != null
1292 && !oldWindow.childTokens.equals(newWindow.childTokens)) {
1293 return true;
1294 }
Phil Weaver396d5492016-03-22 17:53:50 -07001295 if (!TextUtils.equals(oldWindow.title, newWindow.title)) {
1296 return true;
1297 }
1298 if (oldWindow.accessibilityIdOfAnchor != newWindow.accessibilityIdOfAnchor) {
1299 return true;
1300 }
Svetoslav8e3feb12014-02-24 13:46:47 -08001301 return false;
1302 }
1303
Svetoslav3a0d8782014-12-04 12:50:11 -08001304 private static void clearAndRecycleWindows(List<WindowInfo> windows) {
Svetoslav8e3feb12014-02-24 13:46:47 -08001305 final int windowCount = windows.size();
1306 for (int i = windowCount - 1; i >= 0; i--) {
1307 windows.remove(i).recycle();
1308 }
1309 }
1310
1311 private static boolean isReportedWindowType(int windowType) {
Jorim Jaggi73294b62016-10-26 18:02:36 -07001312 return (windowType != WindowManager.LayoutParams.TYPE_WALLPAPER
Svetoslav8e3feb12014-02-24 13:46:47 -08001313 && windowType != WindowManager.LayoutParams.TYPE_BOOT_PROGRESS
1314 && windowType != WindowManager.LayoutParams.TYPE_DISPLAY_OVERLAY
1315 && windowType != WindowManager.LayoutParams.TYPE_DRAG
Selim Cinekf83e8242015-05-19 18:08:14 -07001316 && windowType != WindowManager.LayoutParams.TYPE_INPUT_CONSUMER
Svetoslav8e3feb12014-02-24 13:46:47 -08001317 && windowType != WindowManager.LayoutParams.TYPE_POINTER
Phil Weaverd321075e2017-06-13 09:13:35 -07001318 && windowType != TYPE_MAGNIFICATION_OVERLAY
Svetoslav8e3feb12014-02-24 13:46:47 -08001319 && windowType != WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY
1320 && windowType != WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY
1321 && windowType != WindowManager.LayoutParams.TYPE_PRIVATE_PRESENTATION);
1322 }
1323
1324 private void populateVisibleWindowsOnScreenLocked(SparseArray<WindowState> outWindows) {
Robert Carre625fcf2017-09-01 12:36:28 -07001325 final DisplayContent dc = mService.getDefaultDisplayContentLocked();
Wale Ogunwaled1880962016-11-08 10:31:59 -08001326 dc.forAllWindows((w) -> {
1327 if (w.isVisibleLw()) {
1328 outWindows.put(w.mLayer, w);
Svetoslav8e3feb12014-02-24 13:46:47 -08001329 }
Wale Ogunwaled1880962016-11-08 10:31:59 -08001330 }, false /* traverseTopToBottom */ );
Svetoslav8e3feb12014-02-24 13:46:47 -08001331 }
1332
1333 private class MyHandler extends Handler {
Svetoslavf7174e82014-06-12 11:29:35 -07001334 public static final int MESSAGE_COMPUTE_CHANGED_WINDOWS = 1;
Svetoslav8e3feb12014-02-24 13:46:47 -08001335
1336 public MyHandler(Looper looper) {
1337 super(looper, null, false);
1338 }
1339
1340 @Override
1341 @SuppressWarnings("unchecked")
1342 public void handleMessage(Message message) {
1343 switch (message.what) {
Svetoslavf7174e82014-06-12 11:29:35 -07001344 case MESSAGE_COMPUTE_CHANGED_WINDOWS: {
1345 computeChangedWindows();
1346 } break;
Svetoslav8e3feb12014-02-24 13:46:47 -08001347 }
1348 }
1349 }
1350 }
1351}