Merge "Don't apply dim if there is no docked stack" into nyc-dev
This commit is contained in:
@@ -84,10 +84,13 @@ public class DimLayer {
|
||||
/** The user of this dim layer. */
|
||||
private final DimLayerUser mUser;
|
||||
|
||||
DimLayer(WindowManagerService service, DimLayerUser user, int displayId) {
|
||||
private final String mName;
|
||||
|
||||
DimLayer(WindowManagerService service, DimLayerUser user, int displayId, String name) {
|
||||
mUser = user;
|
||||
mDisplayId = displayId;
|
||||
mService = service;
|
||||
mName = name;
|
||||
if (DEBUG_DIM_LAYER) Slog.v(TAG, "Ctor: displayId=" + displayId);
|
||||
}
|
||||
|
||||
@@ -100,7 +103,7 @@ public class DimLayer {
|
||||
16, 16, PixelFormat.OPAQUE,
|
||||
SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN);
|
||||
} else {
|
||||
mDimSurface = new SurfaceControl(service.mFxSession, TAG,
|
||||
mDimSurface = new SurfaceControl(service.mFxSession, mName,
|
||||
16, 16, PixelFormat.OPAQUE,
|
||||
SurfaceControl.FX_SURFACE_DIM | SurfaceControl.HIDDEN);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import android.util.ArrayMap;
|
||||
import android.util.Slog;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import com.android.server.wm.DimLayer.DimLayerUser;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
@@ -18,7 +20,8 @@ import java.io.PrintWriter;
|
||||
* as well as other use cases (such as dimming above a dead window).
|
||||
*/
|
||||
class DimLayerController {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "DimLayerController" : TAG_WM;
|
||||
private static final String TAG_LOCAL = "DimLayerController";
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? TAG_LOCAL : TAG_WM;
|
||||
|
||||
/** Amount of time in milliseconds to animate the dim surface from one value to another,
|
||||
* when no window animation is driving it. */
|
||||
@@ -63,7 +66,8 @@ class DimLayerController {
|
||||
newDimLayer = state.dimLayer;
|
||||
} else {
|
||||
// Create new full screen dim layer.
|
||||
newDimLayer = new DimLayer(mDisplayContent.mService, dimLayerUser, displayId);
|
||||
newDimLayer = new DimLayer(mDisplayContent.mService, dimLayerUser, displayId,
|
||||
getDimLayerTag(dimLayerUser));
|
||||
}
|
||||
dimLayerUser.getDimBounds(mTmpBounds);
|
||||
newDimLayer.setBounds(mTmpBounds);
|
||||
@@ -73,7 +77,8 @@ class DimLayerController {
|
||||
}
|
||||
} else {
|
||||
newDimLayer = (state.dimLayer == null || previousFullscreen)
|
||||
? new DimLayer(mDisplayContent.mService, dimLayerUser, displayId)
|
||||
? new DimLayer(mDisplayContent.mService, dimLayerUser, displayId,
|
||||
getDimLayerTag(dimLayerUser))
|
||||
: state.dimLayer;
|
||||
dimLayerUser.getDimBounds(mTmpBounds);
|
||||
newDimLayer.setBounds(mTmpBounds);
|
||||
@@ -81,6 +86,10 @@ class DimLayerController {
|
||||
state.dimLayer = newDimLayer;
|
||||
}
|
||||
|
||||
private static String getDimLayerTag(DimLayerUser dimLayerUser) {
|
||||
return TAG_LOCAL + "/" + dimLayerUser.toShortString();
|
||||
}
|
||||
|
||||
private DimLayerState getOrCreateDimLayerState(DimLayer.DimLayerUser dimLayerUser) {
|
||||
if (DEBUG_DIM_LAYER) Slog.v(TAG, "getOrCreateDimLayerState, dimLayerUser="
|
||||
+ dimLayerUser.toShortString());
|
||||
|
||||
@@ -16,6 +16,17 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
|
||||
import static android.view.WindowManager.DOCKED_BOTTOM;
|
||||
import static android.view.WindowManager.DOCKED_LEFT;
|
||||
import static android.view.WindowManager.DOCKED_RIGHT;
|
||||
import static android.view.WindowManager.DOCKED_TOP;
|
||||
import static com.android.server.wm.AppTransition.DEFAULT_APP_TRANSITION_DURATION;
|
||||
import static com.android.server.wm.AppTransition.TOUCH_RESPONSE_INTERPOLATOR;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.RemoteCallbackList;
|
||||
@@ -30,19 +41,6 @@ import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.server.wm.DimLayer.DimLayerUser;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
|
||||
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
|
||||
import static android.view.WindowManager.DOCKED_BOTTOM;
|
||||
import static android.view.WindowManager.DOCKED_LEFT;
|
||||
import static android.view.WindowManager.DOCKED_RIGHT;
|
||||
import static android.view.WindowManager.DOCKED_TOP;
|
||||
import static com.android.server.wm.AppTransition.DEFAULT_APP_TRANSITION_DURATION;
|
||||
import static com.android.server.wm.AppTransition.TOUCH_RESPONSE_INTERPOLATOR;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
|
||||
|
||||
/**
|
||||
* Keeps information about the docked stack divider.
|
||||
*/
|
||||
@@ -106,7 +104,8 @@ public class DockedStackDividerController implements DimLayerUser {
|
||||
com.android.internal.R.dimen.docked_stack_divider_thickness);
|
||||
mDividerInsets = context.getResources().getDimensionPixelSize(
|
||||
com.android.internal.R.dimen.docked_stack_divider_insets);
|
||||
mDimLayer = new DimLayer(displayContent.mService, this, displayContent.getDisplayId());
|
||||
mDimLayer = new DimLayer(displayContent.mService, this, displayContent.getDisplayId(),
|
||||
"DockedStackDim");
|
||||
mMinimizedDockInterpolator = AnimationUtils.loadInterpolator(
|
||||
context, android.R.interpolator.fast_out_slow_in);
|
||||
}
|
||||
@@ -247,8 +246,9 @@ public class DockedStackDividerController implements DimLayerUser {
|
||||
|
||||
void setResizeDimLayer(boolean visible, int targetStackId, float alpha) {
|
||||
SurfaceControl.openTransaction();
|
||||
TaskStack stack = mDisplayContent.mService.mStackIdToStack.get(targetStackId);
|
||||
boolean visibleAndValid = visible && stack != null;
|
||||
final TaskStack stack = mDisplayContent.mService.mStackIdToStack.get(targetStackId);
|
||||
final TaskStack dockedStack = mDisplayContent.getDockedStackLocked();
|
||||
boolean visibleAndValid = visible && stack != null && dockedStack != null;
|
||||
if (visibleAndValid) {
|
||||
stack.getDimBounds(mTmpRect);
|
||||
if (mTmpRect.height() > 0 && mTmpRect.width() > 0) {
|
||||
|
||||
@@ -60,7 +60,8 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
class TaskPositioner implements DimLayer.DimLayerUser {
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskPositioner" : TAG_WM;
|
||||
private static final String TAG_LOCAL = "TaskPositioner";
|
||||
private static final String TAG = TAG_WITH_CLASS_NAME ? TAG_LOCAL : TAG_WM;
|
||||
|
||||
// The margin the pointer position has to be within the side of the screen to be
|
||||
// considered at the side of the screen.
|
||||
@@ -287,7 +288,7 @@ class TaskPositioner implements DimLayer.DimLayerUser {
|
||||
}
|
||||
mService.pauseRotationLocked();
|
||||
|
||||
mDimLayer = new DimLayer(mService, this, mDisplay.getDisplayId());
|
||||
mDimLayer = new DimLayer(mService, this, mDisplay.getDisplayId(), TAG_LOCAL);
|
||||
mSideMargin = dipToPixel(SIDE_MARGIN_DIP, mDisplayMetrics);
|
||||
mMinVisibleWidth = dipToPixel(MINIMUM_VISIBLE_WIDTH_IN_DP, mDisplayMetrics);
|
||||
mMinVisibleHeight = dipToPixel(MINIMUM_VISIBLE_HEIGHT_IN_DP, mDisplayMetrics);
|
||||
|
||||
@@ -585,7 +585,8 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
||||
}
|
||||
|
||||
mDisplayContent = displayContent;
|
||||
mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId());
|
||||
mAnimationBackgroundSurface = new DimLayer(mService, this, mDisplayContent.getDisplayId(),
|
||||
"animation background stackId=" + mStackId);
|
||||
|
||||
Rect bounds = null;
|
||||
final TaskStack dockedStack = mService.mStackIdToStack.get(DOCKED_STACK_ID);
|
||||
|
||||
Reference in New Issue
Block a user