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
1 file changed