public void onWindowTransitionLocked(WindowState windowState, int transition) { if (DEBUG_WINDOW_TRANSITIONS) { Slog.i( LOG_TAG, "Window transition: " + AppTransition.appTransitionToString(transition) + " displayId: " + windowState.getDisplayId()); } final boolean magnifying = mMagnifedViewport.isMagnifyingLocked(); final int type = windowState.mAttrs.type; switch (transition) { case WindowManagerPolicy.TRANSIT_ENTER: case WindowManagerPolicy.TRANSIT_SHOW: { if (!magnifying) { break; } switch (type) { case WindowManager.LayoutParams.TYPE_APPLICATION: case WindowManager.LayoutParams.TYPE_APPLICATION_PANEL: case WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA: case WindowManager.LayoutParams.TYPE_APPLICATION_SUB_PANEL: case WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG: case WindowManager.LayoutParams.TYPE_SEARCH_BAR: case WindowManager.LayoutParams.TYPE_PHONE: case WindowManager.LayoutParams.TYPE_SYSTEM_ALERT: case WindowManager.LayoutParams.TYPE_TOAST: case WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY: case WindowManager.LayoutParams.TYPE_PRIORITY_PHONE: case WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG: case WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG: case WindowManager.LayoutParams.TYPE_SYSTEM_ERROR: case WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY: case WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL: case WindowManager.LayoutParams.TYPE_RECENTS_OVERLAY: { Rect magnifiedRegionBounds = mTempRect2; mMagnifedViewport.getMagnifiedFrameInContentCoordsLocked(magnifiedRegionBounds); Rect touchableRegionBounds = mTempRect1; windowState.getTouchableRegion(mTempRegion1); mTempRegion1.getBounds(touchableRegionBounds); if (!magnifiedRegionBounds.intersect(touchableRegionBounds)) { try { mCallbacks.onRectangleOnScreenRequested( touchableRegionBounds.left, touchableRegionBounds.top, touchableRegionBounds.right, touchableRegionBounds.bottom); } catch (RemoteException re) { /* ignore */ } } } break; } break; } } }
public void onAppWindowTransitionLocked(WindowState windowState, int transition) { if (DEBUG_WINDOW_TRANSITIONS) { Slog.i( LOG_TAG, "Window transition: " + AppTransition.appTransitionToString(transition) + " displayId: " + windowState.getDisplayId()); } final boolean magnifying = mMagnifedViewport.isMagnifyingLocked(); if (magnifying) { switch (transition) { case AppTransition.TRANSIT_ACTIVITY_OPEN: case AppTransition.TRANSIT_TASK_OPEN: case AppTransition.TRANSIT_TASK_TO_FRONT: case AppTransition.TRANSIT_WALLPAPER_OPEN: case AppTransition.TRANSIT_WALLPAPER_CLOSE: case AppTransition.TRANSIT_WALLPAPER_INTRA_OPEN: { mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_USER_CONTEXT_CHANGED); } } } }
/* Updates the cached window information provided to the input dispatcher. */ public void updateInputWindowsLw(boolean force) { if (!force && !mUpdateInputWindowsNeeded) { return; } mUpdateInputWindowsNeeded = false; if (false) Slog.d(TAG_WM, ">>>>>> ENTERED updateInputWindowsLw"); // Populate the input window list with information about all of the windows that // could potentially receive input. // As an optimization, we could try to prune the list of windows but this turns // out to be difficult because only the native code knows for sure which window // currently has touch focus. boolean disableWallpaperTouchEvents = false; // If there's a drag in flight, provide a pseudowindow to catch drag input final boolean inDrag = (mService.mDragState != null); if (inDrag) { if (DEBUG_DRAG) { Log.d(TAG_WM, "Inserting drag window"); } final InputWindowHandle dragWindowHandle = mService.mDragState.mDragWindowHandle; if (dragWindowHandle != null) { addInputWindowHandleLw(dragWindowHandle); } else { Slog.w(TAG_WM, "Drag is in progress but there is no " + "drag window handle."); } } final boolean inPositioning = (mService.mTaskPositioner != null); if (inPositioning) { if (DEBUG_TASK_POSITIONING) { Log.d(TAG_WM, "Inserting window handle for repositioning"); } final InputWindowHandle dragWindowHandle = mService.mTaskPositioner.mDragWindowHandle; if (dragWindowHandle != null) { addInputWindowHandleLw(dragWindowHandle); } else { Slog.e(TAG_WM, "Repositioning is in progress but there is no drag window handle."); } } boolean addInputConsumerHandle = mService.mInputConsumer != null; boolean addWallpaperInputConsumerHandle = mService.mWallpaperInputConsumer != null; // Add all windows on the default display. final int numDisplays = mService.mDisplayContents.size(); final WallpaperController wallpaperController = mService.mWallpaperControllerLocked; for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) { final DisplayContent displayContent = mService.mDisplayContents.valueAt(displayNdx); final WindowList windows = displayContent.getWindowList(); for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) { final WindowState child = windows.get(winNdx); final InputChannel inputChannel = child.mInputChannel; final InputWindowHandle inputWindowHandle = child.mInputWindowHandle; if (inputChannel == null || inputWindowHandle == null || child.mRemoved || child.isAdjustedForMinimizedDock()) { // Skip this window because it cannot possibly receive input. continue; } if (addInputConsumerHandle && inputWindowHandle.layer <= mService.mInputConsumer.mWindowHandle.layer) { addInputWindowHandleLw(mService.mInputConsumer.mWindowHandle); addInputConsumerHandle = false; } if (addWallpaperInputConsumerHandle) { if (child.mAttrs.type == WindowManager.LayoutParams.TYPE_WALLPAPER) { // Add the wallpaper input consumer above the first wallpaper window. addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle); addWallpaperInputConsumerHandle = false; } } final int flags = child.mAttrs.flags; final int privateFlags = child.mAttrs.privateFlags; final int type = child.mAttrs.type; final boolean hasFocus = (child == mInputFocus); final boolean isVisible = child.isVisibleLw(); if ((privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS) != 0) { disableWallpaperTouchEvents = true; } final boolean hasWallpaper = wallpaperController.isWallpaperTarget(child) && (privateFlags & WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD) == 0 && !disableWallpaperTouchEvents; final boolean onDefaultDisplay = (child.getDisplayId() == Display.DEFAULT_DISPLAY); // If there's a drag in progress and 'child' is a potential drop target, // make sure it's been told about the drag if (inDrag && isVisible && onDefaultDisplay) { mService.mDragState.sendDragStartedIfNeededLw(child); } addInputWindowHandleLw( inputWindowHandle, child, flags, type, isVisible, hasFocus, hasWallpaper); } } if (addWallpaperInputConsumerHandle) { // No wallpaper found, add the wallpaper input consumer at the end. addInputWindowHandleLw(mService.mWallpaperInputConsumer.mWindowHandle); } // Send windows to native code. mService.mInputManager.setInputWindows(mInputWindowHandles); // Clear the list in preparation for the next round. clearInputWindowHandlesLw(); if (false) Slog.d(TAG_WM, "<<<<<<< EXITED updateInputWindowsLw"); }