use of android.view.DisplayInfo in project android_frameworks_base by AOSPA.
the class DividerSnapAlgorithm method create.
public static DividerSnapAlgorithm create(Context ctx, Rect insets) {
DisplayInfo displayInfo = new DisplayInfo();
ctx.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY).getDisplayInfo(displayInfo);
int dividerWindowWidth = ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_thickness);
int dividerInsets = ctx.getResources().getDimensionPixelSize(com.android.internal.R.dimen.docked_stack_divider_insets);
return new DividerSnapAlgorithm(ctx.getResources(), displayInfo.logicalWidth, displayInfo.logicalHeight, dividerWindowWidth - 2 * dividerInsets, ctx.getApplicationContext().getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT, insets);
}
use of android.view.DisplayInfo in project android_frameworks_base by DirtyUnicorns.
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;
}
use of android.view.DisplayInfo in project android_frameworks_base by DirtyUnicorns.
the class WindowStateAnimator method calculateSystemDecorRect.
private void calculateSystemDecorRect() {
final WindowState w = mWin;
final Rect decorRect = w.mDecorFrame;
final int width = w.mFrame.width();
final int height = w.mFrame.height();
// Compute the offset of the window in relation to the decor rect.
final int left = w.mXOffset + w.mFrame.left;
final int top = w.mYOffset + w.mFrame.top;
// Initialize the decor rect to the entire frame.
if (w.isDockedResizing() || (w.isChildWindow() && w.mAttachedWindow.isDockedResizing())) {
// If we are resizing with the divider, the task bounds might be smaller than the
// stack bounds. The system decor is used to clip to the task bounds, which we don't
// want in this case in order to avoid holes.
//
// We take care to not shrink the width, for surfaces which are larger than
// the display region. Of course this area will not eventually be visible
// but if we truncate the width now, we will calculate incorrectly
// when adjusting to the stack bounds.
final DisplayInfo displayInfo = w.getDisplayContent().getDisplayInfo();
mSystemDecorRect.set(0, 0, Math.max(width, displayInfo.logicalWidth), Math.max(height, displayInfo.logicalHeight));
} else {
mSystemDecorRect.set(0, 0, width, height);
}
// If a freeform window is animating from a position where it would be cutoff, it would be
// cutoff during the animation. We don't want that, so for the duration of the animation
// we ignore the decor cropping and depend on layering to position windows correctly.
final boolean cropToDecor = !(w.inFreeformWorkspace() && w.isAnimatingLw());
if (cropToDecor) {
// Intersect with the decor rect, offsetted by window position.
mSystemDecorRect.intersect(decorRect.left - left, decorRect.top - top, decorRect.right - left, decorRect.bottom - top);
}
// much and hide part of the window that should be seen.
if (w.mEnforceSizeCompat && w.mInvGlobalScale != 1.0f) {
final float scale = w.mInvGlobalScale;
mSystemDecorRect.left = (int) (mSystemDecorRect.left * scale - 0.5f);
mSystemDecorRect.top = (int) (mSystemDecorRect.top * scale - 0.5f);
mSystemDecorRect.right = (int) ((mSystemDecorRect.right + 1) * scale - 0.5f);
mSystemDecorRect.bottom = (int) ((mSystemDecorRect.bottom + 1) * scale - 0.5f);
}
}
use of android.view.DisplayInfo in project android_frameworks_base by DirtyUnicorns.
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;
}
use of android.view.DisplayInfo in project android_frameworks_base by DirtyUnicorns.
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);
}
Aggregations