summaryrefslogtreecommitdiffstats
path: root/packages/BackupRestoreConfirmation/src/com/android/backupconfirm
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2011-07-28 18:03:03 -0700
committerChristopher Tate <ctate@google.com>2011-07-28 18:04:07 -0700
commit728a1c4d5ed3b808172013a7f5bb5065d1e964f6 (patch)
treeeb16210cfa98555355889022de17568effac8c2f /packages/BackupRestoreConfirmation/src/com/android/backupconfirm
parent80df829e35d0a97f92e599d36b0b16dcc956130b (diff)
downloadframeworks_base-728a1c4d5ed3b808172013a7f5bb5065d1e964f6.zip
frameworks_base-728a1c4d5ed3b808172013a7f5bb5065d1e964f6.tar.gz
frameworks_base-728a1c4d5ed3b808172013a7f5bb5065d1e964f6.tar.bz2
Require the current backup pw in all backup/restore operations
Specifically, we now also require the current password to confirm any restore operation. Bug 4901637 Change-Id: I39ecce7837f70cd05778cb7e0e6390ad8f6fe3f3
Diffstat (limited to 'packages/BackupRestoreConfirmation/src/com/android/backupconfirm')
-rw-r--r--packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java40
1 files changed, 26 insertions, 14 deletions
diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
index fad58b9..f65a62f 100644
--- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
+++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
@@ -63,6 +63,8 @@ public class BackupRestoreConfirmation extends Activity {
boolean mDidAcknowledge;
TextView mStatusView;
+ TextView mCurPassword;
+ TextView mEncPassword;
Button mAllowButton;
Button mDenyButton;
@@ -156,17 +158,17 @@ public class BackupRestoreConfirmation extends Activity {
mAllowButton = (Button) findViewById(R.id.button_allow);
mDenyButton = (Button) findViewById(R.id.button_deny);
- // For full backup, we vary the password prompt text depending on whether one is predefined
- if (layoutId == R.layout.confirm_backup) {
- TextView pwDesc = (TextView) findViewById(R.id.password_desc);
- try {
- if (mBackupManager.hasBackupPassword()) {
- pwDesc.setText(R.string.backup_password_text);
- } else {
- pwDesc.setText(R.string.backup_password_optional);
- }
- } catch (RemoteException e) {
- // TODO: bail gracefully
+ mCurPassword = (TextView) findViewById(R.id.password);
+ mEncPassword = (TextView) findViewById(R.id.enc_password);
+ TextView curPwDesc = (TextView) findViewById(R.id.password_desc);
+
+ // We vary the password prompt depending on whether one is predefined
+ if (!haveBackupPassword()) {
+ curPwDesc.setVisibility(View.GONE);
+ mCurPassword.setVisibility(View.GONE);
+ if (layoutId == R.layout.confirm_backup) {
+ TextView encPwDesc = (TextView) findViewById(R.id.enc_password_desc);
+ encPwDesc.setText(R.string.backup_enc_password_optional);
}
}
@@ -204,15 +206,25 @@ public class BackupRestoreConfirmation extends Activity {
mDidAcknowledge = true;
try {
- TextView pwView = (TextView) findViewById(R.id.password);
- mBackupManager.acknowledgeFullBackupOrRestore(mToken, allow,
- String.valueOf(pwView.getText()), mObserver);
+ mBackupManager.acknowledgeFullBackupOrRestore(mToken,
+ allow,
+ String.valueOf(mCurPassword.getText()),
+ String.valueOf(mEncPassword.getText()),
+ mObserver);
} catch (RemoteException e) {
// TODO: bail gracefully if we can't contact the backup manager
}
}
}
+ boolean haveBackupPassword() {
+ try {
+ return mBackupManager.hasBackupPassword();
+ } catch (RemoteException e) {
+ return true; // in the failure case, assume we need one
+ }
+ }
+
/**
* The observer binder for showing backup/restore progress. This binder just bounces
* the notifications onto the main thread.