package com.google.firebase.crashlytics.internal.common; import com.google.firebase.crashlytics.internal.Logger; import java.util.Collections; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /* loaded from: classes.dex */ public class UserMetadata { static final int MAX_ATTRIBUTES = 64; static final int MAX_ATTRIBUTE_SIZE = 1024; private String userId = null; private final ConcurrentHashMap attributes = new ConcurrentHashMap<>(); public void setUserId(String str) { this.userId = sanitizeAttribute(str); } public Map getCustomKeys() { return Collections.unmodifiableMap(this.attributes); } public void setCustomKey(String str, String str2) { if (str == null) { throw new IllegalArgumentException("Custom attribute key must not be null."); } String sanitizeAttribute = sanitizeAttribute(str); if (this.attributes.size() >= 64 && !this.attributes.containsKey(sanitizeAttribute)) { Logger.getLogger().d("Exceeded maximum number of custom attributes (64)"); } else { this.attributes.put(sanitizeAttribute, str2 == null ? "" : sanitizeAttribute(str2)); } } private static String sanitizeAttribute(String str) { if (str == null) { return str; } String trim = str.trim(); return trim.length() > 1024 ? trim.substring(0, 1024) : trim; } public String getUserId() { return this.userId; } }