From 9b868d95ead7ccec7ab2febcc95554139fa6ce8a Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Tue, 23 May 2017 15:59:32 -0700 Subject: [PATCH] Use the config default days to retain. This avoids using the static value to determine the default number of days to retain. Bug: 38499322 Test: SettingsLib robotests Change-Id: Ia0f569407a5a2a85a173e90c22f6b413776564db --- .../AutomaticStorageManagerSettings.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java index a2fe07d4e68..f7b62b1666f 100644 --- a/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java +++ b/src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java @@ -33,6 +33,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.settings.R; import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.Utils; import com.android.settings.widget.SwitchBar; /** @@ -74,9 +75,11 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment mDaysToRetain.setOnPreferenceChangeListener(this); ContentResolver cr = getContentResolver(); - int photosDaysToRetain = Settings.Secure.getInt(cr, - Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, - Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT); + int photosDaysToRetain = + Settings.Secure.getInt( + cr, + Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, + Utils.getDefaultStorageManagerDaysToRetain(getResources())); String[] stringValues = getResources().getStringArray(R.array.automatic_storage_management_days_values); mDaysToRetain.setValue(stringValues[daysValueToIndex(photosDaysToRetain, stringValues)]); @@ -164,4 +167,5 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment } return indices.length - 1; } + }