Refine and migrate the functions that related to update preference into the specific lifecycle.

Goal:
Avoid the screen to be scrolled or moved by itself after changing theme.

Bug: 148785841
Test: make RunSettingsRoboTests ROBOTEST_FILTER=ToggleFeaturePreferenceFragment
&& make RunSettingsRoboTests ROBOTEST_FILTER=ToggleScreenMagnificationPreferenceFragmentTest

Change-Id: I35a41a920194d6de01b635ce4c8461df2635ce1a
2 files changed