DO NOT MERGE Refactor passwords/pins/patterns to byte[]

Relating to packages/apps/Settings

Bug: 120484642
Test: manual - test setting and unlocking passwords/pins/patterns.
      automated - atest packages/apps/Settings/tests/robotests/src/com/android/settings/password/

Change-Id: Idec8338d141c185bef67ade12035fdb2fa9d17ea
(cherry picked from commit b27c4308a2)
This commit is contained in:
Rich Cannings
2019-02-19 13:15:30 -08:00
parent 1b29c28aef
commit 34042bbf1d
11 changed files with 113 additions and 78 deletions

View File

@@ -38,6 +38,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.core.InstrumentedFragment;
import java.util.Arrays;
import java.util.Locale;
public class CryptKeeperConfirm extends InstrumentedFragment {
@@ -87,7 +88,12 @@ public class CryptKeeperConfirm extends InstrumentedFragment {
IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
try {
Bundle args = getIntent().getExtras();
storageManager.encryptStorage(args.getInt("type", -1), args.getString("password"));
// TODO(b/120484642): Update vold to accept a password as a byte array
byte[] passwordBytes = args.getByteArray("password");
String password = passwordBytes != null ? new String(passwordBytes) : null;
Arrays.fill(passwordBytes, (byte) 0);
storageManager.encryptStorage(args.getInt("type", -1),
password);
} catch (Exception e) {
Log.e("CryptKeeper", "Error while encrypting...", e);
}