When activity is recreated (due to configuration is changed),
preference screen is created before SettingsActivity sets view layout
and results in NPE. As a workaround, save the states inside
MainSwitchBarPreference to fix the problem.
Bug: 332201912
Flag: EXEMPT library
Test: manual
Change-Id: I052cd0a521dac203a5f58963c550911e7a741e6f
MainSwitchBar is a view widget in activity layout stick to the top of
screen UI. There is no corresponding Preference in the preference
screen. For Catalyst support, introduce an invisible Preference object
to manipulate with MainSwitchBar, so that the binding mechanism is
still working on top of this abstraction.
Bug: 332201912
Flag: EXEMPT new class
Test: manual
Change-Id: If50932a443c1ed3ac04d3ea2e3273724d750297d