Merge "Switch config to string array" into udc-dev
This commit is contained in:
@@ -4461,7 +4461,8 @@
|
|||||||
|
|
||||||
See android.credentials.CredentialManager
|
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.
|
<!-- The package name for the system's smartspace service.
|
||||||
This service returns smartspace results.
|
This service returns smartspace results.
|
||||||
|
|||||||
@@ -3754,7 +3754,7 @@
|
|||||||
<java-symbol type="string" name="config_defaultAppPredictionService" />
|
<java-symbol type="string" name="config_defaultAppPredictionService" />
|
||||||
<java-symbol type="string" name="config_defaultContentSuggestionsService" />
|
<java-symbol type="string" name="config_defaultContentSuggestionsService" />
|
||||||
<java-symbol type="string" name="config_defaultCredentialManagerHybridService" />
|
<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_defaultSearchUiService" />
|
||||||
<java-symbol type="string" name="config_defaultSmartspaceService" />
|
<java-symbol type="string" name="config_defaultSmartspaceService" />
|
||||||
<java-symbol type="string" name="config_defaultWallpaperEffectsGenerationService" />
|
<java-symbol type="string" name="config_defaultWallpaperEffectsGenerationService" />
|
||||||
|
|||||||
@@ -3748,7 +3748,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class UpgradeController {
|
private final class UpgradeController {
|
||||||
private static final int SETTINGS_VERSION = 216;
|
private static final int SETTINGS_VERSION = 217;
|
||||||
|
|
||||||
private final int mUserId;
|
private final int mUserId;
|
||||||
|
|
||||||
@@ -5711,7 +5711,7 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
.getSettingLocked(Settings.Secure.CREDENTIAL_SERVICE);
|
.getSettingLocked(Settings.Secure.CREDENTIAL_SERVICE);
|
||||||
if (currentSetting.isNull()) {
|
if (currentSetting.isNull()) {
|
||||||
final int resourceId =
|
final int resourceId =
|
||||||
com.android.internal.R.string.config_defaultCredentialProviderService;
|
com.android.internal.R.array.config_defaultCredentialProviderService;
|
||||||
final Resources resources = getContext().getResources();
|
final Resources resources = getContext().getResources();
|
||||||
// If the config has not be defined we might get an exception. We also get
|
// 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
|
// values from both the string array type and the single string in case the
|
||||||
@@ -5771,6 +5771,39 @@ public class SettingsProvider extends ContentProvider {
|
|||||||
currentVersion = 216;
|
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.
|
// vXXX: Add new settings above this point.
|
||||||
|
|
||||||
if (currentVersion != newVersion) {
|
if (currentVersion != newVersion) {
|
||||||
|
|||||||
Reference in New Issue
Block a user