package com.tencent.mm.opensdk.modelmsg; import android.os.Bundle; import com.tencent.mm.opensdk.modelmsg.WXMediaMessage; import com.tencent.mm.opensdk.utils.Log; import java.io.File; /* loaded from: classes.dex */ public class WXEmojiObject implements WXMediaMessage.IMediaObject { private static final int CONTENT_LENGTH_LIMIT = 10485760; private static final String TAG = "MicroMsg.SDK.WXEmojiObject"; public byte[] emojiData; public String emojiPath; public WXEmojiObject() { this.emojiData = null; this.emojiPath = null; } public WXEmojiObject(String str) { this.emojiPath = str; } public WXEmojiObject(byte[] bArr) { this.emojiData = bArr; } private int getFileSize(String str) { if (str == null || str.length() == 0) { return 0; } File file = new File(str); if (file.exists()) { return (int) file.length(); } return 0; } @Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject public boolean checkArgs() { String str; String str2; byte[] bArr = this.emojiData; if ((bArr == null || bArr.length == 0) && ((str = this.emojiPath) == null || str.length() == 0)) { str2 = "checkArgs fail, both arguments is null"; } else { byte[] bArr2 = this.emojiData; if (bArr2 == null || bArr2.length <= CONTENT_LENGTH_LIMIT) { String str3 = this.emojiPath; if (str3 == null || getFileSize(str3) <= CONTENT_LENGTH_LIMIT) { return true; } str2 = "checkArgs fail, emojiSize is too large"; } else { str2 = "checkArgs fail, emojiData is too large"; } } Log.e(TAG, str2); return false; } @Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject public void serialize(Bundle bundle) { bundle.putByteArray("_wxemojiobject_emojiData", this.emojiData); bundle.putString("_wxemojiobject_emojiPath", this.emojiPath); } public void setEmojiData(byte[] bArr) { this.emojiData = bArr; } public void setEmojiPath(String str) { this.emojiPath = str; } @Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject public int type() { return 8; } @Override // com.tencent.mm.opensdk.modelmsg.WXMediaMessage.IMediaObject public void unserialize(Bundle bundle) { this.emojiData = bundle.getByteArray("_wxemojiobject_emojiData"); this.emojiPath = bundle.getString("_wxemojiobject_emojiPath"); } }