Search in sources :

Example 41 with DisplayInfo

use of android.view.DisplayInfo in project android_frameworks_base by ResurrectionRemix.

the class TaskStack method getStackDockedModeBounds.

/**
     * Outputs the bounds a stack should be given the presence of a docked stack on the display.
     * @param displayRect The bounds of the display the docked stack is on.
     * @param outBounds Output bounds that should be used for the stack.
     * @param stackId Id of stack we are calculating the bounds for.
     * @param dockedBounds Bounds of the docked stack.
     * @param dockDividerWidth We need to know the width of the divider make to the output bounds
     *                         close to the side of the dock.
     * @param dockOnTopOrLeft If the docked stack is on the top or left side of the screen.
     */
private void getStackDockedModeBounds(Rect displayRect, Rect outBounds, int stackId, Rect dockedBounds, int dockDividerWidth, boolean dockOnTopOrLeft) {
    final boolean dockedStack = stackId == DOCKED_STACK_ID;
    final boolean splitHorizontally = displayRect.width() > displayRect.height();
    outBounds.set(displayRect);
    if (dockedStack) {
        if (mService.mDockedStackCreateBounds != null) {
            outBounds.set(mService.mDockedStackCreateBounds);
            return;
        }
        // The initial bounds of the docked stack when it is created about half the screen space
        // and its bounds can be adjusted after that. The bounds of all other stacks are
        // adjusted to occupy whatever screen space the docked stack isn't occupying.
        final DisplayInfo di = mDisplayContent.getDisplayInfo();
        mService.mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, mTmpRect2);
        final int position = new DividerSnapAlgorithm(mService.mContext.getResources(), di.logicalWidth, di.logicalHeight, dockDividerWidth, mService.mCurConfiguration.orientation == ORIENTATION_PORTRAIT, mTmpRect2).getMiddleTarget().position;
        if (dockOnTopOrLeft) {
            if (splitHorizontally) {
                outBounds.right = position;
            } else {
                outBounds.bottom = position;
            }
        } else {
            if (splitHorizontally) {
                outBounds.left = position + dockDividerWidth;
            } else {
                outBounds.top = position + dockDividerWidth;
            }
        }
        return;
    }
    // Other stacks occupy whatever space is left by the docked stack.
    if (!dockOnTopOrLeft) {
        if (splitHorizontally) {
            outBounds.right = dockedBounds.left - dockDividerWidth;
        } else {
            outBounds.bottom = dockedBounds.top - dockDividerWidth;
        }
    } else {
        if (splitHorizontally) {
            outBounds.left = dockedBounds.right + dockDividerWidth;
        } else {
            outBounds.top = dockedBounds.bottom + dockDividerWidth;
        }
    }
    DockedDividerUtils.sanitizeStackBounds(outBounds, !dockOnTopOrLeft);
}
Also used : DisplayInfo(android.view.DisplayInfo) DividerSnapAlgorithm(com.android.internal.policy.DividerSnapAlgorithm)

Example 42 with DisplayInfo

use of android.view.DisplayInfo in project android_frameworks_base by ResurrectionRemix.

the class WallpaperController method updateWallpaperWindowsPlacement.

boolean updateWallpaperWindowsPlacement(WindowList windows, WindowState wallpaperTarget, int wallpaperTargetIndex, boolean visible) {
    // TODO(multidisplay): Wallpapers on main screen only.
    final DisplayInfo displayInfo = mService.getDefaultDisplayContentLocked().getDisplayInfo();
    final int dw = displayInfo.logicalWidth;
    final int dh = displayInfo.logicalHeight;
    // Start stepping backwards from here, ensuring that our wallpaper windows
    // are correctly placed.
    boolean changed = false;
    for (int curTokenNdx = mWallpaperTokens.size() - 1; curTokenNdx >= 0; curTokenNdx--) {
        WindowToken token = mWallpaperTokens.get(curTokenNdx);
        if (token.hidden == visible) {
            if (DEBUG_WALLPAPER_LIGHT)
                Slog.d(TAG, "Wallpaper token " + token + " hidden=" + !visible);
            token.hidden = !visible;
            // Need to do a layout to ensure the wallpaper now has the correct size.
            mService.getDefaultDisplayContentLocked().layoutNeeded = true;
        }
        final WindowList tokenWindows = token.windows;
        for (int wallpaperNdx = tokenWindows.size() - 1; wallpaperNdx >= 0; wallpaperNdx--) {
            WindowState wallpaper = tokenWindows.get(wallpaperNdx);
            if (visible) {
                updateWallpaperOffset(wallpaper, dw, dh, false);
            }
            // First, make sure the client has the current visibility state.
            dispatchWallpaperVisibility(wallpaper, visible);
            wallpaper.mWinAnimator.mAnimLayer = wallpaper.mLayer + mWallpaperAnimLayerAdjustment;
            if (DEBUG_LAYERS || DEBUG_WALLPAPER_LIGHT)
                Slog.v(TAG, "adjustWallpaper win " + wallpaper + " anim layer: " + wallpaper.mWinAnimator.mAnimLayer);
            // First, if this window is at the current index, then all is well.
            if (wallpaper == wallpaperTarget) {
                wallpaperTargetIndex--;
                wallpaperTarget = wallpaperTargetIndex > 0 ? windows.get(wallpaperTargetIndex - 1) : null;
                continue;
            }
            // The window didn't match...  the current wallpaper window,
            // wherever it is, is in the wrong place, so make sure it is not in the list.
            int oldIndex = windows.indexOf(wallpaper);
            if (oldIndex >= 0) {
                if (DEBUG_WINDOW_MOVEMENT)
                    Slog.v(TAG, "Wallpaper removing at " + oldIndex + ": " + wallpaper);
                windows.remove(oldIndex);
                mService.mWindowsChanged = true;
                if (oldIndex < wallpaperTargetIndex) {
                    wallpaperTargetIndex--;
                }
            }
            // Now stick it in. For apps over wallpaper keep the wallpaper at the bottommost
            // layer. For keyguard over wallpaper put the wallpaper under the lowest window that
            // is currently on screen, i.e. not hidden by policy.
            int insertionIndex = 0;
            if (visible && wallpaperTarget != null) {
                final int type = wallpaperTarget.mAttrs.type;
                final int privateFlags = wallpaperTarget.mAttrs.privateFlags;
                if ((privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || type == TYPE_KEYGUARD_SCRIM) {
                    insertionIndex = Math.min(windows.indexOf(wallpaperTarget), findLowestWindowOnScreen(windows));
                }
            }
            if (DEBUG_WALLPAPER_LIGHT || DEBUG_WINDOW_MOVEMENT || (DEBUG_ADD_REMOVE && oldIndex != insertionIndex))
                Slog.v(TAG, "Moving wallpaper " + wallpaper + " from " + oldIndex + " to " + insertionIndex);
            windows.add(insertionIndex, wallpaper);
            mService.mWindowsChanged = true;
            changed = true;
        }
    }
    return changed;
}
Also used : DisplayInfo(android.view.DisplayInfo)

Example 43 with DisplayInfo

use of android.view.DisplayInfo in project android_frameworks_base by ResurrectionRemix.

the class WindowManagerService method subtractNonDecorInsets.

/**
     * Intersects the specified {@code inOutBounds} with the display frame that excludes
     * areas that could never be removed in Honeycomb. See
     * {@link WindowManagerPolicy#getNonDecorInsetsLw}.
     *
     * @param inOutBounds The inOutBounds to subtract the inset areas from.
     */
public void subtractNonDecorInsets(Rect inOutBounds) {
    synchronized (mWindowMap) {
        getNonDecorInsetsLocked(mTmpRect2);
        final DisplayInfo di = getDefaultDisplayInfoLocked();
        mTmpRect.set(0, 0, di.logicalWidth, di.logicalHeight);
        subtractInsets(mTmpRect, mTmpRect2, inOutBounds);
    }
}
Also used : DisplayInfo(android.view.DisplayInfo)

Example 44 with DisplayInfo

use of android.view.DisplayInfo in project android_frameworks_base by ResurrectionRemix.

the class WindowManagerService method getStableInsetsLocked.

void getStableInsetsLocked(Rect outInsets) {
    final DisplayInfo di = getDefaultDisplayInfoLocked();
    mPolicy.getStableInsetsLw(di.rotation, di.logicalWidth, di.logicalHeight, outInsets);
}
Also used : DisplayInfo(android.view.DisplayInfo)

Example 45 with DisplayInfo

use of android.view.DisplayInfo in project android_frameworks_base by ResurrectionRemix.

the class WindowManagerService method configureDisplayPolicyLocked.

private void configureDisplayPolicyLocked(DisplayContent displayContent) {
    mPolicy.setInitialDisplaySize(displayContent.getDisplay(), displayContent.mBaseDisplayWidth, displayContent.mBaseDisplayHeight, displayContent.mBaseDisplayDensity);
    DisplayInfo displayInfo = displayContent.getDisplayInfo();
    mPolicy.setDisplayOverscan(displayContent.getDisplay(), displayInfo.overscanLeft, displayInfo.overscanTop, displayInfo.overscanRight, displayInfo.overscanBottom);
}
Also used : DisplayInfo(android.view.DisplayInfo)

Aggregations

DisplayInfo (android.view.DisplayInfo)186 Point (android.graphics.Point)53 Rect (android.graphics.Rect)29 RemoteException (android.os.RemoteException)19 Display (android.view.Display)11 Animation (android.view.animation.Animation)10 Bitmap (android.graphics.Bitmap)9 WindowManager (android.view.WindowManager)8 DividerSnapAlgorithm (com.android.internal.policy.DividerSnapAlgorithm)8 Canvas (android.graphics.Canvas)6 SurfaceControl (android.view.SurfaceControl)6 LayoutParams (android.view.WindowManager.LayoutParams)6 DisplayManager (android.hardware.display.DisplayManager)5 DisplayMetrics (android.util.DisplayMetrics)5 Surface (android.view.Surface)5 InputDevice (android.view.InputDevice)4 SnapTarget (com.android.internal.policy.DividerSnapAlgorithm.SnapTarget)4 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 OutOfResourcesException (android.view.Surface.OutOfResourcesException)3