Merge "Log the error when committing the blob fails." into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
448b11bd60
@@ -219,7 +219,7 @@ public final class BlobHandle implements Parcelable {
|
||||
public void dump(IndentingPrintWriter fout, boolean dumpFull) {
|
||||
if (dumpFull) {
|
||||
fout.println("algo: " + algorithm);
|
||||
fout.println("digest: " + (dumpFull ? encodeDigest() : safeDigest()));
|
||||
fout.println("digest: " + (dumpFull ? encodeDigest(digest) : safeDigest(digest)));
|
||||
fout.println("label: " + label);
|
||||
fout.println("expiryMs: " + expiryTimeMillis);
|
||||
fout.println("tag: " + tag);
|
||||
@@ -243,19 +243,20 @@ public final class BlobHandle implements Parcelable {
|
||||
public String toString() {
|
||||
return "BlobHandle {"
|
||||
+ "algo:" + algorithm + ","
|
||||
+ "digest:" + safeDigest() + ","
|
||||
+ "digest:" + safeDigest(digest) + ","
|
||||
+ "label:" + label + ","
|
||||
+ "expiryMs:" + expiryTimeMillis + ","
|
||||
+ "tag:" + tag
|
||||
+ "}";
|
||||
}
|
||||
|
||||
private String safeDigest() {
|
||||
final String digestStr = encodeDigest();
|
||||
/** @hide */
|
||||
public static String safeDigest(@NonNull byte[] digest) {
|
||||
final String digestStr = encodeDigest(digest);
|
||||
return digestStr.substring(0, 2) + ".." + digestStr.substring(digestStr.length() - 2);
|
||||
}
|
||||
|
||||
private String encodeDigest() {
|
||||
private static String encodeDigest(@NonNull byte[] digest) {
|
||||
return Base64.encodeToString(digest, Base64.NO_WRAP);
|
||||
}
|
||||
|
||||
|
||||
@@ -594,6 +594,7 @@ public class BlobStoreManagerService extends SystemService {
|
||||
} else {
|
||||
blob.addOrReplaceCommitter(existingCommitter);
|
||||
}
|
||||
Slog.d(TAG, "Error committing the blob", e);
|
||||
session.sendCommitCallbackResult(COMMIT_RESULT_ERROR);
|
||||
}
|
||||
getUserSessionsLocked(UserHandle.getUserId(session.getOwnerUid()))
|
||||
|
||||
@@ -28,7 +28,6 @@ import static android.system.OsConstants.O_RDONLY;
|
||||
import static android.system.OsConstants.O_RDWR;
|
||||
import static android.system.OsConstants.SEEK_SET;
|
||||
|
||||
import static com.android.server.blob.BlobStoreConfig.LOGV;
|
||||
import static com.android.server.blob.BlobStoreConfig.TAG;
|
||||
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_SESSION_CREATION_TIME;
|
||||
import static com.android.server.blob.BlobStoreConfig.hasSessionExpired;
|
||||
@@ -423,9 +422,10 @@ class BlobStoreSession extends IBlobStoreSession.Stub {
|
||||
mState = STATE_VERIFIED_VALID;
|
||||
// Commit callback will be sent once the data is persisted.
|
||||
} else {
|
||||
if (LOGV) {
|
||||
Slog.v(TAG, "Digest of the data didn't match the given BlobHandle.digest");
|
||||
}
|
||||
Slog.d(TAG, "Digest of the data ("
|
||||
+ (mDataDigest == null ? "null" : BlobHandle.safeDigest(mDataDigest))
|
||||
+ ") didn't match the given BlobHandle.digest ("
|
||||
+ BlobHandle.safeDigest(mBlobHandle.digest) + ")");
|
||||
mState = STATE_VERIFIED_INVALID;
|
||||
sendCommitCallbackResult(COMMIT_RESULT_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user