Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01c41ed8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Migrate the NETWORK_SCORER_APP to NETWORK_RECOMMENDATIONS_ENABLED."

parents 1e87ae5c 8bdad345
Loading
Loading
Loading
Loading
+26 −1
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.os.UserManagerInternal;
import android.os.UserManagerInternal;
import android.provider.Settings;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.util.ArraySet;
import android.util.ArraySet;
@@ -2175,7 +2176,7 @@ public class SettingsProvider extends ContentProvider {
        }
        }


        private final class UpgradeController {
        private final class UpgradeController {
            private static final int SETTINGS_VERSION = 135;
            private static final int SETTINGS_VERSION = 136;


            private final int mUserId;
            private final int mUserId;


@@ -2553,6 +2554,30 @@ public class SettingsProvider extends ContentProvider {
                    currentVersion = 135;
                    currentVersion = 135;
                }
                }


                if (currentVersion == 135) {
                    // Version 135: Migrating the NETWORK_SCORER_APP setting to the
                    // NETWORK_RECOMMENDATIONS_ENABLED setting.
                    if (userId == UserHandle.USER_SYSTEM) {
                        final SettingsState globalSettings = getGlobalSettingsLocked();
                        Setting currentSetting = globalSettings.getSettingLocked(
                            Global.NETWORK_SCORER_APP);
                        if (!currentSetting.isNull()) {
                            // A scorer was set so enable recommendations.
                            globalSettings.insertSettingLocked(
                                Global.NETWORK_RECOMMENDATIONS_ENABLED,
                                "1",
                                SettingsState.SYSTEM_PACKAGE_NAME);

                            // and clear the scorer setting since it's no longer needed.
                            globalSettings.insertSettingLocked(
                                Global.NETWORK_SCORER_APP,
                                null,
                                SettingsState.SYSTEM_PACKAGE_NAME);
                        }
                    }
                    currentVersion = 136;
                }

                if (currentVersion != newVersion) {
                if (currentVersion != newVersion) {
                    Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
                    Slog.wtf("SettingsProvider", "warning: upgrading settings database to version "
                            + newVersion + " left it at "
                            + newVersion + " left it at "