Fix Startup fails when click "Color correction" of the selection menu in "Color correction" page

Setting provider observar is register onResume() and release of onPause().
The selection menu is activity-base dialog to cause the app does not to monitor the value change.

Bug: 148832544
Test: Manual test
Change-Id: I01354d5096c00ba39336e27aa45169d8768f8594
This commit is contained in:
menghanli
2020-02-04 17:32:10 +08:00
parent f38bff9e0b
commit 1869e01f3e
3 changed files with 45 additions and 37 deletions

View File

@@ -89,10 +89,8 @@ public class ToggleAccessibilityServicePreferenceFragment extends
@Override
public void onResume() {
super.onResume();
mSettingsContentObserver.register(getContentResolver());
updateSwitchBarToggleSwitch();
mSettingsContentObserver.register(getContentResolver());
}
@Override
@@ -199,6 +197,9 @@ public class ToggleAccessibilityServicePreferenceFragment extends
private void updateSwitchBarToggleSwitch() {
final boolean checked = AccessibilityUtils.getEnabledServicesFromSettings(getPrefContext())
.contains(mComponentName);
if (mSwitchBar.isChecked() == checked) {
return;
}
mSwitchBar.setCheckedInternal(checked);
}