am f342e5e0: am ca0391eb: am c8f952ce: Write correct checksum when formatting partition

* commit 'f342e5e0ae85fa7929e9b2eb4213bbc85dbcf61c':
  Write correct checksum when formatting partition
This commit is contained in:
Andres Morales
2015-03-19 18:41:31 +00:00
committed by Android Git Automerger

View File

@@ -110,8 +110,7 @@ public class PersistentDataBlockService extends SystemService {
private void formatIfOemUnlockEnabled() {
if (doGetOemUnlockEnabled()) {
synchronized (mLock) {
formatPartitionLocked();
doSetOemUnlockEnabledLocked(true);
formatPartitionLocked(true);
}
}
}
@@ -165,7 +164,7 @@ public class PersistentDataBlockService extends SystemService {
byte[] digest = computeDigestLocked(storedDigest);
if (digest == null || !Arrays.equals(storedDigest, digest)) {
Slog.i(TAG, "Formatting FRP partition...");
formatPartitionLocked();
formatPartitionLocked(false);
return false;
}
}
@@ -242,7 +241,7 @@ public class PersistentDataBlockService extends SystemService {
return md.digest();
}
private void formatPartitionLocked() {
private void formatPartitionLocked(boolean setOemUnlockEnabled) {
DataOutputStream outputStream;
try {
outputStream = new DataOutputStream(new FileOutputStream(new File(mDataBlockFile)));
@@ -264,7 +263,7 @@ public class PersistentDataBlockService extends SystemService {
IoUtils.closeQuietly(outputStream);
}
doSetOemUnlockEnabledLocked(false);
doSetOemUnlockEnabledLocked(setOemUnlockEnabled);
computeAndWriteDigestLocked();
}