blob: df2e5e80b59b5cd04334841f7e2fa6079b442acd [file] [log] [blame]
Chong Zhang8e89b312015-09-09 15:09:30 -07001/*
2 * Copyright (C) 2015 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
Wale Ogunwale59a73ca2015-09-14 12:54:50 -070019import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
20import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
Wale Ogunwale228d4042015-09-13 10:17:34 -070021import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID;
Chong Zhang87b21722015-09-21 15:39:51 -070022import static android.app.ActivityManager.RESIZE_MODE_FORCED;
23import static android.app.ActivityManager.RESIZE_MODE_USER;
Wale Ogunwale228d4042015-09-13 10:17:34 -070024import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
Wale Ogunwalecad05a02015-09-25 10:41:44 -070025import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
Chong Zhang8e89b312015-09-09 15:09:30 -070026import static com.android.server.wm.WindowManagerService.DEBUG_TASK_POSITIONING;
Wale Ogunwale228d4042015-09-13 10:17:34 -070027import static com.android.server.wm.WindowManagerService.SHOW_TRANSACTIONS;
Wale Ogunwale231b06e2015-09-16 12:03:09 -070028import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_HEIGHT_IN_DP;
29import static com.android.server.wm.WindowState.MINIMUM_VISIBLE_WIDTH_IN_DP;
Chong Zhang8e89b312015-09-09 15:09:30 -070030
31import android.annotation.IntDef;
32import android.graphics.Point;
33import android.graphics.Rect;
34import android.os.Looper;
35import android.os.Process;
36import android.os.RemoteException;
Wale Ogunwalecad05a02015-09-25 10:41:44 -070037import android.os.Trace;
Chong Zhang8e89b312015-09-09 15:09:30 -070038import android.util.DisplayMetrics;
39import android.util.Slog;
Wale Ogunwale4f52bc62015-09-24 13:47:31 -070040import android.view.Choreographer;
Chong Zhang8e89b312015-09-09 15:09:30 -070041import android.view.Display;
Wale Ogunwale228d4042015-09-13 10:17:34 -070042import android.view.DisplayInfo;
Chong Zhang8e89b312015-09-09 15:09:30 -070043import android.view.InputChannel;
44import android.view.InputDevice;
45import android.view.InputEvent;
Wale Ogunwale4f52bc62015-09-24 13:47:31 -070046import android.view.BatchedInputEventReceiver;
Chong Zhang8e89b312015-09-09 15:09:30 -070047import android.view.MotionEvent;
Wale Ogunwale228d4042015-09-13 10:17:34 -070048import android.view.SurfaceControl;
Chong Zhang8e89b312015-09-09 15:09:30 -070049import android.view.WindowManager;
50
Wale Ogunwale228d4042015-09-13 10:17:34 -070051import com.android.server.input.InputApplicationHandle;
52import com.android.server.input.InputWindowHandle;
53import com.android.server.wm.WindowManagerService.H;
54
55import java.lang.annotation.Retention;
56import java.lang.annotation.RetentionPolicy;
57
58class TaskPositioner implements DimLayer.DimLayerUser {
Chong Zhang8e89b312015-09-09 15:09:30 -070059 private static final String TAG = "TaskPositioner";
60
Wale Ogunwale228d4042015-09-13 10:17:34 -070061 // The margin the pointer position has to be within the side of the screen to be
62 // considered at the side of the screen.
Wale Ogunwalef5a67f52015-09-15 09:54:33 -070063 private static final int SIDE_MARGIN_DIP = 100;
Wale Ogunwale228d4042015-09-13 10:17:34 -070064
Chong Zhang8e89b312015-09-09 15:09:30 -070065 @IntDef(flag = true,
66 value = {
67 CTRL_NONE,
68 CTRL_LEFT,
69 CTRL_RIGHT,
70 CTRL_TOP,
71 CTRL_BOTTOM
72 })
73 @Retention(RetentionPolicy.SOURCE)
74 @interface CtrlType {}
75
76 private static final int CTRL_NONE = 0x0;
77 private static final int CTRL_LEFT = 0x1;
78 private static final int CTRL_RIGHT = 0x2;
79 private static final int CTRL_TOP = 0x4;
80 private static final int CTRL_BOTTOM = 0x8;
81
82 private final WindowManagerService mService;
83 private WindowPositionerEventReceiver mInputEventReceiver;
84 private Display mDisplay;
85 private final DisplayMetrics mDisplayMetrics = new DisplayMetrics();
Wale Ogunwale228d4042015-09-13 10:17:34 -070086 private DimLayer mDimLayer;
87 @CtrlType
88 private int mCurrentDimSide;
89 private Rect mTmpRect = new Rect();
90 private int mSideMargin;
Wale Ogunwaleb8051b82015-09-17 15:41:52 -070091 private int mMinVisibleWidth;
92 private int mMinVisibleHeight;
Chong Zhang8e89b312015-09-09 15:09:30 -070093
Chong Zhang3005e752015-09-18 18:46:28 -070094 private Task mTask;
Chong Zhang09b21ef2015-09-14 10:20:21 -070095 private boolean mResizing;
Chong Zhang8e89b312015-09-09 15:09:30 -070096 private final Rect mWindowOriginalBounds = new Rect();
97 private final Rect mWindowDragBounds = new Rect();
98 private float mStartDragX;
99 private float mStartDragY;
100 @CtrlType
101 private int mCtrlType = CTRL_NONE;
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700102 private boolean mDragEnded = false;
Chong Zhang8e89b312015-09-09 15:09:30 -0700103
104 InputChannel mServerChannel;
105 InputChannel mClientChannel;
106 InputApplicationHandle mDragApplicationHandle;
107 InputWindowHandle mDragWindowHandle;
108
Wale Ogunwale4f52bc62015-09-24 13:47:31 -0700109 private final class WindowPositionerEventReceiver extends BatchedInputEventReceiver {
110 public WindowPositionerEventReceiver(
111 InputChannel inputChannel, Looper looper, Choreographer choreographer) {
112 super(inputChannel, looper, choreographer);
Chong Zhang8e89b312015-09-09 15:09:30 -0700113 }
114
115 @Override
116 public void onInputEvent(InputEvent event) {
117 if (!(event instanceof MotionEvent)
118 || (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) == 0) {
119 return;
120 }
121 final MotionEvent motionEvent = (MotionEvent) event;
122 boolean handled = false;
123
124 try {
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700125 if (mDragEnded) {
126 // The drag has ended but the clean-up message has not been processed by
127 // window manager. Drop events that occur after this until window manager
128 // has a chance to clean-up the input handle.
129 handled = true;
130 return;
131 }
132
Chong Zhang8e89b312015-09-09 15:09:30 -0700133 final float newX = motionEvent.getRawX();
134 final float newY = motionEvent.getRawY();
135
136 switch (motionEvent.getAction()) {
137 case MotionEvent.ACTION_DOWN: {
138 if (DEBUG_TASK_POSITIONING) {
139 Slog.w(TAG, "ACTION_DOWN @ {" + newX + ", " + newY + "}");
140 }
141 } break;
142
143 case MotionEvent.ACTION_MOVE: {
144 if (DEBUG_TASK_POSITIONING){
145 Slog.w(TAG, "ACTION_MOVE @ {" + newX + ", " + newY + "}");
146 }
147 synchronized (mService.mWindowMap) {
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700148 mDragEnded = notifyMoveLocked(newX, newY);
Chong Zhang8e89b312015-09-09 15:09:30 -0700149 }
Wale Ogunwalecad05a02015-09-25 10:41:44 -0700150 Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "wm.TaskPositioner.resizeTask");
Chong Zhang8e89b312015-09-09 15:09:30 -0700151 try {
Chong Zhang09b21ef2015-09-14 10:20:21 -0700152 mService.mActivityManager.resizeTask(
Chong Zhang87b21722015-09-21 15:39:51 -0700153 mTask.mTaskId, mWindowDragBounds, RESIZE_MODE_USER);
Chong Zhang8e89b312015-09-09 15:09:30 -0700154 } catch(RemoteException e) {}
Wale Ogunwalecad05a02015-09-25 10:41:44 -0700155 Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
Chong Zhang8e89b312015-09-09 15:09:30 -0700156 } break;
157
158 case MotionEvent.ACTION_UP: {
159 if (DEBUG_TASK_POSITIONING) {
160 Slog.w(TAG, "ACTION_UP @ {" + newX + ", " + newY + "}");
161 }
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700162 mDragEnded = true;
Chong Zhang8e89b312015-09-09 15:09:30 -0700163 } break;
164
165 case MotionEvent.ACTION_CANCEL: {
166 if (DEBUG_TASK_POSITIONING) {
167 Slog.w(TAG, "ACTION_CANCEL @ {" + newX + ", " + newY + "}");
168 }
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700169 mDragEnded = true;
Chong Zhang8e89b312015-09-09 15:09:30 -0700170 } break;
171 }
172
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700173 if (mDragEnded) {
Chong Zhang3005e752015-09-18 18:46:28 -0700174 synchronized (mService.mWindowMap) {
175 endDragLocked();
176 }
Chong Zhang09b21ef2015-09-14 10:20:21 -0700177 try {
Chong Zhang3005e752015-09-18 18:46:28 -0700178 if (mResizing) {
179 // We were using fullscreen surface during resizing. Request
180 // resizeTask() one last time to restore surface to window size.
181 mService.mActivityManager.resizeTask(
Chong Zhang87b21722015-09-21 15:39:51 -0700182 mTask.mTaskId, mWindowDragBounds, RESIZE_MODE_FORCED);
Chong Zhang3005e752015-09-18 18:46:28 -0700183 }
184
185 if (mCurrentDimSide != CTRL_NONE) {
186 final int createMode = mCurrentDimSide == CTRL_LEFT
187 ? DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT
188 : DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
189 mService.mActivityManager.moveTaskToDockedStack(
190 mTask.mTaskId, createMode, true /*toTop*/);
191 }
Chong Zhang09b21ef2015-09-14 10:20:21 -0700192 } catch(RemoteException e) {}
Chong Zhang3005e752015-09-18 18:46:28 -0700193
Chong Zhang8e89b312015-09-09 15:09:30 -0700194 // Post back to WM to handle clean-ups. We still need the input
195 // event handler for the last finishInputEvent()!
196 mService.mH.sendEmptyMessage(H.FINISH_TASK_POSITIONING);
197 }
198 handled = true;
199 } catch (Exception e) {
200 Slog.e(TAG, "Exception caught by drag handleMotion", e);
201 } finally {
202 finishInputEvent(event, handled);
203 }
204 }
205 }
206
207 TaskPositioner(WindowManagerService service) {
208 mService = service;
209 }
210
211 /**
212 * @param display The Display that the window being dragged is on.
213 */
214 void register(Display display) {
215 if (DEBUG_TASK_POSITIONING) {
216 Slog.d(TAG, "Registering task positioner");
217 }
218
219 if (mClientChannel != null) {
220 Slog.e(TAG, "Task positioner already registered");
221 return;
222 }
223
224 mDisplay = display;
225 mDisplay.getMetrics(mDisplayMetrics);
226 final InputChannel[] channels = InputChannel.openInputChannelPair(TAG);
227 mServerChannel = channels[0];
228 mClientChannel = channels[1];
229 mService.mInputManager.registerInputChannel(mServerChannel, null);
230
Wale Ogunwale4f52bc62015-09-24 13:47:31 -0700231 mInputEventReceiver = new WindowPositionerEventReceiver(
232 mClientChannel, mService.mH.getLooper(), mService.mChoreographer);
Chong Zhang8e89b312015-09-09 15:09:30 -0700233
234 mDragApplicationHandle = new InputApplicationHandle(null);
235 mDragApplicationHandle.name = TAG;
236 mDragApplicationHandle.dispatchingTimeoutNanos =
237 WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
238
239 mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null,
240 mDisplay.getDisplayId());
241 mDragWindowHandle.name = TAG;
242 mDragWindowHandle.inputChannel = mServerChannel;
243 mDragWindowHandle.layer = getDragLayerLocked();
244 mDragWindowHandle.layoutParamsFlags = 0;
245 mDragWindowHandle.layoutParamsType = WindowManager.LayoutParams.TYPE_DRAG;
246 mDragWindowHandle.dispatchingTimeoutNanos =
247 WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
248 mDragWindowHandle.visible = true;
249 mDragWindowHandle.canReceiveKeys = false;
250 mDragWindowHandle.hasFocus = true;
251 mDragWindowHandle.hasWallpaper = false;
252 mDragWindowHandle.paused = false;
253 mDragWindowHandle.ownerPid = Process.myPid();
254 mDragWindowHandle.ownerUid = Process.myUid();
255 mDragWindowHandle.inputFeatures = 0;
256 mDragWindowHandle.scaleFactor = 1.0f;
257
258 // The drag window cannot receive new touches.
259 mDragWindowHandle.touchableRegion.setEmpty();
260
261 // The drag window covers the entire display
262 mDragWindowHandle.frameLeft = 0;
263 mDragWindowHandle.frameTop = 0;
264 final Point p = new Point();
265 mDisplay.getRealSize(p);
266 mDragWindowHandle.frameRight = p.x;
267 mDragWindowHandle.frameBottom = p.y;
268
269 // Pause rotations before a drag.
270 if (WindowManagerService.DEBUG_ORIENTATION) {
271 Slog.d(TAG, "Pausing rotation during re-position");
272 }
273 mService.pauseRotationLocked();
Wale Ogunwale228d4042015-09-13 10:17:34 -0700274
275 mDimLayer = new DimLayer(mService, this, mDisplay.getDisplayId());
Wale Ogunwale231b06e2015-09-16 12:03:09 -0700276 mSideMargin = mService.dipToPixel(SIDE_MARGIN_DIP, mDisplayMetrics);
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700277 mMinVisibleWidth = mService.dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP, mDisplayMetrics);
278 mMinVisibleHeight = mService.dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP, mDisplayMetrics);
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700279
280 mDragEnded = false;
Chong Zhang8e89b312015-09-09 15:09:30 -0700281 }
282
283 void unregister() {
284 if (DEBUG_TASK_POSITIONING) {
285 Slog.d(TAG, "Unregistering task positioner");
286 }
287
288 if (mClientChannel == null) {
289 Slog.e(TAG, "Task positioner not registered");
290 return;
291 }
292
293 mService.mInputManager.unregisterInputChannel(mServerChannel);
294
295 mInputEventReceiver.dispose();
296 mInputEventReceiver = null;
297 mClientChannel.dispose();
298 mServerChannel.dispose();
299 mClientChannel = null;
300 mServerChannel = null;
301
302 mDragWindowHandle = null;
303 mDragApplicationHandle = null;
304 mDisplay = null;
305
Wale Ogunwale228d4042015-09-13 10:17:34 -0700306 if (mDimLayer != null) {
307 mDimLayer.destroySurface();
308 mDimLayer = null;
309 }
310 mCurrentDimSide = CTRL_NONE;
Wale Ogunwale6a804b82015-09-23 21:04:21 -0700311 mDragEnded = true;
Wale Ogunwale228d4042015-09-13 10:17:34 -0700312
Chong Zhang8e89b312015-09-09 15:09:30 -0700313 // Resume rotations after a drag.
314 if (WindowManagerService.DEBUG_ORIENTATION) {
315 Slog.d(TAG, "Resuming rotation after re-position");
316 }
317 mService.resumeRotationLocked();
318 }
319
320 void startDragLocked(WindowState win, boolean resize, float startX, float startY) {
Wale Ogunwale228d4042015-09-13 10:17:34 -0700321 if (DEBUG_TASK_POSITIONING) {
322 Slog.d(TAG, "startDragLocked: win=" + win + ", resize=" + resize
Chong Zhang8e89b312015-09-09 15:09:30 -0700323 + ", {" + startX + ", " + startY + "}");
324 }
325 mCtrlType = CTRL_NONE;
326 if (resize) {
327 final Rect visibleFrame = win.mVisibleFrame;
328 if (startX < visibleFrame.left) {
329 mCtrlType |= CTRL_LEFT;
330 }
331 if (startX > visibleFrame.right) {
332 mCtrlType |= CTRL_RIGHT;
333 }
334 if (startY < visibleFrame.top) {
335 mCtrlType |= CTRL_TOP;
336 }
337 if (startY > visibleFrame.bottom) {
338 mCtrlType |= CTRL_BOTTOM;
339 }
Chong Zhang09b21ef2015-09-14 10:20:21 -0700340 mResizing = true;
Chong Zhang8e89b312015-09-09 15:09:30 -0700341 }
342
Chong Zhang3005e752015-09-18 18:46:28 -0700343 mTask = win.getTask();
Chong Zhang8e89b312015-09-09 15:09:30 -0700344 mStartDragX = startX;
345 mStartDragY = startY;
346
Chong Zhang3005e752015-09-18 18:46:28 -0700347 mService.getTaskBounds(mTask.mTaskId, mWindowOriginalBounds);
348 }
349
350 private void endDragLocked() {
351 mResizing = false;
352 mTask.setDragResizing(false);
Chong Zhang8e89b312015-09-09 15:09:30 -0700353 }
354
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700355 /** Returns true if the move operation should be ended. */
356 private boolean notifyMoveLocked(float x, float y) {
Chong Zhang8e89b312015-09-09 15:09:30 -0700357 if (DEBUG_TASK_POSITIONING) {
358 Slog.d(TAG, "notifyMoveLw: {" + x + "," + y + "}");
359 }
360
361 if (mCtrlType != CTRL_NONE) {
362 // This is a resizing operation.
363 final int deltaX = Math.round(x - mStartDragX);
364 final int deltaY = Math.round(y - mStartDragY);
Chong Zhang8e89b312015-09-09 15:09:30 -0700365 int left = mWindowOriginalBounds.left;
366 int top = mWindowOriginalBounds.top;
367 int right = mWindowOriginalBounds.right;
368 int bottom = mWindowOriginalBounds.bottom;
369 if ((mCtrlType & CTRL_LEFT) != 0) {
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700370 left = Math.min(left + deltaX, right - mMinVisibleWidth);
Chong Zhang8e89b312015-09-09 15:09:30 -0700371 }
372 if ((mCtrlType & CTRL_TOP) != 0) {
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700373 top = Math.min(top + deltaY, bottom - mMinVisibleHeight);
Chong Zhang8e89b312015-09-09 15:09:30 -0700374 }
375 if ((mCtrlType & CTRL_RIGHT) != 0) {
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700376 right = Math.max(left + mMinVisibleWidth, right + deltaX);
Chong Zhang8e89b312015-09-09 15:09:30 -0700377 }
378 if ((mCtrlType & CTRL_BOTTOM) != 0) {
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700379 bottom = Math.max(top + mMinVisibleHeight, bottom + deltaY);
Chong Zhang8e89b312015-09-09 15:09:30 -0700380 }
381 mWindowDragBounds.set(left, top, right, bottom);
Chong Zhang3005e752015-09-18 18:46:28 -0700382 mTask.setDragResizing(true);
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700383 return false;
Chong Zhang8e89b312015-09-09 15:09:30 -0700384 }
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700385
386 // This is a moving operation.
Chong Zhang3005e752015-09-18 18:46:28 -0700387 mTask.mStack.getBounds(mTmpRect);
Wale Ogunwaleb8051b82015-09-17 15:41:52 -0700388 mTmpRect.inset(mMinVisibleWidth, mMinVisibleHeight);
389 if (!mTmpRect.contains((int) x, (int) y)) {
390 // We end the moving operation if position is outside the stack bounds.
391 return true;
392 }
393 mWindowDragBounds.set(mWindowOriginalBounds);
394 mWindowDragBounds.offset(Math.round(x - mStartDragX), Math.round(y - mStartDragY));
395 updateDimLayerVisibility((int) x);
396 return false;
Chong Zhang8e89b312015-09-09 15:09:30 -0700397 }
398
Wale Ogunwale228d4042015-09-13 10:17:34 -0700399 private void updateDimLayerVisibility(int x) {
400 @CtrlType
401 int dimSide = getDimSide(x);
402 if (dimSide == mCurrentDimSide) {
403 return;
404 }
405
406 mCurrentDimSide = dimSide;
407
408 if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION updateDimLayerVisibility");
409 SurfaceControl.openTransaction();
410 if (mCurrentDimSide == CTRL_NONE) {
411 mDimLayer.hide();
412 } else {
413 showDimLayer();
414 }
415 SurfaceControl.closeTransaction();
416 }
417
418 /**
419 * Returns the side of the screen the dim layer should be shown.
420 * @param x horizontal coordinate used to determine if the dim layer should be shown
421 * @return Returns {@link #CTRL_LEFT} if the dim layer should be shown on the left half of the
422 * screen, {@link #CTRL_RIGHT} if on the right side, or {@link #CTRL_NONE} if the dim layer
423 * shouldn't be shown.
424 */
425 private int getDimSide(int x) {
Chong Zhang3005e752015-09-18 18:46:28 -0700426 if (mTask.mStack.mStackId != FREEFORM_WORKSPACE_STACK_ID
427 || !mTask.mStack.isFullscreen()
Wale Ogunwale228d4042015-09-13 10:17:34 -0700428 || mService.mCurConfiguration.orientation != ORIENTATION_LANDSCAPE) {
429 return CTRL_NONE;
430 }
431
Chong Zhang3005e752015-09-18 18:46:28 -0700432 mTask.mStack.getBounds(mTmpRect);
Wale Ogunwale228d4042015-09-13 10:17:34 -0700433 if (x - mSideMargin <= mTmpRect.left) {
434 return CTRL_LEFT;
435 }
436 if (x + mSideMargin >= mTmpRect.right) {
437 return CTRL_RIGHT;
438 }
439
440 return CTRL_NONE;
441 }
442
443 private void showDimLayer() {
Chong Zhang3005e752015-09-18 18:46:28 -0700444 mTask.mStack.getBounds(mTmpRect);
Wale Ogunwale228d4042015-09-13 10:17:34 -0700445 if (mCurrentDimSide == CTRL_LEFT) {
446 mTmpRect.right = mTmpRect.centerX();
447 } else if (mCurrentDimSide == CTRL_RIGHT) {
448 mTmpRect.left = mTmpRect.centerX();
449 }
450
451 mDimLayer.setBounds(mTmpRect);
452 mDimLayer.show(getDragLayerLocked(), 0.5f, 0);
453 }
454
455 @Override /** {@link DimLayer.DimLayerUser} */
456 public boolean isFullscreen() {
457 return false;
458 }
459
460 @Override /** {@link DimLayer.DimLayerUser} */
461 public DisplayInfo getDisplayInfo() {
Chong Zhang3005e752015-09-18 18:46:28 -0700462 return mTask.mStack.getDisplayInfo();
Wale Ogunwale228d4042015-09-13 10:17:34 -0700463 }
464
Chong Zhang8e89b312015-09-09 15:09:30 -0700465 private int getDragLayerLocked() {
466 return mService.mPolicy.windowTypeToLayerLw(WindowManager.LayoutParams.TYPE_DRAG)
467 * WindowManagerService.TYPE_LAYER_MULTIPLIER
468 + WindowManagerService.TYPE_LAYER_OFFSET;
469 }
Wale Ogunwale228d4042015-09-13 10:17:34 -0700470}