Search in sources :

Example 66 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 67 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 68 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 69 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)

Example 70 with DisplayInfo

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

the class WindowManagerService method applyAnimationLocked.

private boolean applyAnimationLocked(AppWindowToken atoken, WindowManager.LayoutParams lp, int transit, boolean enter, boolean isVoiceInteraction) {
    // Only apply an animation if the display isn't frozen.  If it is
    // frozen, there is no reason to animate and it can cause strange
    // artifacts when we unfreeze the display if some different animation
    // is running.
    Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "WM#applyAnimationLocked");
    if (okToDisplay()) {
        DisplayInfo displayInfo = getDefaultDisplayInfoLocked();
        final int width = displayInfo.appWidth;
        final int height = displayInfo.appHeight;
        if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM)
            Slog.v(TAG_WM, "applyAnimation: atoken=" + atoken);
        // Determine the visible rect to calculate the thumbnail clip
        final WindowState win = atoken.findMainWindow();
        final Rect frame = new Rect(0, 0, width, height);
        final Rect displayFrame = new Rect(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
        final Rect insets = new Rect();
        Rect surfaceInsets = null;
        final boolean freeform = win != null && win.inFreeformWorkspace();
        if (win != null) {
            // the status bar). In that case we need to use the final frame.
            if (freeform) {
                frame.set(win.mFrame);
            } else {
                frame.set(win.mContainingFrame);
            }
            surfaceInsets = win.getAttrs().surfaceInsets;
            insets.set(win.mContentInsets);
        }
        if (atoken.mLaunchTaskBehind) {
            // Differentiate the two animations. This one which is briefly on the screen
            // gets the !enter animation, and the other activity which remains on the
            // screen gets the enter animation. Both appear in the mOpeningApps set.
            enter = false;
        }
        if (DEBUG_APP_TRANSITIONS)
            Slog.d(TAG_WM, "Loading animation for app transition." + " transit=" + AppTransition.appTransitionToString(transit) + " enter=" + enter + " frame=" + frame + " insets=" + insets + " surfaceInsets=" + surfaceInsets);
        Animation a = mAppTransition.loadAnimation(lp, transit, enter, mCurConfiguration.uiMode, mCurConfiguration.orientation, frame, displayFrame, insets, surfaceInsets, isVoiceInteraction, freeform, atoken.mTask.mTaskId);
        if (a != null) {
            if (DEBUG_ANIM)
                logWithStack(TAG, "Loaded animation " + a + " for " + atoken);
            final int containingWidth = frame.width();
            final int containingHeight = frame.height();
            atoken.mAppAnimator.setAnimation(a, containingWidth, containingHeight, mAppTransition.canSkipFirstFrame(), mAppTransition.getAppStackClipMode());
        }
    } else {
        atoken.mAppAnimator.clearAnimation();
    }
    Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    return atoken.mAppAnimator.animation != null;
}
Also used : Rect(android.graphics.Rect) DisplayInfo(android.view.DisplayInfo) Animation(android.view.animation.Animation) Point(android.graphics.Point)

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