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:
@@ -33,6 +33,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsActivity;
|
import com.android.settings.SettingsActivity;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
import com.android.settings.Utils;
|
||||||
import com.android.settings.widget.SwitchBar;
|
import com.android.settings.widget.SwitchBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,9 +75,11 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
|||||||
mDaysToRetain.setOnPreferenceChangeListener(this);
|
mDaysToRetain.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
ContentResolver cr = getContentResolver();
|
ContentResolver cr = getContentResolver();
|
||||||
int photosDaysToRetain = Settings.Secure.getInt(cr,
|
int photosDaysToRetain =
|
||||||
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
|
Settings.Secure.getInt(
|
||||||
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN_DEFAULT);
|
cr,
|
||||||
|
Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN,
|
||||||
|
Utils.getDefaultStorageManagerDaysToRetain(getResources()));
|
||||||
String[] stringValues =
|
String[] stringValues =
|
||||||
getResources().getStringArray(R.array.automatic_storage_management_days_values);
|
getResources().getStringArray(R.array.automatic_storage_management_days_values);
|
||||||
mDaysToRetain.setValue(stringValues[daysValueToIndex(photosDaysToRetain, stringValues)]);
|
mDaysToRetain.setValue(stringValues[daysValueToIndex(photosDaysToRetain, stringValues)]);
|
||||||
@@ -164,4 +167,5 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
return indices.length - 1;
|
return indices.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user