Send display-OFF event if that is initial state.

Local Displays have always sent an initial state of something
other than OFF.  With foldables, thats not the case any more so
don't ignore state_off events if the device's state was previously
UNKNOWN.

Bug: 178713651
Test: manual, atest com.android.server.display
Change-Id: Icc426c289e59aad43dc5d6fb0033fbbc887b0270
This commit is contained in:
Santos Cordon
2021-02-17 13:24:17 +00:00
parent 53863bbcbf
commit a60654e05c

View File

@@ -718,7 +718,12 @@ final class LocalDisplayAdapter extends DisplayAdapter {
setDisplayState(Display.STATE_ON);
currentState = Display.STATE_ON;
} else {
return; // old state and new state is off
if (oldState == Display.STATE_UNKNOWN) {
// There's no guarantee about what the initial state is
// at startup, so we have to set it if previous was UNKNOWN.
setDisplayState(state);
}
return;
}
}