Loading res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -7766,4 +7766,10 @@ <!-- Dropdown preference title for dropdown describing how many days of downloads to retain.--> <string name="automatic_storage_manager_downloads_days_title">Remove downloads</string> <!-- Preference title for downloads backup toggle. [CHAR LIMIT=60]--> <string name="downloads_backup_preference_title">Downloads backup</string> <!-- Used as wall of text to describe the feature. [CHAR LIMIT=NONE] --> <string name="downloads_backup_text"></string> </resources> res/xml/automatic_storage_management_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,10 @@ android:title="@string/automatic_storage_manager_preference_title" android:summary="@string/automatic_storage_manager_text"/> <SwitchPreference android:key="downloads_backup_active" android:title="@string/downloads_backup_preference_title" android:summary="@string/downloads_backup_text"/> <com.android.settings.fuelgauge.WallOfTextPreference android:key="freed_bytes" Loading src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java +23 −7 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment private static final String KEY_DELETION_HELPER = "deletion_helper"; private static final String KEY_FREED = "freed_bytes"; private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active"; private static final String KEY_DOWNLOADS_BACKUP_SWITCH = "downloads_backup_active"; private static final String KEY_DOWNLOADS_DAYS = "downloads_days"; private DropDownPreference mDaysToRetain; Loading @@ -62,6 +63,7 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment private Preference mFreedBytes; private Preference mDeletionHelper; private SwitchPreference mStorageManagerSwitch; private SwitchPreference mDownloadsBackupSwitch; @Override public void onCreate(Bundle savedInstanceState) { Loading @@ -86,6 +88,9 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH); mStorageManagerSwitch.setOnPreferenceChangeListener(this); mDownloadsBackupSwitch = (SwitchPreference) findPreference(KEY_DOWNLOADS_BACKUP_SWITCH); mDownloadsBackupSwitch.setOnPreferenceChangeListener(this); ContentResolver cr = getContentResolver(); int photosDaysToRetain = Settings.Secure.getInt(cr, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, Loading Loading @@ -120,23 +125,34 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment @Override public void onResume() { super.onResume(); boolean isChecked = boolean isStorageManagerChecked = Settings.Secure.getInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0) != 0; mStorageManagerSwitch.setChecked(isChecked); mDaysToRetain.setEnabled(isChecked); mStorageManagerSwitch.setChecked(isStorageManagerChecked); mDaysToRetain.setEnabled(isStorageManagerChecked); boolean isDownloadsBackupChecked = Settings.Secure.getInt(getContentResolver(), Settings.Secure.DOWNLOADS_BACKUP_ENABLED, 0) != 0; mDownloadsBackupSwitch.setChecked(isDownloadsBackupChecked); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { switch (preference.getKey()) { case KEY_STORAGE_MANAGER_SWITCH: boolean checked = (boolean) newValue; boolean storageManagerChecked = (boolean) newValue; MetricsLogger.action(getContext(), MetricsEvent.ACTION_TOGGLE_STORAGE_MANAGER, checked); mDaysToRetain.setEnabled(checked); storageManagerChecked); mDaysToRetain.setEnabled(storageManagerChecked); Settings.Secure.putInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, storageManagerChecked ? 1 : 0); break; case KEY_DOWNLOADS_BACKUP_SWITCH: boolean downloadsBackupChecked = (boolean) newValue; Settings.Secure.putInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, checked ? 1 : 0); Settings.Secure.DOWNLOADS_BACKUP_ENABLED, downloadsBackupChecked ? 1 : 0); break; case KEY_DAYS: Settings.Secure.putInt(getContentResolver(), Loading Loading
res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -7766,4 +7766,10 @@ <!-- Dropdown preference title for dropdown describing how many days of downloads to retain.--> <string name="automatic_storage_manager_downloads_days_title">Remove downloads</string> <!-- Preference title for downloads backup toggle. [CHAR LIMIT=60]--> <string name="downloads_backup_preference_title">Downloads backup</string> <!-- Used as wall of text to describe the feature. [CHAR LIMIT=NONE] --> <string name="downloads_backup_text"></string> </resources>
res/xml/automatic_storage_management_settings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,10 @@ android:title="@string/automatic_storage_manager_preference_title" android:summary="@string/automatic_storage_manager_text"/> <SwitchPreference android:key="downloads_backup_active" android:title="@string/downloads_backup_preference_title" android:summary="@string/downloads_backup_text"/> <com.android.settings.fuelgauge.WallOfTextPreference android:key="freed_bytes" Loading
src/com/android/settings/deletionhelper/AutomaticStorageManagerSettings.java +23 −7 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment private static final String KEY_DELETION_HELPER = "deletion_helper"; private static final String KEY_FREED = "freed_bytes"; private static final String KEY_STORAGE_MANAGER_SWITCH = "storage_manager_active"; private static final String KEY_DOWNLOADS_BACKUP_SWITCH = "downloads_backup_active"; private static final String KEY_DOWNLOADS_DAYS = "downloads_days"; private DropDownPreference mDaysToRetain; Loading @@ -62,6 +63,7 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment private Preference mFreedBytes; private Preference mDeletionHelper; private SwitchPreference mStorageManagerSwitch; private SwitchPreference mDownloadsBackupSwitch; @Override public void onCreate(Bundle savedInstanceState) { Loading @@ -86,6 +88,9 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment mStorageManagerSwitch = (SwitchPreference) findPreference(KEY_STORAGE_MANAGER_SWITCH); mStorageManagerSwitch.setOnPreferenceChangeListener(this); mDownloadsBackupSwitch = (SwitchPreference) findPreference(KEY_DOWNLOADS_BACKUP_SWITCH); mDownloadsBackupSwitch.setOnPreferenceChangeListener(this); ContentResolver cr = getContentResolver(); int photosDaysToRetain = Settings.Secure.getInt(cr, Settings.Secure.AUTOMATIC_STORAGE_MANAGER_DAYS_TO_RETAIN, Loading Loading @@ -120,23 +125,34 @@ public class AutomaticStorageManagerSettings extends SettingsPreferenceFragment @Override public void onResume() { super.onResume(); boolean isChecked = boolean isStorageManagerChecked = Settings.Secure.getInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, 0) != 0; mStorageManagerSwitch.setChecked(isChecked); mDaysToRetain.setEnabled(isChecked); mStorageManagerSwitch.setChecked(isStorageManagerChecked); mDaysToRetain.setEnabled(isStorageManagerChecked); boolean isDownloadsBackupChecked = Settings.Secure.getInt(getContentResolver(), Settings.Secure.DOWNLOADS_BACKUP_ENABLED, 0) != 0; mDownloadsBackupSwitch.setChecked(isDownloadsBackupChecked); } @Override public boolean onPreferenceChange(Preference preference, Object newValue) { switch (preference.getKey()) { case KEY_STORAGE_MANAGER_SWITCH: boolean checked = (boolean) newValue; boolean storageManagerChecked = (boolean) newValue; MetricsLogger.action(getContext(), MetricsEvent.ACTION_TOGGLE_STORAGE_MANAGER, checked); mDaysToRetain.setEnabled(checked); storageManagerChecked); mDaysToRetain.setEnabled(storageManagerChecked); Settings.Secure.putInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, storageManagerChecked ? 1 : 0); break; case KEY_DOWNLOADS_BACKUP_SWITCH: boolean downloadsBackupChecked = (boolean) newValue; Settings.Secure.putInt(getContentResolver(), Settings.Secure.AUTOMATIC_STORAGE_MANAGER_ENABLED, checked ? 1 : 0); Settings.Secure.DOWNLOADS_BACKUP_ENABLED, downloadsBackupChecked ? 1 : 0); break; case KEY_DAYS: Settings.Secure.putInt(getContentResolver(), Loading