Allow a drawn reported activity to keep screen brightness
In case if the activity was requested to redraw for config change,
then the draw state becomes DRAW_PENDING (isDrawn() will be false)
but it is still visible on screen.
The firstWindowDrawn is set when the main window of activity is
drawn, and it cleared when the activity is stopped. So it can
keep the state across redraw.
Also simplify the conditions a bit because onScreen already means
mHasSurface==true and isDisplayed()==onScreen&&isDrawn().
Bug: 284917190
Test: Launch an activity which sets screenBrightness and enter
split screen. After resizing the divider, the screen
brightness should not be changed.
Change-Id: If31fc3ff492918e6486c0e16ef5ca3edb16b0bea
This commit is contained in:
@@ -1046,31 +1046,28 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
* manager may choose to mirror or blank the display.
|
||||
*/
|
||||
boolean handleNotObscuredLocked(WindowState w, boolean obscured, boolean syswin) {
|
||||
final WindowManager.LayoutParams attrs = w.mAttrs;
|
||||
final int attrFlags = attrs.flags;
|
||||
final boolean onScreen = w.isOnScreen();
|
||||
final boolean canBeSeen = w.isDisplayed();
|
||||
final int privateflags = attrs.privateFlags;
|
||||
boolean displayHasContent = false;
|
||||
|
||||
ProtoLog.d(WM_DEBUG_KEEP_SCREEN_ON,
|
||||
"handleNotObscuredLocked w: %s, w.mHasSurface: %b, w.isOnScreen(): %b, w"
|
||||
+ ".isDisplayedLw(): %b, w.mAttrs.userActivityTimeout: %d",
|
||||
w, w.mHasSurface, onScreen, w.isDisplayed(), w.mAttrs.userActivityTimeout);
|
||||
if (w.mHasSurface && onScreen) {
|
||||
if (!syswin && w.mAttrs.userActivityTimeout >= 0 && mUserActivityTimeout < 0) {
|
||||
mUserActivityTimeout = w.mAttrs.userActivityTimeout;
|
||||
ProtoLog.d(WM_DEBUG_KEEP_SCREEN_ON, "mUserActivityTimeout set to %d",
|
||||
mUserActivityTimeout);
|
||||
}
|
||||
if (!onScreen) {
|
||||
return false;
|
||||
}
|
||||
if (w.mHasSurface && canBeSeen) {
|
||||
if (!syswin && w.mAttrs.userActivityTimeout >= 0 && mUserActivityTimeout < 0) {
|
||||
mUserActivityTimeout = w.mAttrs.userActivityTimeout;
|
||||
ProtoLog.d(WM_DEBUG_KEEP_SCREEN_ON, "mUserActivityTimeout set to %d",
|
||||
mUserActivityTimeout);
|
||||
}
|
||||
if (w.isDrawn() || (w.mActivityRecord != null && w.mActivityRecord.firstWindowDrawn
|
||||
&& w.mActivityRecord.isVisibleRequested())) {
|
||||
if (!syswin && w.mAttrs.screenBrightness >= 0
|
||||
&& Float.isNaN(mScreenBrightnessOverride)) {
|
||||
mScreenBrightnessOverride = w.mAttrs.screenBrightness;
|
||||
}
|
||||
|
||||
final int type = attrs.type;
|
||||
// This function assumes that the contents of the default display are processed first
|
||||
// before secondary displays.
|
||||
final DisplayContent displayContent = w.getDisplayContent();
|
||||
@@ -1084,11 +1081,11 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
||||
displayHasContent = true;
|
||||
} else if (displayContent != null &&
|
||||
(!mObscureApplicationContentOnSecondaryDisplays
|
||||
|| (obscured && type == TYPE_KEYGUARD_DIALOG))) {
|
||||
|| (obscured && w.mAttrs.type == TYPE_KEYGUARD_DIALOG))) {
|
||||
// Allow full screen keyguard presentation dialogs to be seen.
|
||||
displayHasContent = true;
|
||||
}
|
||||
if ((privateflags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
|
||||
if ((w.mAttrs.privateFlags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
|
||||
mSustainedPerformanceModeCurrent = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user