Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74de4e86 authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Automerger Merge Worker
Browse files

Merge "Log the error when committing the blob fails." into rvc-dev am: 448b11bd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11761988

Change-Id: Ia2357cffeae1278b7e4c9d943940dd0fa788517b
parents 39119a25 448b11bd
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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);
    }

+1 −0
Original line number Diff line number Diff line
@@ -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()))
+4 −4
Original line number Diff line number Diff line
@@ -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);
            }