Aqara Home v2.4.1版本的 MD5 值为:529779ac2bc0131db52a1fc3098d2b35
以下内容为反编译后的 a.java 源代码,内容仅作参考
package k.d;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Formatter;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import k.u.c.i.l3.e.f;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class a {
public static final String A = " ";
public static Context B = null;
public static b C = null;
public static ExecutorService D = null;
public static final int a = 2;
public static final int b = 3;
public static final int c = 4;
public static final int d = 5;
public static final int f15938e = 6;
public static final int f15939f = 7;
public static final int f15941h = 16;
public static final int f15942i = 32;
public static final int f15943j = 48;
public static final String f15946m = "┌";
public static final String f15947n = "├";
public static final String f15948o = "│ ";
public static final String f15949p = "└";
public static final String f15950q = "────────────────────────────────────────────────────────";
public static final String f15951r = "┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄";
public static final String f15952s = "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
public static final String f15953t = "├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄";
public static final String f15954u = "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────";
public static final int f15955v = 3000;
public static final String f15957x = "log nothing";
public static final String f15958y = "null";
public static final String f15959z = "args";
public static final char[] f15940g = {'V', 'D', 'I', 'W', 'E', 'A'};
public static final String f15944k = System.getProperty("file.separator");
public static final String f15945l = System.getProperty("line.separator");
@SuppressLint({"SimpleDateFormat"})
public static final Format f15956w = new SimpleDateFormat("MM-dd HH:mm:ss.SSS ");
public static class CallableC0283a implements Callable<Boolean> {
public final String a;
public final String b;
public CallableC0283a(String str, String str2) {
this.a = str;
this.b = str2;
}
@Override
public Boolean call() throws Exception {
BufferedWriter bufferedWriter;
Throwable th;
IOException e2;
try {
bufferedWriter = new BufferedWriter(new FileWriter(this.a, true));
try {
try {
bufferedWriter.write(this.b);
try {
bufferedWriter.close();
} catch (IOException e3) {
e3.printStackTrace();
}
return true;
} catch (IOException e4) {
e2 = e4;
e2.printStackTrace();
if (bufferedWriter != null) {
try {
bufferedWriter.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
return false;
}
} catch (Throwable th2) {
th = th2;
if (bufferedWriter != null) {
try {
bufferedWriter.close();
} catch (IOException e6) {
e6.printStackTrace();
}
}
throw th;
}
} catch (IOException e7) {
bufferedWriter = null;
e2 = e7;
} catch (Throwable th3) {
bufferedWriter = null;
th = th3;
if (bufferedWriter != null) {
}
throw th;
}
}
}
public static class b {
public String a;
public String b;
public String c;
public boolean d;
public boolean f15960e;
public String f15961f;
public boolean f15962g;
public boolean f15963h;
public boolean f15964i;
public boolean f15965j;
public boolean f15966k;
public int f15967l;
public int f15968m;
public int f15969n;
public int f15970o;
public b(CallableC0283a callableC0283a) {
this();
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("switch: ");
sb.append(this.d);
sb.append(a.f15945l);
sb.append("console: ");
sb.append(this.f15960e);
sb.append(a.f15945l);
sb.append("tag: ");
sb.append(this.f15962g ? "null" : this.f15961f);
sb.append(a.f15945l);
sb.append("head: ");
sb.append(this.f15963h);
sb.append(a.f15945l);
sb.append("file: ");
sb.append(this.f15964i);
sb.append(a.f15945l);
sb.append("dir: ");
String str = this.b;
if (str == null) {
str = this.a;
}
sb.append(str);
sb.append(a.f15945l);
sb.append("filePrefix: ");
sb.append(this.c);
sb.append(a.f15945l);
sb.append("border: ");
sb.append(this.f15965j);
sb.append(a.f15945l);
sb.append("singleTag: ");
sb.append(this.f15966k);
sb.append(a.f15945l);
sb.append("consoleFilter: ");
sb.append(a.f15940g[this.f15967l - 2]);
sb.append(a.f15945l);
sb.append("fileFilter: ");
sb.append(a.f15940g[this.f15968m - 2]);
sb.append(a.f15945l);
sb.append("stackDeep: ");
sb.append(this.f15969n);
sb.append(a.f15945l);
sb.append("mStackOffset: ");
sb.append(this.f15970o);
return sb.toString();
}
public b() {
this.c = "util";
this.d = true;
this.f15960e = true;
this.f15961f = null;
this.f15962g = true;
this.f15963h = true;
this.f15964i = false;
this.f15965j = true;
this.f15966k = true;
this.f15967l = 2;
this.f15968m = 2;
this.f15969n = 1;
this.f15970o = 0;
if (this.a != null) {
return;
}
if ("mounted".equals(Environment.getExternalStorageState()) && a.B.getExternalCacheDir() != null) {
this.a = a.B.getExternalCacheDir() + a.f15944k + "log" + a.f15944k;
return;
}
this.a = a.B.getCacheDir() + a.f15944k + "log" + a.f15944k;
}
public b a(String str) {
if (!a.e(str)) {
if (!str.endsWith(a.f15944k)) {
str = str + a.f15944k;
}
this.b = str;
} else {
this.b = null;
}
return this;
}
public b b(boolean z2) {
this.f15960e = z2;
return this;
}
public b c(String str) {
if (a.e(str)) {
this.f15961f = "";
this.f15962g = true;
} else {
this.f15961f = str;
this.f15962g = false;
}
return this;
}
public b d(boolean z2) {
this.f15963h = z2;
return this;
}
public b e(boolean z2) {
this.d = z2;
return this;
}
public b f(boolean z2) {
this.f15966k = z2;
return this;
}
public b b(String str) {
if (a.e(str)) {
this.c = "util";
} else {
this.c = str;
}
return this;
}
public b d(@IntRange(from = 0) int i2) {
this.f15970o = i2;
return this;
}
public b a(File file) {
String str;
if (file == null) {
str = null;
} else {
str = file.getAbsolutePath() + a.f15944k;
}
this.b = str;
return this;
}
public b a(boolean z2) {
this.f15965j = z2;
return this;
}
public b b(int i2) {
this.f15968m = i2;
return this;
}
public b a(int i2) {
this.f15967l = i2;
return this;
}
public b c(boolean z2) {
this.f15964i = z2;
return this;
}
public b c(@IntRange(from = 1) int i2) {
this.f15969n = i2;
return this;
}
}
@Retention(RetentionPolicy.SOURCE)
public @interface c {
}
public static class d {
public String a;
public String[] b;
public String c;
public d(String str, String[] strArr, String str2) {
this.a = str;
this.b = strArr;
this.c = str2;
}
}
public a() {
throw new UnsupportedOperationException("u can't instantiate me...");
}
public static b e() {
b bVar = C;
if (bVar != null) {
return bVar;
}
throw new NullPointerException("U should init first.");
}
public static void f(Object... objArr) {
a(5, C.f15961f, objArr);
}
public static void g(int i2, String str, String str2) {
a(i2 | 48, str, str2);
}
public static d h(String str) {
String str2;
String str3;
String name;
if (!C.f15962g && !C.f15963h) {
str3 = C.f15961f;
} else {
StackTraceElement[] stackTrace = new Throwable().getStackTrace();
if (C.f15970o + 3 < stackTrace.length) {
StackTraceElement stackTraceElement = stackTrace[C.f15970o + 3];
String a2 = a(stackTraceElement);
if (C.f15962g && e(str)) {
int indexOf = a2.indexOf(46);
str2 = indexOf == -1 ? a2 : a2.substring(0, indexOf);
} else {
str2 = str;
}
if (C.f15963h) {
String formatter = new Formatter().format("%s, %s.%s(%s:%d)", Thread.currentThread().getName(), stackTraceElement.getClassName(), stackTraceElement.getMethodName(), a2, Integer.valueOf(stackTraceElement.getLineNumber())).toString();
String str4 = " [" + formatter + "]: ";
if (C.f15969n <= 1) {
return new d(str2, new String[]{formatter}, str4);
}
int min = Math.min(C.f15969n, (stackTrace.length - 3) - C.f15970o);
String[] strArr = new String[min];
strArr[0] = formatter;
String formatter2 = new Formatter().format("%" + (name.length() + 2) + "s", "").toString();
for (int i2 = 1; i2 < min; i2++) {
StackTraceElement stackTraceElement2 = stackTrace[i2 + 3 + C.f15970o];
strArr[i2] = new Formatter().format("%s%s.%s(%s:%d)", formatter2, stackTraceElement2.getClassName(), stackTraceElement2.getMethodName(), a(stackTraceElement2), Integer.valueOf(stackTraceElement2.getLineNumber())).toString();
}
return new d(str2, strArr, str4);
}
str3 = str2;
} else {
String a3 = a(stackTrace[3]);
if (C.f15962g && e(str)) {
int indexOf2 = a3.indexOf(46);
if (indexOf2 != -1) {
a3 = a3.substring(0, indexOf2);
}
} else {
a3 = str;
}
return new d(a3, null, ": ");
}
}
return new d(str3, null, ": ");
}
public static void i(String str) {
a(51, C.f15961f, str);
}
public static void b(Object... objArr) {
a(3, C.f15961f, objArr);
}
public static void c(Object... objArr) {
a(6, C.f15961f, objArr);
}
public static void d(Object... objArr) {
a(4, C.f15961f, objArr);
}
public static void e(Object... objArr) {
a(2, C.f15961f, objArr);
}
public static void f(String str, Object... objArr) {
a(5, str, objArr);
}
public static void g(String str) {
String str2 = "";
int i2 = 0;
try {
PackageInfo packageInfo = B.getPackageManager().getPackageInfo(B.getPackageName(), 0);
if (packageInfo != null) {
str2 = packageInfo.versionName;
i2 = packageInfo.versionCode;
}
} catch (PackageManager.NameNotFoundException e2) {
e2.printStackTrace();
}
String substring = str.substring(str.length() - 9, str.length() - 4);
a("************* Log Head ****************\nDate of Log : " + substring + "\nDevice Manufacturer: " + Build.MANUFACTURER + "\nDevice Model : " + Build.MODEL + "\nAndroid Version : " + Build.VERSION.RELEASE + "\nAndroid SDK : " + Build.VERSION.SDK_INT + "\nApp VersionName : " + str2 + "\nApp VersionCode : " + i2 + "\n************* Log Head ****************\n\n", str);
}
public static b a(@NonNull Context context) {
B = context;
if (C == null) {
C = new b(null);
}
return C;
}
public static void b(String str, Object... objArr) {
a(3, str, objArr);
}
public static void c(String str, Object... objArr) {
a(6, str, objArr);
}
public static void d(String str, Object... objArr) {
a(4, str, objArr);
}
public static void e(String str, Object... objArr) {
a(2, str, objArr);
}
public static void f(String str) {
a(35, C.f15961f, str);
}
public static void b(String str, String str2) {
a(35, str, str2);
}
public static void c(String str, String str2) {
a(51, str, str2);
}
public static String d(String str) {
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", "4");
newTransformer.transform(streamSource, streamResult);
String obj = streamResult.getWriter().toString();
return obj.replaceFirst(f.f25226j, f.f25226j + f15945l);
} catch (Exception e2) {
e2.printStackTrace();
return str;
}
}
public static void e(int i2, String str, String str2) {
String[] split;
if (!C.f15965j) {
Log.println(i2, str, str2);
return;
}
for (String str3 : str2.split(f15945l)) {
Log.println(i2, str, f15948o + str3);
}
}
public static void f(int i2, String str, String str2) {
String[] split;
if (C.f15965j) {
for (String str3 : str2.split(f15945l)) {
Log.println(i2, str, f15948o + str3);
}
}
}
public static void b(int i2, String str) {
a(i2 | 48, C.f15961f, str);
}
public static String c(String str) {
try {
if (str.startsWith("{")) {
str = new JSONObject(str).toString(4);
} else if (str.startsWith("[")) {
str = new JSONArray(str).toString(4);
}
} catch (JSONException e2) {
e2.printStackTrace();
}
return str;
}
public static void b(int i2, String str, String str2) {
String format = f15956w.format(new Date(System.currentTimeMillis()));
String substring = format.substring(0, 5);
String substring2 = format.substring(6);
StringBuilder sb = new StringBuilder();
sb.append(C.b == null ? C.a : C.b);
sb.append(C.c);
sb.append("-");
sb.append(substring);
sb.append(".txt");
String sb2 = sb.toString();
if (!b(sb2)) {
Log.e("LogUtils", "create " + sb2 + " failed!");
return;
}
a(substring2 + f15940g[i2 - 2] + "/" + str + str2 + f15945l, sb2);
}
public static void a(Object... objArr) {
a(7, C.f15961f, objArr);
}
public static void a(String str, Object... objArr) {
a(7, str, objArr);
}
public static void a(Object obj) {
a(19, C.f15961f, obj);
}
public static boolean e(String str) {
if (str == null) {
return true;
}
int length = str.length();
for (int i2 = 0; i2 < length; i2++) {
if (!Character.isWhitespace(str.charAt(i2))) {
return false;
}
}
return true;
}
public static void a(int i2, Object obj) {
a(i2 | 16, C.f15961f, obj);
}
public static void c(int i2, String str, String str2) {
int length = str2.length();
int i3 = length / 3000;
if (i3 <= 0) {
e(i2, str, str2);
return;
}
int i4 = 0;
int i5 = 0;
while (i4 < i3) {
int i6 = i5 + 3000;
e(i2, str, str2.substring(i5, i6));
i4++;
i5 = i6;
}
if (i5 != length) {
e(i2, str, str2.substring(i5, length));
}
}
public static void a(String str, Object obj) {
a(19, str, obj);
}
public static void a(int i2, String str, Object obj) {
a(i2 | 16, str, obj);
}
public static void d(int i2, String str, String str2) {
int length = str2.length();
int i3 = length / 3000;
if (i3 > 0) {
int i4 = 0;
if (!C.f15965j) {
int i5 = 0;
while (i4 < i3) {
int i6 = i5 + 3000;
Log.println(i2, str, str2.substring(i5, i6));
i4++;
i5 = i6;
}
if (i5 != length) {
Log.println(i2, str, str2.substring(i5, length));
return;
}
return;
}
StringBuilder sb = new StringBuilder();
int i7 = 3000;
sb.append(str2.substring(0, 3000));
sb.append(f15945l);
sb.append("└────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
Log.println(i2, str, sb.toString());
int i8 = 1;
while (i8 < i3) {
StringBuilder sb2 = new StringBuilder();
sb2.append(" ");
sb2.append(f15945l);
sb2.append("┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
sb2.append(f15945l);
sb2.append(f15948o);
int i9 = i7 + 3000;
sb2.append(str2.substring(i7, i9));
sb2.append(f15945l);
sb2.append("└────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
Log.println(i2, str, sb2.toString());
i8++;
i7 = i9;
}
if (i7 != length) {
Log.println(i2, str, " " + f15945l + "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────" + f15945l + f15948o + str2.substring(i7, length));
return;
}
return;
}
Log.println(i2, str, str2);
}
public static void a(int i2, String str) {
a(i2 | 32, C.f15961f, str);
}
public static void a(int i2, String str, String str2) {
a(i2 | 32, str, str2);
}
public static void a(int i2, String str, Object... objArr) {
if (C.d) {
if (C.f15960e || C.f15964i) {
int i3 = i2 & 15;
int i4 = i2 & 240;
if (i3 >= C.f15967l || i3 >= C.f15968m) {
d h2 = h(str);
String a2 = a(i4, objArr);
if (C.f15960e && i3 >= C.f15967l && i4 != 16) {
a(i3, h2.a, h2.b, a2);
}
if ((C.f15964i || i4 == 16) && i3 >= C.f15968m) {
String str2 = h2.a;
b(i3, str2, h2.c + a2);
}
}
}
}
}
public static String a(StackTraceElement stackTraceElement) {
String fileName = stackTraceElement.getFileName();
if (fileName != null) {
return fileName;
}
String className = stackTraceElement.getClassName();
String[] split = className.split("\\.");
if (split.length > 0) {
className = split[split.length - 1];
}
int indexOf = className.indexOf(36);
if (indexOf != -1) {
className = className.substring(0, indexOf);
}
return className + ".java";
}
public static boolean b(String str) {
File file = new File(str);
if (file.exists()) {
return file.isFile();
}
if (a(file.getParentFile())) {
try {
boolean createNewFile = file.createNewFile();
if (createNewFile) {
g(str);
}
return createNewFile;
} catch (IOException e2) {
e2.printStackTrace();
return false;
}
}
return false;
}
public static String a(int i2, Object... objArr) {
String str;
String d2;
str = "null";
if (objArr != null) {
if (objArr.length == 1) {
Object obj = objArr[0];
str = obj != null ? obj.toString() : "null";
if (i2 == 32) {
d2 = c(str);
} else if (i2 == 48) {
d2 = d(str);
}
str = d2;
} else {
StringBuilder sb = new StringBuilder();
int length = objArr.length;
for (int i3 = 0; i3 < length; i3++) {
Object obj2 = objArr[i3];
sb.append(f15959z);
sb.append("[");
sb.append(i3);
sb.append("]");
sb.append(" = ");
sb.append(obj2 == null ? "null" : obj2.toString());
sb.append(f15945l);
}
str = sb.toString();
}
}
return str.length() == 0 ? f15957x : str;
}
public static void a(int i2, String str, String[] strArr, String str2) {
int i3 = 0;
if (C.f15966k) {
StringBuilder sb = new StringBuilder();
sb.append(" ");
sb.append(f15945l);
if (C.f15965j) {
sb.append("┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
sb.append(f15945l);
if (strArr != null) {
for (String str3 : strArr) {
sb.append(f15948o);
sb.append(str3);
sb.append(f15945l);
}
sb.append("├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄");
sb.append(f15945l);
}
String[] split = str2.split(f15945l);
int length = split.length;
while (i3 < length) {
String str4 = split[i3];
sb.append(f15948o);
sb.append(str4);
sb.append(f15945l);
i3++;
}
sb.append("└────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
} else {
if (strArr != null) {
int length2 = strArr.length;
while (i3 < length2) {
sb.append(strArr[i3]);
sb.append(f15945l);
i3++;
}
}
sb.append(str2);
}
d(i2, str, sb.toString());
return;
}
a(i2, str, true);
a(i2, str, strArr);
c(i2, str, str2);
a(i2, str, false);
}
public static void a(int i2, String str, boolean z2) {
if (C.f15965j) {
Log.println(i2, str, z2 ? "┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────" : "└────────────────────────────────────────────────────────────────────────────────────────────────────────────────");
}
}
public static void a(int i2, String str, String[] strArr) {
if (strArr != null) {
for (String str2 : strArr) {
if (C.f15965j) {
str2 = f15948o + str2;
}
Log.println(i2, str, str2);
}
if (C.f15965j) {
Log.println(i2, str, "├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄");
}
}
}
public static boolean a(File file) {
return file != null && (!file.exists() ? !file.mkdirs() : !file.isDirectory());
}
public static void a(String str, String str2) {
if (D == null) {
D = Executors.newSingleThreadExecutor();
}
try {
if (((Boolean) D.submit(new CallableC0283a(str2, str)).get()).booleanValue()) {
return;
}
} catch (InterruptedException e2) {
e2.printStackTrace();
} catch (ExecutionException e3) {
e3.printStackTrace();
}
Log.e("LogUtils", "log to " + str2 + " failed!");
}
}