Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35
以下内容为反编译后的 k.java 源代码,内容仅作参考
package k.w.a;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class k implements m {
public static final int c = 2;
public final ThreadLocal<String> a = new ThreadLocal<>();
public final List<g> b = new ArrayList();
@NonNull
private String g(@NonNull String str, @Nullable Object... objArr) {
return (objArr == null || objArr.length == 0) ? str : String.format(str, objArr);
}
@Override
public m a(String str) {
if (str != null) {
this.a.set(str);
}
return this;
}
@Override
public void b(@NonNull String str, @Nullable Object... objArr) {
a(4, (Throwable) null, str, objArr);
}
@Override
public void c(@NonNull String str, @Nullable Object... objArr) {
a(3, (Throwable) null, str, objArr);
}
@Override
public void d(@Nullable Object obj) {
a(3, (Throwable) null, o.b(obj), new Object[0]);
}
@Override
public void e(@NonNull String str, @Nullable Object... objArr) {
a(null, str, objArr);
}
@Override
public void f(@NonNull String str, @Nullable Object... objArr) {
a(5, (Throwable) null, str, objArr);
}
@Override
public void json(@Nullable String str) {
if (o.a((CharSequence) str)) {
d("Empty/Null json content");
return;
}
try {
String trim = str.trim();
if (trim.startsWith("{")) {
d(new JSONObject(trim).toString(2));
} else if (trim.startsWith("[")) {
d(new JSONArray(trim).toString(2));
} else {
e("Invalid Json", new Object[0]);
}
} catch (JSONException unused) {
e("Invalid Json", new Object[0]);
}
}
@Override
public void xml(@Nullable String str) {
if (o.a((CharSequence) str)) {
d("Empty/Null xml content");
return;
}
try {
StreamSource streamSource = new StreamSource(new StringReader(str));
StreamResult streamResult = new StreamResult(new StringWriter());
Transformer newTransformer = TransformerFactory.newInstance().newTransformer();
newTransformer.setOutputProperty("indent", "yes");
newTransformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
newTransformer.transform(streamSource, streamResult);
d(streamResult.getWriter().toString().replaceFirst(k.u.c.i.l3.e.f.f25226j, ">\n"));
} catch (TransformerException unused) {
e("Invalid xml", new Object[0]);
}
}
@Nullable
private String b() {
String str = this.a.get();
if (str != null) {
this.a.remove();
return str;
}
return null;
}
@Override
public void a(@Nullable Throwable th, @NonNull String str, @Nullable Object... objArr) {
a(6, th, str, objArr);
}
@Override
public void d(@NonNull String str, @Nullable Object... objArr) {
a(2, (Throwable) null, str, objArr);
}
@Override
public void a(@NonNull String str, @Nullable Object... objArr) {
a(7, (Throwable) null, str, objArr);
}
@Override
public synchronized void a(int i2, @Nullable String str, @Nullable String str2, @Nullable Throwable th) {
if (th != null && str2 != null) {
str2 = str2 + " : " + o.a(th);
}
if (th != null && str2 == null) {
str2 = o.a(th);
}
if (o.a((CharSequence) str2)) {
str2 = "Empty/NULL log message";
}
for (g gVar : this.b) {
if (gVar.a(i2, str)) {
gVar.log(i2, str, str2);
}
}
}
@Override
public void a() {
this.b.clear();
}
@Override
public void a(@NonNull g gVar) {
this.b.add(o.a(gVar));
}
private synchronized void a(int i2, @Nullable Throwable th, @NonNull String str, @Nullable Object... objArr) {
o.a(str);
a(i2, b(), g(str, objArr), th);
}
}