Search in sources :

Example 86 with DisplayInfo

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

the class WindowManagerService method stopFreezingDisplayLocked.

void stopFreezingDisplayLocked() {
    if (!mDisplayFrozen) {
        return;
    }
    if (mWaitingForConfig || mAppsFreezingScreen > 0 || mWindowsFreezingScreen == WINDOWS_FREEZING_SCREENS_ACTIVE || mClientFreezingScreen || !mOpeningApps.isEmpty()) {
        if (DEBUG_ORIENTATION)
            Slog.d(TAG_WM, "stopFreezingDisplayLocked: Returning mWaitingForConfig=" + mWaitingForConfig + ", mAppsFreezingScreen=" + mAppsFreezingScreen + ", mWindowsFreezingScreen=" + mWindowsFreezingScreen + ", mClientFreezingScreen=" + mClientFreezingScreen + ", mOpeningApps.size()=" + mOpeningApps.size());
        return;
    }
    if (DEBUG_ORIENTATION)
        Slog.d(TAG_WM, "stopFreezingDisplayLocked: Unfreezing now");
    mDisplayFrozen = false;
    mLastDisplayFreezeDuration = (int) (SystemClock.elapsedRealtime() - mDisplayFreezeTime);
    StringBuilder sb = new StringBuilder(128);
    sb.append("Screen frozen for ");
    TimeUtils.formatDuration(mLastDisplayFreezeDuration, sb);
    if (mLastFinishedFreezeSource != null) {
        sb.append(" due to ");
        sb.append(mLastFinishedFreezeSource);
    }
    Slog.i(TAG_WM, sb.toString());
    mH.removeMessages(H.APP_FREEZE_TIMEOUT);
    mH.removeMessages(H.CLIENT_FREEZE_TIMEOUT);
    if (PROFILE_ORIENTATION) {
        Debug.stopMethodTracing();
    }
    boolean updateRotation = false;
    final DisplayContent displayContent = getDefaultDisplayContentLocked();
    final int displayId = displayContent.getDisplayId();
    ScreenRotationAnimation screenRotationAnimation = mAnimator.getScreenRotationAnimationLocked(displayId);
    if (CUSTOM_SCREEN_ROTATION && screenRotationAnimation != null && screenRotationAnimation.hasScreenshot()) {
        if (DEBUG_ORIENTATION)
            Slog.i(TAG_WM, "**** Dismissing screen rotation animation");
        // TODO(multidisplay): rotation on main screen only.
        DisplayInfo displayInfo = displayContent.getDisplayInfo();
        // Get rotation animation again, with new top window
        boolean isDimming = displayContent.isDimming();
        if (!mPolicy.validateRotationAnimationLw(mExitAnimId, mEnterAnimId, isDimming)) {
            mExitAnimId = mEnterAnimId = 0;
        }
        if (screenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION, getTransitionAnimationScaleLocked(), displayInfo.logicalWidth, displayInfo.logicalHeight, mExitAnimId, mEnterAnimId)) {
            scheduleAnimationLocked();
        } else {
            screenRotationAnimation.kill();
            mAnimator.setScreenRotationAnimationLocked(displayId, null);
            updateRotation = true;
        }
    } else {
        if (screenRotationAnimation != null) {
            screenRotationAnimation.kill();
            mAnimator.setScreenRotationAnimationLocked(displayId, null);
        }
        updateRotation = true;
    }
    mInputMonitor.thawInputDispatchingLw();
    boolean configChanged;
    // While the display is frozen we don't re-compute the orientation
    // to avoid inconsistent states.  However, something interesting
    // could have actually changed during that time so re-evaluate it
    // now to catch that.
    configChanged = updateOrientationFromAppTokensLocked(false);
    // A little kludge: a lot could have happened while the
    // display was frozen, so now that we are coming back we
    // do a gc so that any remote references the system
    // processes holds on others can be released if they are
    // no longer needed.
    mH.removeMessages(H.FORCE_GC);
    mH.sendEmptyMessageDelayed(H.FORCE_GC, 2000);
    mScreenFrozenLock.release();
    if (updateRotation) {
        if (DEBUG_ORIENTATION)
            Slog.d(TAG_WM, "Performing post-rotate rotation");
        configChanged |= updateRotationUncheckedLocked(false);
    }
    if (configChanged) {
        mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
    }
}
Also used : DisplayInfo(android.view.DisplayInfo) Point(android.graphics.Point)

Example 87 with DisplayInfo

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

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

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

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

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

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

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

the class WindowManagerService method subtractStableInsets.

/**
     * Intersects the specified {@code inOutBounds} with the display frame that excludes the stable
     * inset areas.
     *
     * @param inOutBounds The inOutBounds to subtract the stable inset areas from.
     */
public void subtractStableInsets(Rect inOutBounds) {
    synchronized (mWindowMap) {
        getStableInsetsLocked(mTmpRect2);
        final DisplayInfo di = getDefaultDisplayInfoLocked();
        mTmpRect.set(0, 0, di.logicalWidth, di.logicalHeight);
        subtractInsets(mTmpRect, mTmpRect2, inOutBounds);
    }
}
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