use of android.view.WindowManager.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class WindowSurfacePlacer method handleNotObscuredLocked.
/**
* @param w WindowState this method is applied to.
* @param dispInfo info of the display that the window's obscuring state is checked against.
*/
private void handleNotObscuredLocked(final WindowState w, final DisplayInfo dispInfo) {
final LayoutParams attrs = w.mAttrs;
final int attrFlags = attrs.flags;
final boolean canBeSeen = w.isDisplayedLw();
final int privateflags = attrs.privateFlags;
if (canBeSeen && w.isObscuringFullscreen(dispInfo)) {
// performance reasons).
if (!mObscured) {
mObsuringWindow = w;
}
mObscured = true;
}
if (w.mHasSurface && canBeSeen) {
if ((attrFlags & FLAG_KEEP_SCREEN_ON) != 0) {
mHoldScreen = w.mSession;
mHoldScreenWindow = w;
} else if (DEBUG_KEEP_SCREEN_ON && w == mService.mLastWakeLockHoldingWindow) {
Slog.d(TAG_KEEP_SCREEN_ON, "handleNotObscuredLocked: " + w + " was holding " + "screen wakelock but no longer has FLAG_KEEP_SCREEN_ON!!! called by" + Debug.getCallers(10));
}
if (!mSyswin && w.mAttrs.screenBrightness >= 0 && mScreenBrightness < 0) {
mScreenBrightness = w.mAttrs.screenBrightness;
}
if (!mSyswin && w.mAttrs.buttonBrightness >= 0 && mButtonBrightness < 0) {
mButtonBrightness = w.mAttrs.buttonBrightness;
}
if (!mSyswin && w.mAttrs.userActivityTimeout >= 0 && mUserActivityTimeout < 0) {
mUserActivityTimeout = w.mAttrs.userActivityTimeout;
}
final int type = attrs.type;
if (type == TYPE_SYSTEM_DIALOG || type == TYPE_SYSTEM_ERROR || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
mSyswin = true;
}
// This function assumes that the contents of the default display are
// processed first before secondary displays.
final DisplayContent displayContent = w.getDisplayContent();
if (displayContent != null && displayContent.isDefaultDisplay) {
// keyguard dialogs to be shown.
if (type == TYPE_DREAM || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
mObscureApplicationContentOnSecondaryDisplays = true;
}
mDisplayHasContent = true;
} else if (displayContent != null && (!mObscureApplicationContentOnSecondaryDisplays || (mObscured && type == TYPE_KEYGUARD_DIALOG))) {
// Allow full screen keyguard presentation dialogs to be seen.
mDisplayHasContent = true;
}
if (mPreferredRefreshRate == 0 && w.mAttrs.preferredRefreshRate != 0) {
mPreferredRefreshRate = w.mAttrs.preferredRefreshRate;
}
if (mPreferredModeId == 0 && w.mAttrs.preferredDisplayModeId != 0) {
mPreferredModeId = w.mAttrs.preferredDisplayModeId;
}
if ((privateflags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
mSustainedPerformanceModeCurrent = true;
}
}
}
use of android.view.WindowManager.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class WindowSurfacePlacer method handleAppTransitionReadyLocked.
/**
* @param windows List of windows on default display.
* @return bitmap indicating if another pass through layout must be made.
*/
private int handleAppTransitionReadyLocked(WindowList windows) {
int appsCount = mService.mOpeningApps.size();
if (!transitionGoodToGo(appsCount)) {
return 0;
}
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady");
if (DEBUG_APP_TRANSITIONS)
Slog.v(TAG, "**** GOOD TO GO");
int transit = mService.mAppTransition.getAppTransition();
if (mService.mSkipAppTransitionAnimation) {
transit = AppTransition.TRANSIT_UNSET;
}
mService.mSkipAppTransitionAnimation = false;
mService.mNoAnimationNotifyOnTransitionFinished.clear();
mService.mH.removeMessages(H.APP_TRANSITION_TIMEOUT);
mService.rebuildAppWindowListLocked();
mWallpaperMayChange = false;
// The top-most window will supply the layout params,
// and we will determine it below.
LayoutParams animLp = null;
int bestAnimLayer = -1;
boolean fullscreenAnim = false;
boolean voiceInteraction = false;
int i;
for (i = 0; i < appsCount; i++) {
final AppWindowToken wtoken = mService.mOpeningApps.valueAt(i);
// Clearing the mAnimatingExit flag before entering animation. It's set to
// true if app window is removed, or window relayout to invisible.
// This also affects window visibility. We need to clear it *before*
// maybeUpdateTransitToWallpaper() as the transition selection depends on
// wallpaper target visibility.
wtoken.clearAnimatingFlags();
}
// Adjust wallpaper before we pull the lower/upper target, since pending changes
// (like the clearAnimatingFlags() above) might affect wallpaper target result.
final DisplayContent displayContent = mService.getDefaultDisplayContentLocked();
if ((displayContent.pendingLayoutChanges & FINISH_LAYOUT_REDO_WALLPAPER) != 0 && mWallpaperControllerLocked.adjustWallpaperWindows()) {
mService.mLayersController.assignLayersLocked(windows);
displayContent.layoutNeeded = true;
}
final WindowState lowerWallpaperTarget = mWallpaperControllerLocked.getLowerWallpaperTarget();
final WindowState upperWallpaperTarget = mWallpaperControllerLocked.getUpperWallpaperTarget();
boolean openingAppHasWallpaper = false;
boolean closingAppHasWallpaper = false;
final AppWindowToken lowerWallpaperAppToken;
final AppWindowToken upperWallpaperAppToken;
if (lowerWallpaperTarget == null) {
lowerWallpaperAppToken = upperWallpaperAppToken = null;
} else {
lowerWallpaperAppToken = lowerWallpaperTarget.mAppToken;
upperWallpaperAppToken = upperWallpaperTarget.mAppToken;
}
// Do a first pass through the tokens for two
// things:
// (1) Determine if both the closing and opening
// app token sets are wallpaper targets, in which
// case special animations are needed
// (since the wallpaper needs to stay static
// behind them).
// (2) Find the layout params of the top-most
// application window in the tokens, which is
// what will control the animation theme.
final int closingAppsCount = mService.mClosingApps.size();
appsCount = closingAppsCount + mService.mOpeningApps.size();
for (i = 0; i < appsCount; i++) {
final AppWindowToken wtoken;
if (i < closingAppsCount) {
wtoken = mService.mClosingApps.valueAt(i);
if (wtoken == lowerWallpaperAppToken || wtoken == upperWallpaperAppToken) {
closingAppHasWallpaper = true;
}
} else {
wtoken = mService.mOpeningApps.valueAt(i - closingAppsCount);
if (wtoken == lowerWallpaperAppToken || wtoken == upperWallpaperAppToken) {
openingAppHasWallpaper = true;
}
}
voiceInteraction |= wtoken.voiceInteraction;
if (wtoken.appFullscreen) {
WindowState ws = wtoken.findMainWindow();
if (ws != null) {
animLp = ws.mAttrs;
bestAnimLayer = ws.mLayer;
fullscreenAnim = true;
}
} else if (!fullscreenAnim) {
WindowState ws = wtoken.findMainWindow();
if (ws != null) {
if (ws.mLayer > bestAnimLayer) {
animLp = ws.mAttrs;
bestAnimLayer = ws.mLayer;
}
}
}
}
transit = maybeUpdateTransitToWallpaper(transit, openingAppHasWallpaper, closingAppHasWallpaper, lowerWallpaperTarget, upperWallpaperTarget);
// the lock screen.
if (!mService.mPolicy.allowAppAnimationsLw()) {
if (DEBUG_APP_TRANSITIONS)
Slog.v(TAG, "Animations disallowed by keyguard or dream.");
animLp = null;
}
processApplicationsAnimatingInPlace(transit);
mTmpLayerAndToken.token = null;
handleClosingApps(transit, animLp, voiceInteraction, mTmpLayerAndToken);
final AppWindowToken topClosingApp = mTmpLayerAndToken.token;
final int topClosingLayer = mTmpLayerAndToken.layer;
final AppWindowToken topOpeningApp = handleOpeningApps(transit, animLp, voiceInteraction, topClosingLayer);
mService.mAppTransition.setLastAppTransition(transit, topOpeningApp, topClosingApp);
final AppWindowAnimator openingAppAnimator = (topOpeningApp == null) ? null : topOpeningApp.mAppAnimator;
final AppWindowAnimator closingAppAnimator = (topClosingApp == null) ? null : topClosingApp.mAppAnimator;
mService.mAppTransition.goodToGo(openingAppAnimator, closingAppAnimator, mService.mOpeningApps, mService.mClosingApps);
mService.mAppTransition.postAnimationCallback();
mService.mAppTransition.clear();
mService.mOpeningApps.clear();
mService.mClosingApps.clear();
// This has changed the visibility of windows, so perform
// a new layout to get them all up-to-date.
displayContent.layoutNeeded = true;
// TODO(multidisplay): IMEs are only supported on the default display.
if (windows == mService.getDefaultWindowListLocked() && !mService.moveInputMethodWindowsIfNeededLocked(true)) {
mService.mLayersController.assignLayersLocked(windows);
}
mService.updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES, true);
mService.mFocusMayChange = false;
mService.notifyActivityDrawnForKeyguard();
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
return FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG;
}
use of android.view.WindowManager.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class PopupWindow method update.
private void update(View anchor, boolean updateLocation, int xoff, int yoff, int width, int height) {
if (!isShowing() || mContentView == null) {
return;
}
final WeakReference<View> oldAnchor = mAnchor;
final int gravity = mAnchoredGravity;
final boolean needsUpdate = updateLocation && (mAnchorXoff != xoff || mAnchorYoff != yoff);
if (oldAnchor == null || oldAnchor.get() != anchor || (needsUpdate && !mIsDropdown)) {
attachToAnchor(anchor, xoff, yoff, gravity);
} else if (needsUpdate) {
// No need to register again if this is a DropDown, showAsDropDown already did.
mAnchorXoff = xoff;
mAnchorYoff = yoff;
}
final LayoutParams p = (LayoutParams) mDecorView.getLayoutParams();
final int oldGravity = p.gravity;
final int oldWidth = p.width;
final int oldHeight = p.height;
final int oldX = p.x;
final int oldY = p.y;
// explicitly specified value (either from setWidth/Height or update).
if (width < 0) {
width = mWidth;
}
if (height < 0) {
height = mHeight;
}
final boolean aboveAnchor = findDropDownPosition(anchor, p, mAnchorXoff, mAnchorYoff, width, height, gravity, mAllowScrollingAnchorParent);
updateAboveAnchor(aboveAnchor);
final boolean paramsChanged = oldGravity != p.gravity || oldX != p.x || oldY != p.y || oldWidth != p.width || oldHeight != p.height;
// If width and mWidth were both < 0 then we have a MATCH_PARENT or
// WRAP_CONTENT case. findDropDownPosition will have resolved this to
// absolute values, but we don't want to update mWidth/mHeight to these
// absolute values.
final int newWidth = width < 0 ? width : p.width;
final int newHeight = height < 0 ? height : p.height;
update(p.x, p.y, newWidth, newHeight, paramsChanged);
}
use of android.view.WindowManager.LayoutParams in project android_frameworks_base by DirtyUnicorns.
the class ZoomButtonsController method createContainer.
private FrameLayout createContainer() {
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
// Controls are positioned BOTTOM | CENTER with respect to the owner view.
lp.gravity = Gravity.TOP | Gravity.START;
lp.flags = LayoutParams.FLAG_NOT_TOUCHABLE | LayoutParams.FLAG_NOT_FOCUSABLE | LayoutParams.FLAG_LAYOUT_NO_LIMITS | LayoutParams.FLAG_ALT_FOCUSABLE_IM;
lp.height = LayoutParams.WRAP_CONTENT;
lp.width = LayoutParams.MATCH_PARENT;
lp.type = LayoutParams.TYPE_APPLICATION_PANEL;
lp.format = PixelFormat.TRANSLUCENT;
lp.windowAnimations = com.android.internal.R.style.Animation_ZoomButtons;
mContainerLayoutParams = lp;
FrameLayout container = new Container(mContext);
container.setLayoutParams(lp);
container.setMeasureAllChildren(true);
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(com.android.internal.R.layout.zoom_container, container);
mControls = (ZoomControls) container.findViewById(com.android.internal.R.id.zoomControls);
mControls.setOnZoomInClickListener(new OnClickListener() {
public void onClick(View v) {
dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
if (mCallback != null)
mCallback.onZoom(true);
}
});
mControls.setOnZoomOutClickListener(new OnClickListener() {
public void onClick(View v) {
dismissControlsDelayed(ZOOM_CONTROLS_TIMEOUT);
if (mCallback != null)
mCallback.onZoom(false);
}
});
return container;
}
use of android.view.WindowManager.LayoutParams in project android_frameworks_base by ResurrectionRemix.
the class WindowSurfacePlacer method handleNotObscuredLocked.
/**
* @param w WindowState this method is applied to.
* @param dispInfo info of the display that the window's obscuring state is checked against.
*/
private void handleNotObscuredLocked(final WindowState w, final DisplayInfo dispInfo) {
final LayoutParams attrs = w.mAttrs;
final int attrFlags = attrs.flags;
final boolean canBeSeen = w.isDisplayedLw();
final int privateflags = attrs.privateFlags;
if (canBeSeen && w.isObscuringFullscreen(dispInfo)) {
// performance reasons).
if (!mObscured) {
mObsuringWindow = w;
}
mObscured = true;
}
if (w.mHasSurface && canBeSeen) {
if ((attrFlags & FLAG_KEEP_SCREEN_ON) != 0) {
mHoldScreen = w.mSession;
mHoldScreenWindow = w;
} else if (DEBUG_KEEP_SCREEN_ON && w == mService.mLastWakeLockHoldingWindow) {
Slog.d(TAG_KEEP_SCREEN_ON, "handleNotObscuredLocked: " + w + " was holding " + "screen wakelock but no longer has FLAG_KEEP_SCREEN_ON!!! called by" + Debug.getCallers(10));
}
if (!mSyswin && w.mAttrs.screenBrightness >= 0 && mScreenBrightness < 0) {
mScreenBrightness = w.mAttrs.screenBrightness;
}
if (!mSyswin && w.mAttrs.buttonBrightness >= 0 && mButtonBrightness < 0) {
mButtonBrightness = w.mAttrs.buttonBrightness;
}
if (!mSyswin && w.mAttrs.userActivityTimeout >= 0 && mUserActivityTimeout < 0) {
mUserActivityTimeout = w.mAttrs.userActivityTimeout;
}
final int type = attrs.type;
if (type == TYPE_SYSTEM_DIALOG || type == TYPE_SYSTEM_ERROR || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
mSyswin = true;
}
// This function assumes that the contents of the default display are
// processed first before secondary displays.
final DisplayContent displayContent = w.getDisplayContent();
if (displayContent != null && displayContent.isDefaultDisplay) {
// keyguard dialogs to be shown.
if (type == TYPE_DREAM || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
mObscureApplicationContentOnSecondaryDisplays = true;
}
mDisplayHasContent = true;
} else if (displayContent != null && (!mObscureApplicationContentOnSecondaryDisplays || (mObscured && type == TYPE_KEYGUARD_DIALOG))) {
// Allow full screen keyguard presentation dialogs to be seen.
mDisplayHasContent = true;
}
if (mPreferredRefreshRate == 0 && w.mAttrs.preferredRefreshRate != 0) {
mPreferredRefreshRate = w.mAttrs.preferredRefreshRate;
}
if (mPreferredModeId == 0 && w.mAttrs.preferredDisplayModeId != 0) {
mPreferredModeId = w.mAttrs.preferredDisplayModeId;
}
if ((privateflags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
mSustainedPerformanceModeCurrent = true;
}
}
}
Aggregations