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

Commit 4053a428 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: I02e7ccce8192262348e89a9c641efec8db554042
parents c0b18d11 448b11bd
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -219,7 +219,7 @@ public final class BlobHandle implements Parcelable {
    public void dump(IndentingPrintWriter fout, boolean dumpFull) {
    public void dump(IndentingPrintWriter fout, boolean dumpFull) {
        if (dumpFull) {
        if (dumpFull) {
            fout.println("algo: " + algorithm);
            fout.println("algo: " + algorithm);
            fout.println("digest: " + (dumpFull ? encodeDigest() : safeDigest()));
            fout.println("digest: " + (dumpFull ? encodeDigest(digest) : safeDigest(digest)));
            fout.println("label: " + label);
            fout.println("label: " + label);
            fout.println("expiryMs: " + expiryTimeMillis);
            fout.println("expiryMs: " + expiryTimeMillis);
            fout.println("tag: " + tag);
            fout.println("tag: " + tag);
@@ -243,19 +243,20 @@ public final class BlobHandle implements Parcelable {
    public String toString() {
    public String toString() {
        return "BlobHandle {"
        return "BlobHandle {"
                + "algo:" + algorithm + ","
                + "algo:" + algorithm + ","
                + "digest:" + safeDigest() + ","
                + "digest:" + safeDigest(digest) + ","
                + "label:" + label + ","
                + "label:" + label + ","
                + "expiryMs:" + expiryTimeMillis + ","
                + "expiryMs:" + expiryTimeMillis + ","
                + "tag:" + tag
                + "tag:" + tag
                + "}";
                + "}";
    }
    }


    private String safeDigest() {
    /** @hide */
        final String digestStr = encodeDigest();
    public static String safeDigest(@NonNull byte[] digest) {
        final String digestStr = encodeDigest(digest);
        return digestStr.substring(0, 2) + ".." + digestStr.substring(digestStr.length() - 2);
        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);
        return Base64.encodeToString(digest, Base64.NO_WRAP);
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -594,6 +594,7 @@ public class BlobStoreManagerService extends SystemService {
                        } else {
                        } else {
                            blob.addOrReplaceCommitter(existingCommitter);
                            blob.addOrReplaceCommitter(existingCommitter);
                        }
                        }
                        Slog.d(TAG, "Error committing the blob", e);
                        session.sendCommitCallbackResult(COMMIT_RESULT_ERROR);
                        session.sendCommitCallbackResult(COMMIT_RESULT_ERROR);
                    }
                    }
                    getUserSessionsLocked(UserHandle.getUserId(session.getOwnerUid()))
                    getUserSessionsLocked(UserHandle.getUserId(session.getOwnerUid()))
+4 −4
Original line number Original line 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.O_RDWR;
import static android.system.OsConstants.SEEK_SET;
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.TAG;
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_SESSION_CREATION_TIME;
import static com.android.server.blob.BlobStoreConfig.XML_VERSION_ADD_SESSION_CREATION_TIME;
import static com.android.server.blob.BlobStoreConfig.hasSessionExpired;
import static com.android.server.blob.BlobStoreConfig.hasSessionExpired;
@@ -423,9 +422,10 @@ class BlobStoreSession extends IBlobStoreSession.Stub {
                mState = STATE_VERIFIED_VALID;
                mState = STATE_VERIFIED_VALID;
                // Commit callback will be sent once the data is persisted.
                // Commit callback will be sent once the data is persisted.
            } else {
            } else {
                if (LOGV) {
                Slog.d(TAG, "Digest of the data ("
                    Slog.v(TAG, "Digest of the data didn't match the given BlobHandle.digest");
                        + (mDataDigest == null ? "null" : BlobHandle.safeDigest(mDataDigest))
                }
                        + ") didn't match the given BlobHandle.digest ("
                        + BlobHandle.safeDigest(mBlobHandle.digest) + ")");
                mState = STATE_VERIFIED_INVALID;
                mState = STATE_VERIFIED_INVALID;
                sendCommitCallbackResult(COMMIT_RESULT_ERROR);
                sendCommitCallbackResult(COMMIT_RESULT_ERROR);
            }
            }