diff options
author | Paul Lawrence <paullawrence@google.com> | 2014-08-25 08:24:27 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-08-25 08:24:27 +0000 |
commit | 5432052f6830dec55f066b0b1d5b69d6a4c12e55 (patch) | |
tree | 147148cca7cda09b766ba28be1117fce860a839b /packages/BackupRestoreConfirmation | |
parent | d308790da6fbb02ea5149bafd42460df94831d91 (diff) | |
parent | d70c21d61666b3d8235bceb9ca6db21806022b71 (diff) | |
download | frameworks_base-5432052f6830dec55f066b0b1d5b69d6a4c12e55.zip frameworks_base-5432052f6830dec55f066b0b1d5b69d6a4c12e55.tar.gz frameworks_base-5432052f6830dec55f066b0b1d5b69d6a4c12e55.tar.bz2 |
am bee67db7: am f1b2348d: am b34de6be: Merge "Fix adb backup for encrypted case" into lmp-dev
* commit 'bee67db720e33f830714f4bada6f712a25dd7fad':
Fix adb backup for encrypted case
Diffstat (limited to 'packages/BackupRestoreConfirmation')
-rw-r--r-- | packages/BackupRestoreConfirmation/res/values/strings.xml | 2 | ||||
-rw-r--r-- | packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java | 28 |
2 files changed, 12 insertions, 18 deletions
diff --git a/packages/BackupRestoreConfirmation/res/values/strings.xml b/packages/BackupRestoreConfirmation/res/values/strings.xml index 5c90fd0..3fb3fd4 100644 --- a/packages/BackupRestoreConfirmation/res/values/strings.xml +++ b/packages/BackupRestoreConfirmation/res/values/strings.xml @@ -44,6 +44,8 @@ <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_enc_password_optional">If you wish to encrypt the full backup data, enter a password below:</string> + <!-- Text for message to user that they must supply an encryption password to use for a full backup operation because their phone is locked. --> + <string name="backup_enc_password_required">Since your device is encrypted, you are required to encrypt your backup. Please 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_enc_password_text">If the restore data is encrypted, please enter the password below:</string> diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java index 82ac8cb..c2bb90c 100644 --- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java +++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java @@ -28,6 +28,7 @@ import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; import android.os.storage.IMountService; +import android.os.storage.StorageManager; import android.util.Log; import android.util.Slog; import android.view.View; @@ -182,25 +183,14 @@ public class BackupRestoreConfirmation extends Activity { // We vary the password prompt depending on whether one is predefined, and whether // the device is encrypted. mIsEncrypted = deviceIsEncrypted(); - if (mIsEncrypted) { - Log.d(TAG, "Device is encrypted: requiring encryption pw"); - TextView pwPrompt = (TextView) findViewById(R.id.password_desc); - // this password is mandatory; we hide the other options during backup - if (layoutId == R.layout.confirm_backup) { - pwPrompt.setText(R.string.device_encryption_backup_text); - TextView tv = (TextView) findViewById(R.id.enc_password); - tv.setVisibility(View.GONE); - tv = (TextView) findViewById(R.id.enc_password_desc); - tv.setVisibility(View.GONE); - } else { - pwPrompt.setText(R.string.device_encryption_restore_text); - } - } else if (!haveBackupPassword()) { + 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); + encPwDesc.setText(mIsEncrypted + ? R.string.backup_enc_password_required + : R.string.backup_enc_password_optional); } } @@ -246,8 +236,7 @@ public class BackupRestoreConfirmation extends Activity { mDidAcknowledge = true; try { - CharSequence encPassword = (mIsEncrypted) - ? mCurPassword.getText() : mEncPassword.getText(); + CharSequence encPassword = mEncPassword.getText(); mBackupManager.acknowledgeFullBackupOrRestore(mToken, allow, String.valueOf(mCurPassword.getText()), @@ -261,7 +250,10 @@ public class BackupRestoreConfirmation extends Activity { boolean deviceIsEncrypted() { try { - return (mMountService.getEncryptionState() != IMountService.ENCRYPTION_STATE_NONE); + return mMountService.getEncryptionState() + != IMountService.ENCRYPTION_STATE_NONE + && mMountService.getPasswordType() + != StorageManager.CRYPT_TYPE_DEFAULT; } catch (Exception e) { // If we can't talk to the mount service we have a serious problem; fail // "secure" i.e. assuming that the device is encrypted. |