Switch config to string array
It seems that when we switched to a string array for provider config it was not applied everywhere. Test: ondevice Bug: 276778208 Change-Id: I9f244e40701d992d12bbac432ca6a0cb47e21ff2
This commit is contained in:
@@ -4447,7 +4447,8 @@
|
||||
|
||||
See android.credentials.CredentialManager
|
||||
-->
|
||||
<string name="config_defaultCredentialProviderService" translatable="false"></string>
|
||||
<string-array name="config_defaultCredentialProviderService" translatable="false">
|
||||
</string-array>
|
||||
|
||||
<!-- The package name for the system's smartspace service.
|
||||
This service returns smartspace results.
|
||||
|
||||
@@ -3754,7 +3754,7 @@
|
||||
<java-symbol type="string" name="config_defaultAppPredictionService" />
|
||||
<java-symbol type="string" name="config_defaultContentSuggestionsService" />
|
||||
<java-symbol type="string" name="config_defaultCredentialManagerHybridService" />
|
||||
<java-symbol type="string" name="config_defaultCredentialProviderService" />
|
||||
<java-symbol type="array" name="config_defaultCredentialProviderService" />
|
||||
<java-symbol type="string" name="config_defaultSearchUiService" />
|
||||
<java-symbol type="string" name="config_defaultSmartspaceService" />
|
||||
<java-symbol type="string" name="config_defaultWallpaperEffectsGenerationService" />
|
||||
|
||||
@@ -3747,7 +3747,7 @@ public class SettingsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
private final class UpgradeController {
|
||||
private static final int SETTINGS_VERSION = 216;
|
||||
private static final int SETTINGS_VERSION = 217;
|
||||
|
||||
private final int mUserId;
|
||||
|
||||
@@ -5710,7 +5710,7 @@ public class SettingsProvider extends ContentProvider {
|
||||
.getSettingLocked(Settings.Secure.CREDENTIAL_SERVICE);
|
||||
if (currentSetting.isNull()) {
|
||||
final int resourceId =
|
||||
com.android.internal.R.string.config_defaultCredentialProviderService;
|
||||
com.android.internal.R.array.config_defaultCredentialProviderService;
|
||||
final Resources resources = getContext().getResources();
|
||||
// If the config has not be defined we might get an exception. We also get
|
||||
// values from both the string array type and the single string in case the
|
||||
@@ -5770,6 +5770,39 @@ public class SettingsProvider extends ContentProvider {
|
||||
currentVersion = 216;
|
||||
}
|
||||
|
||||
if (currentVersion == 216) {
|
||||
// Version 216: Set a default value for Credential Manager service.
|
||||
// We are doing this migration again because of an incorrect setting.
|
||||
|
||||
final SettingsState secureSettings = getSecureSettingsLocked(userId);
|
||||
final Setting currentSetting = secureSettings
|
||||
.getSettingLocked(Settings.Secure.CREDENTIAL_SERVICE);
|
||||
if (currentSetting.isNull()) {
|
||||
final int resourceId =
|
||||
com.android.internal.R.array.config_defaultCredentialProviderService;
|
||||
final Resources resources = getContext().getResources();
|
||||
// If the config has not be defined we might get an exception.
|
||||
final List<String> providers = new ArrayList<>();
|
||||
try {
|
||||
providers.addAll(Arrays.asList(resources.getStringArray(resourceId)));
|
||||
} catch (Resources.NotFoundException e) {
|
||||
Slog.w(LOG_TAG,
|
||||
"Get default array Cred Provider not found: " + e.toString());
|
||||
}
|
||||
|
||||
if (!providers.isEmpty()) {
|
||||
final String defaultValue = String.join(":", providers);
|
||||
Slog.d(LOG_TAG, "Setting [" + defaultValue + "] as CredMan Service "
|
||||
+ "for user " + userId);
|
||||
secureSettings.insertSettingOverrideableByRestoreLocked(
|
||||
Settings.Secure.CREDENTIAL_SERVICE, defaultValue, null, true,
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
currentVersion = 217;
|
||||
}
|
||||
|
||||
// vXXX: Add new settings above this point.
|
||||
|
||||
if (currentVersion != newVersion) {
|
||||
|
||||
Reference in New Issue
Block a user