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
This commit is contained in:
Daniel Nishi
2017-05-23 15:59:32 -07:00
parent b287dc93d5
commit 9b868d95ea

View File

@@ -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;
}
}