diff options
author | Christopher Tate <ctate@google.com> | 2011-07-28 18:03:03 -0700 |
---|---|---|
committer | Christopher Tate <ctate@google.com> | 2011-07-28 18:04:07 -0700 |
commit | 728a1c4d5ed3b808172013a7f5bb5065d1e964f6 (patch) | |
tree | eb16210cfa98555355889022de17568effac8c2f /packages | |
parent | 80df829e35d0a97f92e599d36b0b16dcc956130b (diff) | |
download | frameworks_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')
4 files changed, 66 insertions, 23 deletions
diff --git a/packages/BackupRestoreConfirmation/res/layout/confirm_backup.xml b/packages/BackupRestoreConfirmation/res/layout/confirm_backup.xml index 08dcfae..3668b8c 100644 --- a/packages/BackupRestoreConfirmation/res/layout/confirm_backup.xml +++ b/packages/BackupRestoreConfirmation/res/layout/confirm_backup.xml @@ -21,7 +21,7 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:padding="10dp" > + android:padding="16dp" > <TextView android:id="@+id/confirm_text" android:layout_width="match_parent" @@ -34,12 +34,26 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" - android:text="@string/backup_password_text" /> + android:text="@string/current_password_text" /> <EditText android:id="@+id/password" android:layout_below="@id/password_desc" android:layout_width="match_parent" android:layout_height="wrap_content" + android:layout_marginBottom="10dp" + android:password="true" /> + + <TextView android:id="@+id/enc_password_desc" + android:layout_below="@id/password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="10dp" + android:text="@string/backup_enc_password_text" /> + + <EditText android:id="@+id/enc_password" + android:layout_below="@id/enc_password_desc" + android:layout_width="match_parent" + android:layout_height="wrap_content" android:layout_marginBottom="30dp" android:password="true" /> @@ -47,7 +61,7 @@ android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginLeft="30dp" - android:layout_below="@id/password" + android:layout_below="@id/enc_password" android:layout_marginBottom="30dp" /> <Button android:id="@+id/button_allow" diff --git a/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml b/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml index 8b12ed4..38fcc49 100644 --- a/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml +++ b/packages/BackupRestoreConfirmation/res/layout/confirm_restore.xml @@ -21,7 +21,7 @@ <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" - android:padding="10dp" > + android:padding="16dp" > <TextView android:id="@+id/confirm_text" android:layout_width="match_parent" @@ -34,7 +34,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" - android:text="@string/restore_password_text" /> + android:text="@string/current_password_text" /> <EditText android:id="@+id/password" android:layout_below="@id/password_desc" @@ -43,11 +43,25 @@ android:layout_marginBottom="30dp" android:password="true" /> + <TextView android:id="@+id/enc_password_desc" + android:layout_below="@id/password" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="10dp" + android:text="@string/restore_enc_password_text" /> + + <EditText android:id="@+id/enc_password" + android:layout_below="@id/enc_password_desc" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="30dp" + android:password="true" /> + <TextView android:id="@+id/package_name" android:layout_width="match_parent" android:layout_height="20dp" android:layout_marginLeft="30dp" - android:layout_below="@id/password" + android:layout_below="@id/enc_password" android:layout_marginBottom="30dp" /> <Button android:id="@+id/button_allow" diff --git a/packages/BackupRestoreConfirmation/res/values/strings.xml b/packages/BackupRestoreConfirmation/res/values/strings.xml index 48a8df6..f022e57 100644 --- a/packages/BackupRestoreConfirmation/res/values/strings.xml +++ b/packages/BackupRestoreConfirmation/res/values/strings.xml @@ -30,10 +30,13 @@ <string name="deny_restore_button_label">Do not restore</string> <!-- Text for message to user that they must enter their predefined backup password in order to perform this operation. --> - <string name="backup_password_text">Please enter your predefined backup password below. The full backup will also be encrypted using this password:</string> + <string name="current_password_text">Please enter your current backup password below:</string> + + <!-- Text for message to user that they can must enter an encryption password to use for the full backup operation. --> + <string name="backup_enc_password_text">Please enter a password to use for encrypting the full backup data. If this is left blank, your current backup password will be used:</string> <!-- Text for message to user that they may optionally supply an encryption password to use for a full backup operation. --> - <string name="backup_password_optional">If you wish to encrypt the full backup data, enter a password below:</string> + <string name="backup_enc_password_optional">If you wish to encrypt the full backup data, enter a password below:</string> <!-- Text for message to user when performing a full restore operation, explaining that they must enter the password originally used to encrypt the full backup data. --> - <string name="restore_password_text">If the backup data is encrypted, please enter the password below:</string> + <string name="restore_enc_password_text">If the restore data is encrypted, please enter the password below:</string> </resources> 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. |