am c44d0ef1: show old legal text in backup settings if full data backup is disabled

* commit 'c44d0ef1dc67466fe59c1a26a657c2f9043c948b':
  show old legal text in backup settings if full data backup is disabled
This commit is contained in:
Sean Francis-Lyon
2015-06-16 01:32:02 +00:00
committed by Android Git Automerger

View File

@@ -10,6 +10,7 @@ import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
import android.provider.Settings;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
@@ -31,6 +32,11 @@ public class ToggleBackupSettingFragment extends SettingsPreferenceFragment
private static final String BACKUP_TOGGLE = "toggle_backup"; private static final String BACKUP_TOGGLE = "toggle_backup";
// System setting that governs whether the user is eligible for full app-data backup,
// based on whether they have been presented with the details of what that backup entails
// (usually surfaced somewhere like device setup)
private static final String USER_FULL_DATA_BACKUP_AWARE = "user_full_data_backup_aware";
private IBackupManager mBackupManager; private IBackupManager mBackupManager;
protected SwitchBar mSwitchBar; protected SwitchBar mSwitchBar;
@@ -74,7 +80,14 @@ public class ToggleBackupSettingFragment extends SettingsPreferenceFragment
mToggleSwitch = mSwitchBar.getSwitch(); mToggleSwitch = mSwitchBar.getSwitch();
// Set up UI. // Set up UI.
mSummaryPreference.setSummary(R.string.fullbackup_data_summary); // If the user has not seen legal text for full data backup (if they OTA from L to M) then
// full data backup will be off and here we want to show the old summary here that does
// not mention full data backup
if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
} else {
mSummaryPreference.setSummary(R.string.backup_data_summary);
}
try { try {
boolean backupEnabled = mBackupManager == null ? boolean backupEnabled = mBackupManager == null ?
false : mBackupManager.isBackupEnabled(); false : mBackupManager.isBackupEnabled();
@@ -155,7 +168,16 @@ public class ToggleBackupSettingFragment extends SettingsPreferenceFragment
} }
private void showEraseBackupDialog() { private void showEraseBackupDialog() {
CharSequence msg = getResources().getText(R.string.fullbackup_erase_dialog_message); CharSequence msg;
// If the user has not seen legal text for full data backup (if they OTA from L to M) then
// full data backup will be off and here we want to show the old erase_dialog_message here
// that does not mention full data backup
if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
msg = getResources().getText(R.string.fullbackup_erase_dialog_message);
} else {
msg = getResources().getText(R.string.backup_erase_dialog_message);
}
mWaitingForConfirmationDialog = true; mWaitingForConfirmationDialog = true;