Search in sources :

Example 71 with DisplayInfo

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

the class WindowSurfacePlacer method applySurfaceChangesTransaction.

private void applySurfaceChangesTransaction(boolean recoveringMemory, int numDisplays, int defaultDw, int defaultDh) {
    if (mService.mWatermark != null) {
        mService.mWatermark.positionSurface(defaultDw, defaultDh);
    }
    if (mService.mStrictModeFlash != null) {
        mService.mStrictModeFlash.positionSurface(defaultDw, defaultDh);
    }
    if (mService.mCircularDisplayMask != null) {
        mService.mCircularDisplayMask.positionSurface(defaultDw, defaultDh, mService.mRotation);
    }
    if (mService.mEmulatorDisplayOverlay != null) {
        mService.mEmulatorDisplayOverlay.positionSurface(defaultDw, defaultDh, mService.mRotation);
    }
    boolean focusDisplayed = false;
    for (int displayNdx = 0; displayNdx < numDisplays; ++displayNdx) {
        final DisplayContent displayContent = mService.mDisplayContents.valueAt(displayNdx);
        boolean updateAllDrawn = false;
        WindowList windows = displayContent.getWindowList();
        DisplayInfo displayInfo = displayContent.getDisplayInfo();
        final int displayId = displayContent.getDisplayId();
        final int dw = displayInfo.logicalWidth;
        final int dh = displayInfo.logicalHeight;
        final int innerDw = displayInfo.appWidth;
        final int innerDh = displayInfo.appHeight;
        final boolean isDefaultDisplay = (displayId == Display.DEFAULT_DISPLAY);
        // Reset for each display.
        mDisplayHasContent = false;
        mPreferredRefreshRate = 0;
        mPreferredModeId = 0;
        int repeats = 0;
        do {
            repeats++;
            if (repeats > 6) {
                Slog.w(TAG, "Animation repeat aborted after too many iterations");
                displayContent.layoutNeeded = false;
                break;
            }
            if (DEBUG_LAYOUT_REPEATS)
                debugLayoutRepeats("On entry to LockedInner", displayContent.pendingLayoutChanges);
            if ((displayContent.pendingLayoutChanges & FINISH_LAYOUT_REDO_WALLPAPER) != 0 && mWallpaperControllerLocked.adjustWallpaperWindows()) {
                mService.mLayersController.assignLayersLocked(windows);
                displayContent.layoutNeeded = true;
            }
            if (isDefaultDisplay && (displayContent.pendingLayoutChanges & FINISH_LAYOUT_REDO_CONFIG) != 0) {
                if (DEBUG_LAYOUT)
                    Slog.v(TAG, "Computing new config from layout");
                if (mService.updateOrientationFromAppTokensLocked(true)) {
                    displayContent.layoutNeeded = true;
                    mService.mH.sendEmptyMessage(SEND_NEW_CONFIGURATION);
                }
            }
            if ((displayContent.pendingLayoutChanges & FINISH_LAYOUT_REDO_LAYOUT) != 0) {
                displayContent.layoutNeeded = true;
            }
            // FIRST LOOP: Perform a layout, if needed.
            if (repeats < LAYOUT_REPEAT_THRESHOLD) {
                performLayoutLockedInner(displayContent, repeats == 1, false);
            } else {
                Slog.w(TAG, "Layout repeat skipped after too many iterations");
            }
            // FIRST AND ONE HALF LOOP: Make WindowManagerPolicy think
            // it is animating.
            displayContent.pendingLayoutChanges = 0;
            if (isDefaultDisplay) {
                mService.mPolicy.beginPostLayoutPolicyLw(dw, dh);
                for (int i = windows.size() - 1; i >= 0; i--) {
                    WindowState w = windows.get(i);
                    if (w.mHasSurface) {
                        mService.mPolicy.applyPostLayoutPolicyLw(w, w.mAttrs, w.mAttachedWindow);
                    }
                }
                displayContent.pendingLayoutChanges |= mService.mPolicy.finishPostLayoutPolicyLw();
                if (DEBUG_LAYOUT_REPEATS)
                    debugLayoutRepeats("after finishPostLayoutPolicyLw", displayContent.pendingLayoutChanges);
            }
        } while (displayContent.pendingLayoutChanges != 0);
        mObscured = false;
        mSyswin = false;
        displayContent.resetDimming();
        // Only used if default window
        final boolean someoneLosingFocus = !mService.mLosingFocus.isEmpty();
        for (int i = windows.size() - 1; i >= 0; i--) {
            WindowState w = windows.get(i);
            final Task task = w.getTask();
            final boolean obscuredChanged = w.mObscured != mObscured;
            // Update effect.
            w.mObscured = mObscured;
            if (!mObscured) {
                handleNotObscuredLocked(w, displayInfo);
            }
            w.applyDimLayerIfNeeded();
            if (isDefaultDisplay && obscuredChanged && mWallpaperControllerLocked.isWallpaperTarget(w) && w.isVisibleLw()) {
                // This is the wallpaper target and its obscured state
                // changed... make sure the current wallaper's visibility
                // has been updated accordingly.
                mWallpaperControllerLocked.updateWallpaperVisibility();
            }
            final WindowStateAnimator winAnimator = w.mWinAnimator;
            // for animation.
            if (w.hasMoved()) {
                // Frame has moved, containing content frame has also moved, and we're not
                // currently animating... let's do something.
                final int left = w.mFrame.left;
                final int top = w.mFrame.top;
                final boolean adjustedForMinimizedDockOrIme = task != null && (task.mStack.isAdjustedForMinimizedDockedStack() || task.mStack.isAdjustedForIme());
                if (mService.okToDisplay()) {
                    if ((w.mAttrs.privateFlags & PRIVATE_FLAG_NO_MOVE_ANIMATION) == 0 && !w.isDragResizing() && !adjustedForMinimizedDockOrIme && (task == null || w.getTask().mStack.hasMovementAnimations()) && !w.mWinAnimator.mLastHidden) {
                        winAnimator.setMoveAnimation(left, top);
                    }
                }
                //TODO (multidisplay): Accessibility supported only for the default display.
                if (mService.mAccessibilityController != null && displayId == Display.DEFAULT_DISPLAY) {
                    mService.mAccessibilityController.onSomeWindowResizedOrMovedLocked();
                }
                try {
                    w.mClient.moved(left, top);
                } catch (RemoteException e) {
                }
                w.mMovedByResize = false;
            }
            //Slog.i(TAG, "Window " + this + " clearing mContentChanged - done placing");
            w.mContentChanged = false;
            // Moved from updateWindowsAndWallpaperLocked().
            if (w.mHasSurface) {
                // Take care of the window being ready to display.
                final boolean committed = winAnimator.commitFinishDrawingLocked();
                if (isDefaultDisplay && committed) {
                    if (w.mAttrs.type == TYPE_DREAM) {
                        // HACK: When a dream is shown, it may at that
                        // point hide the lock screen.  So we need to
                        // redo the layout to let the phone window manager
                        // make this happen.
                        displayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_LAYOUT;
                        if (DEBUG_LAYOUT_REPEATS) {
                            debugLayoutRepeats("dream and commitFinishDrawingLocked true", displayContent.pendingLayoutChanges);
                        }
                    }
                    if ((w.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0) {
                        if (DEBUG_WALLPAPER_LIGHT)
                            Slog.v(TAG, "First draw done in potential wallpaper target " + w);
                        mWallpaperMayChange = true;
                        displayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_WALLPAPER;
                        if (DEBUG_LAYOUT_REPEATS) {
                            debugLayoutRepeats("wallpaper and commitFinishDrawingLocked true", displayContent.pendingLayoutChanges);
                        }
                    }
                }
                if (!winAnimator.isAnimationStarting() && !winAnimator.isWaitingForOpening()) {
                    // Updates the shown frame before we set up the surface. This is needed
                    // because the resizing could change the top-left position (in addition to
                    // size) of the window. setSurfaceBoundariesLocked uses mShownPosition to
                    // position the surface.
                    //
                    // If an animation is being started, we can't call this method because the
                    // animation hasn't processed its initial transformation yet, but in general
                    // we do want to update the position if the window is animating.
                    winAnimator.computeShownFrameLocked();
                }
                winAnimator.setSurfaceBoundariesLocked(recoveringMemory);
            }
            final AppWindowToken atoken = w.mAppToken;
            if (DEBUG_STARTING_WINDOW && atoken != null && w == atoken.startingWindow) {
                Slog.d(TAG, "updateWindows: starting " + w + " isOnScreen=" + w.isOnScreen() + " allDrawn=" + atoken.allDrawn + " freezingScreen=" + atoken.mAppAnimator.freezingScreen);
            }
            if (atoken != null && (!atoken.allDrawn || !atoken.allDrawnExcludingSaved || atoken.mAppAnimator.freezingScreen)) {
                if (atoken.lastTransactionSequence != mService.mTransactionSequence) {
                    atoken.lastTransactionSequence = mService.mTransactionSequence;
                    atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
                    atoken.numInterestingWindowsExcludingSaved = 0;
                    atoken.numDrawnWindowsExclusingSaved = 0;
                    atoken.startingDisplayed = false;
                }
                if (!atoken.allDrawn && w.mightAffectAllDrawn(false)) {
                    if (DEBUG_VISIBILITY || DEBUG_ORIENTATION) {
                        Slog.v(TAG, "Eval win " + w + ": isDrawn=" + w.isDrawnLw() + ", isAnimationSet=" + winAnimator.isAnimationSet());
                        if (!w.isDrawnLw()) {
                            Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurfaceController + " pv=" + w.mPolicyVisibility + " mDrawState=" + winAnimator.drawStateToString() + " ah=" + w.mAttachedHidden + " th=" + atoken.hiddenRequested + " a=" + winAnimator.mAnimating);
                        }
                    }
                    if (w != atoken.startingWindow) {
                        if (w.isInteresting()) {
                            atoken.numInterestingWindows++;
                            if (w.isDrawnLw()) {
                                atoken.numDrawnWindows++;
                                if (DEBUG_VISIBILITY || DEBUG_ORIENTATION)
                                    Slog.v(TAG, "tokenMayBeDrawn: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindows + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing);
                                updateAllDrawn = true;
                            }
                        }
                    } else if (w.isDrawnLw()) {
                        mService.mH.sendEmptyMessage(NOTIFY_STARTING_WINDOW_DRAWN);
                        atoken.startingDisplayed = true;
                    }
                }
                if (!atoken.allDrawnExcludingSaved && w.mightAffectAllDrawn(true)) {
                    if (w != atoken.startingWindow && w.isInteresting()) {
                        atoken.numInterestingWindowsExcludingSaved++;
                        if (w.isDrawnLw() && !w.isAnimatingWithSavedSurface()) {
                            atoken.numDrawnWindowsExclusingSaved++;
                            if (DEBUG_VISIBILITY || DEBUG_ORIENTATION)
                                Slog.v(TAG, "tokenMayBeDrawnExcludingSaved: " + atoken + " w=" + w + " numInteresting=" + atoken.numInterestingWindowsExcludingSaved + " freezingScreen=" + atoken.mAppAnimator.freezingScreen + " mAppFreezing=" + w.mAppFreezing);
                            updateAllDrawn = true;
                        }
                    }
                }
            }
            if (isDefaultDisplay && someoneLosingFocus && w == mService.mCurrentFocus && w.isDisplayedLw()) {
                focusDisplayed = true;
            }
            mService.updateResizingWindows(w);
        }
        mService.mDisplayManagerInternal.setDisplayProperties(displayId, mDisplayHasContent, mPreferredRefreshRate, mPreferredModeId, true);
        mService.getDisplayContentLocked(displayId).stopDimmingIfNeeded();
        if (updateAllDrawn) {
            updateAllDrawnLocked(displayContent);
        }
    }
    if (focusDisplayed) {
        mService.mH.sendEmptyMessage(REPORT_LOSING_FOCUS);
    }
    // Give the display manager a chance to adjust properties
    // like display rotation if it needs to.
    mService.mDisplayManagerInternal.performTraversalInTransactionFromWindowManager();
}
Also used : DisplayInfo(android.view.DisplayInfo) RemoteException(android.os.RemoteException)

Example 72 with DisplayInfo

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

the class WindowSurfacePlacer method performLayoutLockedInner.

final void performLayoutLockedInner(final DisplayContent displayContent, boolean initial, boolean updateInputWindows) {
    if (!displayContent.layoutNeeded) {
        return;
    }
    displayContent.layoutNeeded = false;
    WindowList windows = displayContent.getWindowList();
    boolean isDefaultDisplay = displayContent.isDefaultDisplay;
    DisplayInfo displayInfo = displayContent.getDisplayInfo();
    final int dw = displayInfo.logicalWidth;
    final int dh = displayInfo.logicalHeight;
    if (mService.mInputConsumer != null) {
        mService.mInputConsumer.layout(dw, dh);
    }
    if (mService.mWallpaperInputConsumer != null) {
        mService.mWallpaperInputConsumer.layout(dw, dh);
    }
    final int N = windows.size();
    int i;
    if (DEBUG_LAYOUT) {
        Slog.v(TAG, "-------------------------------------");
        Slog.v(TAG, "performLayout: needed=" + displayContent.layoutNeeded + " dw=" + dw + " dh=" + dh);
    }
    mService.mPolicy.beginLayoutLw(isDefaultDisplay, dw, dh, mService.mRotation, mService.mCurConfiguration.uiMode);
    if (isDefaultDisplay) {
        // Not needed on non-default displays.
        mService.mSystemDecorLayer = mService.mPolicy.getSystemDecorLayerLw();
        mService.mScreenRect.set(0, 0, dw, dh);
    }
    mService.mPolicy.getContentRectLw(mTmpContentRect);
    displayContent.resize(mTmpContentRect);
    int seq = mService.mLayoutSeq + 1;
    if (seq < 0)
        seq = 0;
    mService.mLayoutSeq = seq;
    boolean behindDream = false;
    // First perform layout of any root windows (not attached
    // to another window).
    int topAttached = -1;
    for (i = N - 1; i >= 0; i--) {
        final WindowState win = windows.get(i);
        // Don't do layout of a window if it is not visible, or
        // soon won't be visible, to avoid wasting time and funky
        // changes while a window is animating away.
        final boolean gone = (behindDream && mService.mPolicy.canBeForceHidden(win, win.mAttrs)) || win.isGoneForLayoutLw();
        if (DEBUG_LAYOUT && !win.mLayoutAttached) {
            Slog.v(TAG, "1ST PASS " + win + ": gone=" + gone + " mHaveFrame=" + win.mHaveFrame + " mLayoutAttached=" + win.mLayoutAttached + " screen changed=" + win.isConfigChanged());
            final AppWindowToken atoken = win.mAppToken;
            if (gone)
                Slog.v(TAG, "  GONE: mViewVisibility=" + win.mViewVisibility + " mRelayoutCalled=" + win.mRelayoutCalled + " hidden=" + win.mRootToken.hidden + " hiddenRequested=" + (atoken != null && atoken.hiddenRequested) + " mAttachedHidden=" + win.mAttachedHidden);
            else
                Slog.v(TAG, "  VIS: mViewVisibility=" + win.mViewVisibility + " mRelayoutCalled=" + win.mRelayoutCalled + " hidden=" + win.mRootToken.hidden + " hiddenRequested=" + (atoken != null && atoken.hiddenRequested) + " mAttachedHidden=" + win.mAttachedHidden);
        }
        // just don't display").
        if (!gone || !win.mHaveFrame || win.mLayoutNeeded || ((win.isConfigChanged() || win.setReportResizeHints()) && !win.isGoneForLayoutLw() && ((win.mAttrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 || (win.mHasSurface && win.mAppToken != null && win.mAppToken.layoutConfigChanges)))) {
            if (!win.mLayoutAttached) {
                if (initial) {
                    //Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");
                    win.mContentChanged = false;
                }
                if (win.mAttrs.type == TYPE_DREAM) {
                    // Don't layout windows behind a dream, so that if it
                    // does stuff like hide the status bar we won't get a
                    // bad transition when it goes away.
                    behindDream = true;
                }
                win.mLayoutNeeded = false;
                win.prelayout();
                mService.mPolicy.layoutWindowLw(win, null);
                win.mLayoutSeq = seq;
                // Window frames may have changed. Update dim layer with the new bounds.
                final Task task = win.getTask();
                if (task != null) {
                    displayContent.mDimLayerController.updateDimLayer(task);
                }
                if (DEBUG_LAYOUT)
                    Slog.v(TAG, "  LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" + win.mContainingFrame + " mDisplayFrame=" + win.mDisplayFrame);
            } else {
                if (topAttached < 0)
                    topAttached = i;
            }
        }
    }
    boolean attachedBehindDream = false;
    // that are themselves attached.
    for (i = topAttached; i >= 0; i--) {
        final WindowState win = windows.get(i);
        if (win.mLayoutAttached) {
            if (DEBUG_LAYOUT)
                Slog.v(TAG, "2ND PASS " + win + " mHaveFrame=" + win.mHaveFrame + " mViewVisibility=" + win.mViewVisibility + " mRelayoutCalled=" + win.mRelayoutCalled);
            // just don't display").
            if (attachedBehindDream && mService.mPolicy.canBeForceHidden(win, win.mAttrs)) {
                continue;
            }
            if ((win.mViewVisibility != View.GONE && win.mRelayoutCalled) || !win.mHaveFrame || win.mLayoutNeeded) {
                if (initial) {
                    //Slog.i(TAG, "Window " + this + " clearing mContentChanged - initial");
                    win.mContentChanged = false;
                }
                win.mLayoutNeeded = false;
                win.prelayout();
                mService.mPolicy.layoutWindowLw(win, win.mAttachedWindow);
                win.mLayoutSeq = seq;
                if (DEBUG_LAYOUT)
                    Slog.v(TAG, "  LAYOUT: mFrame=" + win.mFrame + " mContainingFrame=" + win.mContainingFrame + " mDisplayFrame=" + win.mDisplayFrame);
            }
        } else if (win.mAttrs.type == TYPE_DREAM) {
            // Don't layout windows behind a dream, so that if it
            // does stuff like hide the status bar we won't get a
            // bad transition when it goes away.
            attachedBehindDream = behindDream;
        }
    }
    // Window frames may have changed. Tell the input dispatcher about it.
    mService.mInputMonitor.setUpdateInputWindowsNeededLw();
    if (updateInputWindows) {
        mService.mInputMonitor.updateInputWindowsLw(false);
    }
    mService.mPolicy.finishLayoutLw();
    mService.mH.sendEmptyMessage(UPDATE_DOCKED_STACK_DIVIDER);
}
Also used : DisplayInfo(android.view.DisplayInfo)

Example 73 with DisplayInfo

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

the class WindowState method getBackdropFrame.

Rect getBackdropFrame(Rect frame) {
    // When the task is docked, we send fullscreen sized backDropFrame as soon as resizing
    // start even if we haven't received the relayout window, so that the client requests
    // the relayout sooner. When dragging stops, backDropFrame needs to stay fullscreen
    // until the window to small size, otherwise the multithread renderer will shift last
    // one or more frame to wrong offset. So here we send fullscreen backdrop if either
    // isDragResizing() or isDragResizeChanged() is true.
    boolean resizing = isDragResizing() || isDragResizeChanged();
    if (StackId.useWindowFrameForBackdrop(getStackId()) || !resizing) {
        return frame;
    }
    DisplayInfo displayInfo = getDisplayInfo();
    mTmpRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
    return mTmpRect;
}
Also used : DisplayInfo(android.view.DisplayInfo)

Example 74 with DisplayInfo

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

the class WindowStateAnimator method stepAnimationLocked.

// This must be called while inside a transaction.  Returns true if
// there is more animation to run.
boolean stepAnimationLocked(long currentTime) {
    // Save the animation state as it was before this step so WindowManagerService can tell if
    // we just started or just stopped animating by comparing mWasAnimating with isAnimationSet().
    mWasAnimating = mAnimating;
    final DisplayContent displayContent = mWin.getDisplayContent();
    if (displayContent != null && mService.okToDisplay()) {
        if (mWin.isDrawnLw() && mAnimation != null) {
            mHasTransformation = true;
            mHasLocalTransformation = true;
            if (!mLocalAnimating) {
                if (DEBUG_ANIM)
                    Slog.v(TAG, "Starting animation in " + this + " @ " + currentTime + ": ww=" + mWin.mFrame.width() + " wh=" + mWin.mFrame.height() + " dx=" + mAnimDx + " dy=" + mAnimDy + " scale=" + mService.getWindowAnimationScaleLocked());
                final DisplayInfo displayInfo = displayContent.getDisplayInfo();
                if (mAnimateMove) {
                    mAnimateMove = false;
                    mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), mAnimDx, mAnimDy);
                } else {
                    mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), displayInfo.appWidth, displayInfo.appHeight);
                }
                mAnimDx = displayInfo.appWidth;
                mAnimDy = displayInfo.appHeight;
                mAnimation.setStartTime(mAnimationStartTime != -1 ? mAnimationStartTime : currentTime);
                mLocalAnimating = true;
                mAnimating = true;
            }
            if ((mAnimation != null) && mLocalAnimating) {
                mLastAnimationTime = currentTime;
                if (stepAnimation(currentTime)) {
                    return true;
                }
            }
            if (DEBUG_ANIM)
                Slog.v(TAG, "Finished animation in " + this + " @ " + currentTime);
        //WindowManagerService.this.dump();
        }
        mHasLocalTransformation = false;
        if ((!mLocalAnimating || mAnimationIsEntrance) && mAppAnimator != null && mAppAnimator.animation != null) {
            // When our app token is animating, we kind-of pretend like
            // we are as well.  Note the mLocalAnimating mAnimationIsEntrance
            // part of this check means that we will only do this if
            // our window is not currently exiting, or it is not
            // locally animating itself.  The idea being that one that
            // is exiting and doing a local animation should be removed
            // once that animation is done.
            mAnimating = true;
            mHasTransformation = true;
            mTransformation.clear();
            return false;
        } else if (mHasTransformation) {
            // Little trick to get through the path below to act like
            // we have finished an animation.
            mAnimating = true;
        } else if (isAnimationSet()) {
            mAnimating = true;
        }
    } else if (mAnimation != null) {
        // If the display is frozen, and there is a pending animation,
        // clear it and make sure we run the cleanup code.
        mAnimating = true;
    }
    if (!mAnimating && !mLocalAnimating) {
        return false;
    }
    // Done animating, clean up.
    if (DEBUG_ANIM)
        Slog.v(TAG, "Animation done in " + this + ": exiting=" + mWin.mAnimatingExit + ", reportedVisible=" + (mWin.mAppToken != null ? mWin.mAppToken.reportedVisible : false));
    mAnimating = false;
    mKeyguardGoingAwayAnimation = false;
    mKeyguardGoingAwayWithWallpaper = false;
    mLocalAnimating = false;
    if (mAnimation != null) {
        mAnimation.cancel();
        mAnimation = null;
    }
    if (mAnimator.mWindowDetachedWallpaper == mWin) {
        mAnimator.mWindowDetachedWallpaper = null;
    }
    mAnimLayer = mWin.mLayer + mService.mLayersController.getSpecialWindowAnimLayerAdjustment(mWin);
    if (DEBUG_LAYERS)
        Slog.v(TAG, "Stepping win " + this + " anim layer: " + mAnimLayer);
    mHasTransformation = false;
    mHasLocalTransformation = false;
    mStackClip = STACK_CLIP_BEFORE_ANIM;
    mWin.checkPolicyVisibilityChange();
    mTransformation.clear();
    if (mDrawState == HAS_DRAWN && mWin.mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_STARTING && mWin.mAppToken != null && mWin.mAppToken.firstWindowDrawn && mWin.mAppToken.startingData != null) {
        if (DEBUG_STARTING_WINDOW)
            Slog.v(TAG, "Finish starting " + mWin.mToken + ": first real window done animating");
        mService.mFinishedStarting.add(mWin.mAppToken);
        mService.mH.sendEmptyMessage(H.FINISHED_STARTING);
    } else if (mAttrType == LayoutParams.TYPE_STATUS_BAR && mWin.mPolicyVisibility) {
        // required.
        if (displayContent != null) {
            displayContent.layoutNeeded = true;
        }
    }
    finishExit();
    final int displayId = mWin.getDisplayId();
    mAnimator.setPendingLayoutChanges(displayId, WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM);
    if (DEBUG_LAYOUT_REPEATS)
        mService.mWindowPlacerLocked.debugLayoutRepeats("WindowStateAnimator", mAnimator.getPendingLayoutChanges(displayId));
    if (mWin.mAppToken != null) {
        mWin.mAppToken.updateReportedVisibilityLocked();
    }
    return false;
}
Also used : DisplayInfo(android.view.DisplayInfo) Point(android.graphics.Point)

Example 75 with DisplayInfo

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

the class WindowStateAnimator method calculateSurfaceBounds.

private void calculateSurfaceBounds(WindowState w, LayoutParams attrs) {
    if ((attrs.flags & FLAG_SCALED) != 0) {
        // For a scaled surface, we always want the requested size.
        mTmpSize.right = mTmpSize.left + w.mRequestedWidth;
        mTmpSize.bottom = mTmpSize.top + w.mRequestedHeight;
    } else {
        // buffer drops due to size mismatch.
        if (w.isDragResizing()) {
            if (w.getResizeMode() == DRAG_RESIZE_MODE_FREEFORM) {
                mTmpSize.left = 0;
                mTmpSize.top = 0;
            }
            final DisplayInfo displayInfo = w.getDisplayInfo();
            mTmpSize.right = mTmpSize.left + displayInfo.logicalWidth;
            mTmpSize.bottom = mTmpSize.top + displayInfo.logicalHeight;
        } else {
            mTmpSize.right = mTmpSize.left + w.mCompatFrame.width();
            mTmpSize.bottom = mTmpSize.top + w.mCompatFrame.height();
        }
    }
    // incorrect, because it is before the first layout or draw.
    if (mTmpSize.width() < 1) {
        mTmpSize.right = mTmpSize.left + 1;
    }
    if (mTmpSize.height() < 1) {
        mTmpSize.bottom = mTmpSize.top + 1;
    }
    // Adjust for surface insets.
    mTmpSize.left -= attrs.surfaceInsets.left;
    mTmpSize.top -= attrs.surfaceInsets.top;
    mTmpSize.right += attrs.surfaceInsets.right;
    mTmpSize.bottom += attrs.surfaceInsets.bottom;
}
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