Move the validators out of the settings class

Currently the validators static initialiser gets triggered when the
relevant settings class is accessed. Moving them out to the
SettingsBackupAgent (which is the only place they're used) has two
main advantages;

1) All apps accessing the Settings classes no longer trigger the
static initialisers and so are faster.

2) Putting them in SettingsBackupAgent gets them off the
bootclasspath of all apps and makes the framework jars smaller.

Bug: 139449903
Test: atest SettingsProviderTest RunBackupFrameworksServicesRoboTests CtsBackupTestCases CtsBackupHostTestCases GtsBackupTestCases GtsBackupHostTestCases
Change-Id: Ie740c1ea25a01c715964175094677af2e3328732
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
index e492e28..4d71e72b5 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java
@@ -70,6 +70,7 @@
 import android.provider.Settings;
 import android.provider.Settings.Global;
 import android.provider.Settings.Secure;
+import android.provider.settings.validators.SystemSettingsValidators;
 import android.provider.settings.validators.Validator;
 import android.text.TextUtils;
 import android.util.ArrayMap;
@@ -1717,7 +1718,7 @@
     }
 
     private void validateSystemSettingValue(String name, String value) {
-        Validator validator = Settings.System.VALIDATORS.get(name);
+        Validator validator = SystemSettingsValidators.VALIDATORS.get(name);
         if (validator != null && !validator.validate(value)) {
             throw new IllegalArgumentException("Invalid value: " + value
                     + " for setting: " + name);