Allow to keep screen on only if window can be seen am: b20addbdfb

am: 19353b45e5

Change-Id: Id0d729e59d156ec93a59031efa670642c1b70502
This commit is contained in:
Andrii Kulian
2016-08-12 00:56:58 +00:00
committed by android-build-merger

View File

@@ -1483,7 +1483,7 @@ class WindowSurfacePlacer {
mObscured = true; mObscured = true;
} }
if (w.mHasSurface) { if (w.mHasSurface && canBeSeen) {
if ((attrFlags&FLAG_KEEP_SCREEN_ON) != 0) { if ((attrFlags&FLAG_KEEP_SCREEN_ON) != 0) {
mHoldScreen = w.mSession; mHoldScreen = w.mSession;
mHoldScreenWindow = w; mHoldScreenWindow = w;
@@ -1506,43 +1506,39 @@ class WindowSurfacePlacer {
} }
final int type = attrs.type; final int type = attrs.type;
if (canBeSeen if (type == TYPE_SYSTEM_DIALOG || type == TYPE_SYSTEM_ERROR
&& (type == TYPE_SYSTEM_DIALOG || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
|| type == TYPE_SYSTEM_ERROR
|| (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0)) {
mSyswin = true; mSyswin = true;
} }
if (canBeSeen) { // This function assumes that the contents of the default display are
// This function assumes that the contents of the default display are // processed first before secondary displays.
// processed first before secondary displays. final DisplayContent displayContent = w.getDisplayContent();
final DisplayContent displayContent = w.getDisplayContent(); if (displayContent != null && displayContent.isDefaultDisplay) {
if (displayContent != null && displayContent.isDefaultDisplay) { // While a dream or keyguard is showing, obscure ordinary application
// While a dream or keyguard is showing, obscure ordinary application // content on secondary displays (by forcibly enabling mirroring unless
// content on secondary displays (by forcibly enabling mirroring unless // there is other content we want to show) but still allow opaque
// there is other content we want to show) but still allow opaque // keyguard dialogs to be shown.
// keyguard dialogs to be shown. if (type == TYPE_DREAM || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) {
if (type == TYPE_DREAM || (attrs.privateFlags & PRIVATE_FLAG_KEYGUARD) != 0) { mObscureApplicationContentOnSecondaryDisplays = true;
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;
} }
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;
} }
} }
} }