Remove the light flag if the bar isn't specified light in theme

Previously, PhoneWindow will add the light flag for the bar if it is
specified light in theme. It won't remove the light flag if the theme is
not light. The previous logic in PhoneWindow#generateLayout assumes the
decor view was newly created.

However, the decor view can be reused from the preserved window. This
happens if the activity is recreated. So if the previous activity was in
a light theme and the newly created activity is in a dark theme, we
should clear the light bar flags added in the previous activity.

Fix: 174502412
Test: 1. Set Dialer (Phone) to dark theme from Dialer's display options.
      2. Clear app data from Dialer's app info.
      3. Open Dialer again and see if the color of system bars are
         normal.
Change-Id: I3ea61322e4c3cfe26981e23792f42ab0b9a1e217
1 file changed