Merge "Fixed some issues with fullscreen dimming" into nyc-dev
am: e208bd4cbe
* commit 'e208bd4cbea7468c989d25ef582e5a9ed7ecabf1':
Fixed some issues with fullscreen dimming
Change-Id: Ibf06c08daca76f47a7a3cd8baf94aaf0b4d8adc2
This commit is contained in:
@@ -73,8 +73,8 @@ public class DimLayer {
|
|||||||
|
|
||||||
/** Interface implemented by users of the dim layer */
|
/** Interface implemented by users of the dim layer */
|
||||||
interface DimLayerUser {
|
interface DimLayerUser {
|
||||||
/** Returns true if the user of the dim layer is fullscreen. */
|
/** Returns true if the dim should be fullscreen. */
|
||||||
boolean isFullscreen();
|
boolean dimFullscreen();
|
||||||
/** Returns the display info. of the dim layer user. */
|
/** Returns the display info. of the dim layer user. */
|
||||||
DisplayInfo getDisplayInfo();
|
DisplayInfo getDisplayInfo();
|
||||||
/** Gets the bounds of the dim layer user. */
|
/** Gets the bounds of the dim layer user. */
|
||||||
@@ -188,33 +188,40 @@ public class DimLayer {
|
|||||||
* NOTE: Must be called with Surface transaction open.
|
* NOTE: Must be called with Surface transaction open.
|
||||||
*/
|
*/
|
||||||
private void adjustBounds() {
|
private void adjustBounds() {
|
||||||
final int dw, dh;
|
if (mUser.dimFullscreen()) {
|
||||||
final float xPos, yPos;
|
getBoundsForFullscreen(mBounds);
|
||||||
if (!mUser.isFullscreen()) {
|
|
||||||
dw = mBounds.width();
|
|
||||||
dh = mBounds.height();
|
|
||||||
xPos = mBounds.left;
|
|
||||||
yPos = mBounds.top;
|
|
||||||
} else {
|
|
||||||
// Set surface size to screen size.
|
|
||||||
final DisplayInfo info = mUser.getDisplayInfo();
|
|
||||||
// Multiply by 1.5 so that rotating a frozen surface that includes this does not expose
|
|
||||||
// a corner.
|
|
||||||
dw = (int) (info.logicalWidth * 1.5);
|
|
||||||
dh = (int) (info.logicalHeight * 1.5);
|
|
||||||
// back off position so 1/4 of Surface is before and 1/4 is after.
|
|
||||||
xPos = -1 * dw / 6;
|
|
||||||
yPos = -1 * dh / 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mDimSurface != null) {
|
if (mDimSurface != null) {
|
||||||
mDimSurface.setPosition(xPos, yPos);
|
mDimSurface.setPosition(mBounds.left, mBounds.top);
|
||||||
mDimSurface.setSize(dw, dh);
|
mDimSurface.setSize(mBounds.width(), mBounds.height());
|
||||||
|
if (DEBUG_DIM_LAYER) Slog.v(TAG,
|
||||||
|
"adjustBounds user=" + mUser.toShortString() + " mBounds=" + mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
mLastBounds.set(mBounds);
|
mLastBounds.set(mBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getBoundsForFullscreen(Rect outBounds) {
|
||||||
|
final int dw, dh;
|
||||||
|
final float xPos, yPos;
|
||||||
|
// Set surface size to screen size.
|
||||||
|
final DisplayInfo info = mUser.getDisplayInfo();
|
||||||
|
// Multiply by 1.5 so that rotating a frozen surface that includes this does not expose
|
||||||
|
// a corner.
|
||||||
|
dw = (int) (info.logicalWidth * 1.5);
|
||||||
|
dh = (int) (info.logicalHeight * 1.5);
|
||||||
|
// back off position so 1/4 of Surface is before and 1/4 is after.
|
||||||
|
xPos = -1 * dw / 6;
|
||||||
|
yPos = -1 * dh / 6;
|
||||||
|
outBounds.set((int) xPos, (int) yPos, (int) xPos + dw, (int) yPos + dh);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBoundsForFullscreen() {
|
||||||
|
getBoundsForFullscreen(mBounds);
|
||||||
|
setBounds(mBounds);
|
||||||
|
}
|
||||||
|
|
||||||
/** @param bounds The new bounds to set */
|
/** @param bounds The new bounds to set */
|
||||||
void setBounds(Rect bounds) {
|
void setBounds(Rect bounds) {
|
||||||
mBounds.set(bounds);
|
mBounds.set(bounds);
|
||||||
|
|||||||
@@ -48,14 +48,15 @@ class DimLayerController {
|
|||||||
|
|
||||||
/** Updates the dim layer bounds, recreating it if needed. */
|
/** Updates the dim layer bounds, recreating it if needed. */
|
||||||
void updateDimLayer(DimLayer.DimLayerUser dimLayerUser) {
|
void updateDimLayer(DimLayer.DimLayerUser dimLayerUser) {
|
||||||
DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
|
final DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
|
||||||
final boolean previousFullscreen = state.dimLayer != null
|
final boolean previousFullscreen = state.dimLayer != null
|
||||||
&& state.dimLayer == mSharedFullScreenDimLayer;
|
&& state.dimLayer == mSharedFullScreenDimLayer;
|
||||||
DimLayer newDimLayer;
|
DimLayer newDimLayer;
|
||||||
final int displayId = mDisplayContent.getDisplayId();
|
final int displayId = mDisplayContent.getDisplayId();
|
||||||
if (dimLayerUser.isFullscreen()) {
|
if (dimLayerUser.dimFullscreen()) {
|
||||||
if (previousFullscreen) {
|
if (previousFullscreen && mSharedFullScreenDimLayer != null) {
|
||||||
// Nothing to do here...
|
// Update the bounds for fullscreen in case of rotation.
|
||||||
|
mSharedFullScreenDimLayer.setBoundsForFullscreen();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Use shared fullscreen dim layer
|
// Use shared fullscreen dim layer
|
||||||
@@ -146,7 +147,7 @@ class DimLayerController {
|
|||||||
|| !state.animator.getShown()
|
|| !state.animator.getShown()
|
||||||
|| state.animator.mAnimLayer <= newWinAnimator.mAnimLayer)) {
|
|| state.animator.mAnimLayer <= newWinAnimator.mAnimLayer)) {
|
||||||
state.animator = newWinAnimator;
|
state.animator = newWinAnimator;
|
||||||
if (state.animator.mWin.mAppToken == null && !dimLayerUser.isFullscreen()) {
|
if (state.animator.mWin.mAppToken == null && !dimLayerUser.dimFullscreen()) {
|
||||||
// Dim should cover the entire screen for system windows.
|
// Dim should cover the entire screen for system windows.
|
||||||
mDisplayContent.getLogicalDisplayRect(mTmpBounds);
|
mDisplayContent.getLogicalDisplayRect(mTmpBounds);
|
||||||
} else {
|
} else {
|
||||||
@@ -190,11 +191,11 @@ class DimLayerController {
|
|||||||
for (int i = mState.size() - 1; i >= 0; i--) {
|
for (int i = mState.size() - 1; i >= 0; i--) {
|
||||||
DimLayer.DimLayerUser user = mState.keyAt(i);
|
DimLayer.DimLayerUser user = mState.keyAt(i);
|
||||||
DimLayerState state = mState.valueAt(i);
|
DimLayerState state = mState.valueAt(i);
|
||||||
// We have to check that we are acutally the shared fullscreen layer
|
// We have to check that we are actually the shared fullscreen layer
|
||||||
// for this path. If we began as non fullscreen and became fullscreen
|
// for this path. If we began as non fullscreen and became fullscreen
|
||||||
// (e.g. Docked stack closing), then we may not be the shared layer
|
// (e.g. Docked stack closing), then we may not be the shared layer
|
||||||
// and we have to make sure we always animate the layer.
|
// and we have to make sure we always animate the layer.
|
||||||
if (user.isFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
|
if (user.dimFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
|
||||||
fullScreen = i;
|
fullScreen = i;
|
||||||
if (mState.valueAt(i).continueDimming) {
|
if (mState.valueAt(i).continueDimming) {
|
||||||
fullScreenAndDimming = i;
|
fullScreenAndDimming = i;
|
||||||
@@ -337,15 +338,18 @@ class DimLayerController {
|
|||||||
|
|
||||||
void dump(String prefix, PrintWriter pw) {
|
void dump(String prefix, PrintWriter pw) {
|
||||||
pw.println(prefix + "DimLayerController");
|
pw.println(prefix + "DimLayerController");
|
||||||
for (int i = 0, n = mState.size(); i < n; i++) {
|
final String doubleSpace = " ";
|
||||||
pw.println(prefix + " " + mState.keyAt(i).toShortString());
|
final String prefixPlusDoubleSpace = prefix + doubleSpace;
|
||||||
pw.print(prefix + " ");
|
|
||||||
DimLayerState state = mState.valueAt(i);
|
|
||||||
pw.print("dimLayer=" + (state.dimLayer == mSharedFullScreenDimLayer ? "shared" :
|
|
||||||
state.dimLayer));
|
|
||||||
pw.print(", animator=" + state.animator);
|
|
||||||
pw.println(", continueDimming=" + state.continueDimming + "}");
|
|
||||||
|
|
||||||
|
for (int i = 0, n = mState.size(); i < n; i++) {
|
||||||
|
pw.println(prefixPlusDoubleSpace + mState.keyAt(i).toShortString());
|
||||||
|
DimLayerState state = mState.valueAt(i);
|
||||||
|
pw.println(prefixPlusDoubleSpace + doubleSpace + "dimLayer="
|
||||||
|
+ (state.dimLayer == mSharedFullScreenDimLayer ? "shared" : state.dimLayer)
|
||||||
|
+ ", animator=" + state.animator + ", continueDimming=" + state.continueDimming);
|
||||||
|
if (state.dimLayer != null) {
|
||||||
|
state.dimLayer.printTo(prefixPlusDoubleSpace + doubleSpace, pw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -765,7 +765,7 @@ public class DockedStackDividerController implements DimLayerUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullscreen() {
|
public boolean dimFullscreen() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -750,7 +750,11 @@ class Task implements DimLayer.DimLayerUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullscreen() {
|
public boolean dimFullscreen() {
|
||||||
|
return isHomeTask() || isFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isFullscreen() {
|
||||||
if (useCurrentBounds()) {
|
if (useCurrentBounds()) {
|
||||||
return mFullscreen;
|
return mFullscreen;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -515,7 +515,11 @@ class TaskPositioner implements DimLayer.DimLayerUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override /** {@link DimLayer.DimLayerUser} */
|
@Override /** {@link DimLayer.DimLayerUser} */
|
||||||
public boolean isFullscreen() {
|
public boolean dimFullscreen() {
|
||||||
|
return isFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isFullscreen() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1155,7 +1155,11 @@ public class TaskStack implements DimLayer.DimLayerUser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullscreen() {
|
public boolean dimFullscreen() {
|
||||||
|
return mStackId == HOME_STACK_ID || isFullscreen();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isFullscreen() {
|
||||||
if (useCurrentBounds()) {
|
if (useCurrentBounds()) {
|
||||||
return mFullscreen;
|
return mFullscreen;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user