正在查看: Clash Legends v0.0.1 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 a.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.payu.payuanalytics.analytics.manager;
import android.content.Context;
import android.content.SharedPreferences;
import com.payu.payuanalytics.analytics.listener.OnEventsLogListener;
import com.payu.payuanalytics.analytics.model.BaseAnalytics;
import com.payu.payuanalytics.analytics.utils.PayUAnalyticsConstant;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.Thread;
import java.nio.charset.Charset;
import java.util.Timer;
import java.util.TimerTask;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.Charsets;
import org.json.JSONArray;
public final class a {
public static a h;
public static final C0021a i = new C0021a();
public final Context a;
public final String b;
public volatile boolean c;
public Timer d;
public volatile boolean e;
public final BaseAnalytics f;
public final OnEventsLogListener g;
public static final class C0021a {
}
public static final class b implements Thread.UncaughtExceptionHandler {
public final Context b;
public final Thread.UncaughtExceptionHandler c;
public b(Context context, Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
this.b = context;
this.c = uncaughtExceptionHandler;
}
@Override
public final void uncaughtException(Thread thread, Throwable th) {
while (a.this.c) {
}
a aVar = a.this;
synchronized (aVar) {
do {
} while (aVar.c);
aVar.c = true;
}
try {
a aVar2 = a.this;
FileOutputStream openFileOutput = aVar2.a.openFileOutput(aVar2.b, 0);
a aVar3 = a.this;
Context context = aVar3.a;
String fileName = aVar3.b;
Intrinsics.checkNotNullParameter(fileName, "fileName");
Intrinsics.checkNotNullParameter(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "key");
SharedPreferences sharedPreferences = context != null ? context.getSharedPreferences(fileName, 0) : null;
String string = sharedPreferences != null ? sharedPreferences.getString(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "") : null;
Intrinsics.checkNotNull(string);
if (string.length() > 0) {
JSONArray jSONArray = new JSONArray();
a aVar4 = a.this;
Context context2 = aVar4.a;
String fileName2 = aVar4.b;
Intrinsics.checkNotNullParameter(fileName2, "fileName");
Intrinsics.checkNotNullParameter(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "key");
SharedPreferences sharedPreferences2 = context2 != null ? context2.getSharedPreferences(fileName2, 0) : null;
String string2 = sharedPreferences2 != null ? sharedPreferences2.getString(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "") : null;
Intrinsics.checkNotNull(string2);
JSONArray jSONArray2 = new JSONArray(string2.toString());
int length = jSONArray2.length();
for (int i = 0; i < length; i++) {
jSONArray.put(jSONArray.length(), jSONArray2.getJSONObject(i));
}
String jSONArray3 = jSONArray.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray3, "jsonArray.toString()");
Charset charset = Charsets.UTF_8;
if (jSONArray3 == null) {
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
}
byte[] bytes = jSONArray3.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
openFileOutput.write(bytes);
Context context3 = this.b;
String str = a.this.b;
Intrinsics.checkNotNullParameter(context3, "context");
try {
SharedPreferences.Editor edit = context3.getSharedPreferences(str, 0).edit();
edit.remove(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY);
edit.apply();
} catch (Exception e) {
e.printStackTrace();
}
}
openFileOutput.close();
} catch (IOException e2) {
e2.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
a.this.c = false;
this.c.uncaughtException(thread, th);
}
}
public static final class c extends TimerTask {
public c() {
}
@Override
public void run() {
a.this.c();
}
}
public a(Context context, BaseAnalytics baseAnalytics, OnEventsLogListener onEventsLogListener) {
String analyticsFileName;
this.f = baseAnalytics;
this.g = onEventsLogListener;
this.a = context;
String analyticsFileName2 = baseAnalytics.getAnalyticsFileName();
if (analyticsFileName2 == null || analyticsFileName2.length() == 0) {
analyticsFileName = PayUAnalyticsConstant.PA_DEFAULT_ANALYTICS_FILE_NAME;
} else {
analyticsFileName = baseAnalytics.getAnalyticsFileName();
Intrinsics.checkNotNull(analyticsFileName);
}
this.b = analyticsFileName;
Thread.setDefaultUncaughtExceptionHandler(new b(context, Thread.getDefaultUncaughtExceptionHandler()));
}
public final void a() {
this.c = false;
Context context = this.a;
String fileName = this.b;
Intrinsics.checkNotNullParameter(fileName, "fileName");
Intrinsics.checkNotNullParameter(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "key");
SharedPreferences sharedPreferences = context != null ? context.getSharedPreferences(fileName, 0) : null;
String string = sharedPreferences != null ? sharedPreferences.getString(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY, "") : null;
Intrinsics.checkNotNull(string);
if (string.length() > 1) {
b();
}
}
public final void b() {
Timer timer = this.d;
if (timer != null) {
Intrinsics.checkNotNull(timer);
timer.cancel();
}
Timer timer2 = new Timer();
this.d = timer2;
Intrinsics.checkNotNull(timer2);
timer2.schedule(new c(), this.f.getTimerDelay());
}
public final void c() {
throw new UnsupportedOperationException("Method not decompiled: com.payu.payuanalytics.analytics.manager.a.c():void");
}
public final String a(Context context, String fileName, int i2) {
Intrinsics.checkNotNullParameter(fileName, "fileName");
String str = "";
try {
Intrinsics.checkNotNull(context);
if (!new File(context.getFilesDir(), fileName).exists()) {
context.openFileOutput(fileName, i2);
}
FileInputStream openFileInput = context.openFileInput(fileName);
while (true) {
int read = openFileInput.read();
if (read == -1) {
break;
}
str = str + Character.toString((char) read);
}
openFileInput.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e2) {
e2.printStackTrace();
} catch (Exception e3) {
e3.printStackTrace();
}
return str;
}
public final JSONArray a(JSONArray jSONArray, JSONArray jSONArray2) {
FileOutputStream fileOutputStream = null;
try {
try {
JSONArray jSONArray3 = new JSONArray(jSONArray.toString());
int length = jSONArray2.length();
for (int i2 = 0; i2 < length; i2++) {
jSONArray3.put(jSONArray2.getJSONObject(i2));
}
Context context = this.a;
Intrinsics.checkNotNull(context);
FileOutputStream openFileOutput = context.openFileOutput(this.b, 0);
String jSONArray4 = jSONArray3.toString();
Intrinsics.checkNotNullExpressionValue(jSONArray4, "mergeJsonArray.toString()");
Charset charset = Charsets.UTF_8;
if (jSONArray4 != null) {
byte[] bytes = jSONArray4.getBytes(charset);
Intrinsics.checkNotNullExpressionValue(bytes, "(this as java.lang.String).getBytes(charset)");
openFileOutput.write(bytes);
Context context2 = this.a;
String str = this.b;
Intrinsics.checkNotNullParameter(context2, "context");
try {
SharedPreferences.Editor edit = context2.getSharedPreferences(str, 0).edit();
edit.remove(PayUAnalyticsConstant.PA_ANALYTICS_BUFFER_KEY);
edit.apply();
} catch (Exception e) {
e.printStackTrace();
}
try {
openFileOutput.close();
} catch (IOException e2) {
e2.printStackTrace();
}
this.e = false;
return jSONArray3;
}
throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
} catch (Throwable th) {
if (0 != 0) {
try {
fileOutputStream.close();
} catch (IOException e3) {
e3.printStackTrace();
}
}
this.e = false;
throw th;
}
} catch (Exception e4) {
e4.printStackTrace();
if (0 != 0) {
try {
fileOutputStream.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
this.e = false;
return jSONArray;
}
}
}