private void getWindowsOnScreenLocked(SparseArray<WindowStateInfo> outWindowStates) {
   DisplayContent displayContent = mWindowManagerService.getDefaultDisplayContentLocked();
   WindowList windowList = displayContent.getWindowList();
   final int windowCount = windowList.size();
   for (int i = 0; i < windowCount; i++) {
     WindowState windowState = windowList.get(i);
     if ((windowState.isOnScreen()
             || windowState.mAttrs.type == WindowManager.LayoutParams.TYPE_UNIVERSE_BACKGROUND)
         && !windowState.mWinAnimator.mEnterAnimationPending) {
       outWindowStates.put(windowState.mLayer, WindowStateInfo.obtain(windowState));
     }
   }
 }
 public StackTapPointerEventListener(WindowManagerService service, DisplayContent displayContent) {
   mService = service;
   mDisplayContent = displayContent;
   mTouchExcludeRegion = displayContent.mTouchExcludeRegion;
   DisplayInfo info = displayContent.getDisplayInfo();
   mMotionSlop = (int) (info.logicalDensityDpi * TAP_MOTION_SLOP_INCHES);
 }
 public void onRotationChangedLocked(DisplayContent displayContent, int rotation) {
   if (DEBUG_ROTATION) {
     Slog.i(
         LOG_TAG,
         "Rotaton: "
             + Surface.rotationToString(rotation)
             + " displayId: "
             + displayContent.getDisplayId());
   }
   /// M:[ALPS01397351]Fix system server JE @{
   // mMagnifedViewport.onRotationChangedLocked();
   mHandler.sendEmptyMessage(MyHandler.MESSAGE_ON_ROTATION_CHANGED);
   /// @}
   mHandler.sendEmptyMessage(MyHandler.MESSAGE_NOTIFY_ROTATION_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");
  }