71 lines
2.4 KiB
Java
71 lines
2.4 KiB
Java
|
package com.huawei.hms.hatool;
|
||
|
|
||
|
import android.text.TextUtils;
|
||
|
import java.util.Map;
|
||
|
import java.util.regex.Pattern;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public class e1 {
|
||
|
public static boolean a(Map<String, String> map) {
|
||
|
String str;
|
||
|
if (map == null || map.size() == 0) {
|
||
|
str = "onEvent() mapValue has not data.so,The data will be empty";
|
||
|
} else if (map.size() == 1 && (map.get("constants") != null || map.get("_constants") != null)) {
|
||
|
str = "checkMap() the key can't be constants or _constants";
|
||
|
} else {
|
||
|
if (map.size() <= 2048 && map.toString().length() <= 204800) {
|
||
|
return true;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("checkMap Map data is too big! size: ");
|
||
|
sb.append(map.size());
|
||
|
sb.append(" length: ");
|
||
|
sb.append(map.toString().length());
|
||
|
str = sb.toString();
|
||
|
}
|
||
|
v.f("hmsSdk", str);
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static boolean a(String str, String str2, String str3) {
|
||
|
StringBuilder sb;
|
||
|
if (TextUtils.isEmpty(str2)) {
|
||
|
sb = new StringBuilder("checkString() Parameter is null! Parameter:");
|
||
|
} else {
|
||
|
if (Pattern.compile(str3).matcher(str2).matches()) {
|
||
|
return true;
|
||
|
}
|
||
|
sb = new StringBuilder("checkString() Parameter verification failure! Parameter:");
|
||
|
}
|
||
|
sb.append(str);
|
||
|
v.f("hmsSdk", sb.toString());
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static boolean a(String str, String str2, int i) {
|
||
|
StringBuilder sb;
|
||
|
if (TextUtils.isEmpty(str2)) {
|
||
|
sb = new StringBuilder("checkString() Parameter is empty : ");
|
||
|
} else {
|
||
|
if (str2.length() <= i) {
|
||
|
return true;
|
||
|
}
|
||
|
sb = new StringBuilder("checkString() Failure of parameter length check! Parameter:");
|
||
|
}
|
||
|
sb.append(str);
|
||
|
v.f("hmsSdk", sb.toString());
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public static boolean a(String str) {
|
||
|
return !a("eventId", str, 256);
|
||
|
}
|
||
|
|
||
|
public static String a(String str, String str2, String str3, String str4) {
|
||
|
if (!TextUtils.isEmpty(str2)) {
|
||
|
return a(str, str2, str3) ? str2 : str4;
|
||
|
}
|
||
|
v.f("hmsSdk", "checkStrParameter() Parameter verification failure! Parameter:".concat(String.valueOf(str)));
|
||
|
return str4;
|
||
|
}
|
||
|
}
|