Search in sources :

Example 51 with DisplayInfo

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

the class WindowManagerService method updateDisplayAndOrientationLocked.

/** Do not call if mDisplayReady == false */
DisplayInfo updateDisplayAndOrientationLocked(int uiMode) {
    // TODO(multidisplay): For now, apply Configuration to main screen only.
    final DisplayContent displayContent = getDefaultDisplayContentLocked();
    // Use the effective "visual" dimensions based on current rotation
    final boolean rotated = (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270);
    final int realdw = rotated ? displayContent.mBaseDisplayHeight : displayContent.mBaseDisplayWidth;
    final int realdh = rotated ? displayContent.mBaseDisplayWidth : displayContent.mBaseDisplayHeight;
    int dw = realdw;
    int dh = realdh;
    if (mAltOrientation) {
        if (realdw > realdh) {
            // Turn landscape into portrait.
            int maxw = (int) (realdh / 1.3f);
            if (maxw < realdw) {
                dw = maxw;
            }
        } else {
            // Turn portrait into landscape.
            int maxh = (int) (realdw / 1.3f);
            if (maxh < realdh) {
                dh = maxh;
            }
        }
    }
    // Update application display metrics.
    final int appWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation, uiMode);
    final int appHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation, uiMode);
    final DisplayInfo displayInfo = displayContent.getDisplayInfo();
    displayInfo.rotation = mRotation;
    displayInfo.logicalWidth = dw;
    displayInfo.logicalHeight = dh;
    displayInfo.logicalDensityDpi = displayContent.mBaseDisplayDensity;
    displayInfo.appWidth = appWidth;
    displayInfo.appHeight = appHeight;
    displayInfo.getLogicalMetrics(mRealDisplayMetrics, CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null);
    displayInfo.getAppMetrics(mDisplayMetrics);
    if (displayContent.mDisplayScalingDisabled) {
        displayInfo.flags |= Display.FLAG_SCALING_DISABLED;
    } else {
        displayInfo.flags &= ~Display.FLAG_SCALING_DISABLED;
    }
    mDisplayManagerInternal.setDisplayInfoOverrideFromWindowManager(displayContent.getDisplayId(), displayInfo);
    displayContent.mBaseDisplayRect.set(0, 0, dw, dh);
    if (false) {
        Slog.i(TAG_WM, "Set app display size: " + appWidth + " x " + appHeight);
    }
    mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(mDisplayMetrics, mCompatDisplayMetrics);
    return displayInfo;
}
Also used : DisplayInfo(android.view.DisplayInfo) Point(android.graphics.Point)

Example 52 with DisplayInfo

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

the class WindowManagerService method computeScreenConfigurationLocked.

/** Do not call if mDisplayReady == false */
void computeScreenConfigurationLocked(Configuration config) {
    final DisplayInfo displayInfo = updateDisplayAndOrientationLocked(config.uiMode);
    final int dw = displayInfo.logicalWidth;
    final int dh = displayInfo.logicalHeight;
    config.orientation = (dw <= dh) ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
    config.screenWidthDp = (int) (mPolicy.getConfigDisplayWidth(dw, dh, mRotation, config.uiMode) / mDisplayMetrics.density);
    config.screenHeightDp = (int) (mPolicy.getConfigDisplayHeight(dw, dh, mRotation, config.uiMode) / mDisplayMetrics.density);
    final boolean rotated = (mRotation == Surface.ROTATION_90 || mRotation == Surface.ROTATION_270);
    computeSizeRangesAndScreenLayout(displayInfo, rotated, config.uiMode, dw, dh, mDisplayMetrics.density, config);
    config.screenLayout = (config.screenLayout & ~Configuration.SCREENLAYOUT_ROUND_MASK) | ((displayInfo.flags & Display.FLAG_ROUND) != 0 ? Configuration.SCREENLAYOUT_ROUND_YES : Configuration.SCREENLAYOUT_ROUND_NO);
    config.compatScreenWidthDp = (int) (config.screenWidthDp / mCompatibleScreenScale);
    config.compatScreenHeightDp = (int) (config.screenHeightDp / mCompatibleScreenScale);
    config.compatSmallestScreenWidthDp = computeCompatSmallestWidth(rotated, config.uiMode, mDisplayMetrics, dw, dh);
    config.densityDpi = displayInfo.logicalDensityDpi;
    // Update the configuration based on available input devices, lid switch,
    // and platform configuration.
    config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
    config.keyboard = Configuration.KEYBOARD_NOKEYS;
    config.navigation = Configuration.NAVIGATION_NONAV;
    int keyboardPresence = 0;
    int navigationPresence = 0;
    final InputDevice[] devices = mInputManager.getInputDevices();
    final int len = devices.length;
    for (int i = 0; i < len; i++) {
        InputDevice device = devices[i];
        if (!device.isVirtual()) {
            final int sources = device.getSources();
            final int presenceFlag = device.isExternal() ? WindowManagerPolicy.PRESENCE_EXTERNAL : WindowManagerPolicy.PRESENCE_INTERNAL;
            if (mIsTouchDevice) {
                if ((sources & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN) {
                    config.touchscreen = Configuration.TOUCHSCREEN_FINGER;
                }
            } else {
                config.touchscreen = Configuration.TOUCHSCREEN_NOTOUCH;
            }
            if ((sources & InputDevice.SOURCE_TRACKBALL) == InputDevice.SOURCE_TRACKBALL) {
                config.navigation = Configuration.NAVIGATION_TRACKBALL;
                navigationPresence |= presenceFlag;
            } else if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD && config.navigation == Configuration.NAVIGATION_NONAV) {
                config.navigation = Configuration.NAVIGATION_DPAD;
                navigationPresence |= presenceFlag;
            }
            if (device.getKeyboardType() == InputDevice.KEYBOARD_TYPE_ALPHABETIC) {
                config.keyboard = Configuration.KEYBOARD_QWERTY;
                keyboardPresence |= presenceFlag;
            }
        }
    }
    if (config.navigation == Configuration.NAVIGATION_NONAV && mHasPermanentDpad) {
        config.navigation = Configuration.NAVIGATION_DPAD;
        navigationPresence |= WindowManagerPolicy.PRESENCE_INTERNAL;
    }
    // Determine whether a hard keyboard is available and enabled.
    boolean hardKeyboardAvailable = config.keyboard != Configuration.KEYBOARD_NOKEYS;
    if (hardKeyboardAvailable != mHardKeyboardAvailable) {
        mHardKeyboardAvailable = hardKeyboardAvailable;
        mH.removeMessages(H.REPORT_HARD_KEYBOARD_STATUS_CHANGE);
        mH.sendEmptyMessage(H.REPORT_HARD_KEYBOARD_STATUS_CHANGE);
    }
    // Let the policy update hidden states.
    config.keyboardHidden = Configuration.KEYBOARDHIDDEN_NO;
    config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO;
    config.navigationHidden = Configuration.NAVIGATIONHIDDEN_NO;
    mPolicy.adjustConfigurationLw(config, keyboardPresence, navigationPresence);
}
Also used : InputDevice(android.view.InputDevice) DisplayInfo(android.view.DisplayInfo) Point(android.graphics.Point)

Example 53 with DisplayInfo

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

the class DisplayManagerGlobal method getDisplayInfo.

/**
     * Get information about a particular logical display.
     *
     * @param displayId The logical display id.
     * @return Information about the specified display, or null if it does not exist.
     * This object belongs to an internal cache and should be treated as if it were immutable.
     */
public DisplayInfo getDisplayInfo(int displayId) {
    try {
        synchronized (mLock) {
            DisplayInfo info;
            if (USE_CACHE) {
                info = mDisplayInfoCache.get(displayId);
                if (info != null) {
                    return info;
                }
            }
            info = mDm.getDisplayInfo(displayId);
            if (info == null) {
                return null;
            }
            if (USE_CACHE) {
                mDisplayInfoCache.put(displayId, info);
            }
            registerCallbackIfNeededLocked();
            if (DEBUG) {
                Log.d(TAG, "getDisplayInfo: displayId=" + displayId + ", info=" + info);
            }
            return info;
        }
    } catch (RemoteException ex) {
        throw ex.rethrowFromSystemServer();
    }
}
Also used : DisplayInfo(android.view.DisplayInfo) RemoteException(android.os.RemoteException)

Example 54 with DisplayInfo

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

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 55 with DisplayInfo

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

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)

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