Fix the toggle button flicker problem when display

- Root cause: the side effect of the parallel controller loading.
- Solution: disable the parallel approach and remove the entry point
  of parallel approach in DashboardFragment.

Fixes: 187838753
Test: Robo test for AppInfoDashboardFragment, ConfigureNotificationSettings,
      ConnectedDeviceDashboardFragment, DevelopmentSettingsDashboardFragment,
      NetworkDashboardFragment, DashboardFragment
Change-Id: If3b09c4fd6f33042e0ed38704f08e855ab8f5377
This commit is contained in:
Sunny Shao
2021-05-24 15:59:01 +08:00
parent 19baf0df84
commit 9fa4bb8ffa
7 changed files with 2 additions and 65 deletions

View File

@@ -22,7 +22,6 @@ import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.FeatureFlagUtils;
import android.util.Log;
import androidx.annotation.CallSuper;
@@ -36,7 +35,6 @@ import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.FeatureFlags;
import com.android.settings.core.PreferenceControllerListHelper;
import com.android.settings.core.SettingsBaseActivity;
import com.android.settings.overlay.FeatureFactory;
@@ -360,11 +358,6 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
* Update state of each preference managed by PreferenceController.
*/
protected void updatePreferenceStates() {
if (isParalleledControllers() && FeatureFlagUtils.isEnabled(getContext(),
FeatureFlags.CONTROLLER_ENHANCEMENT)) {
updatePreferenceStatesInParallel();
return;
}
final PreferenceScreen screen = getPreferenceScreen();
Collection<List<AbstractPreferenceController>> controllerLists =
mPreferenceControllers.values();
@@ -396,6 +389,8 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
* Use parallel method to update state of each preference managed by PreferenceController.
*/
@VisibleForTesting
// To use this parallel approach will cause the side effect of the UI flicker. Such as
// the thumb sliding of the toggle button.
void updatePreferenceStatesInParallel() {
final PreferenceScreen screen = getPreferenceScreen();
final Collection<List<AbstractPreferenceController>> controllerLists =