导航菜单

页面标题

页面副标题

凤凰之城 v1.0.3 - a.java 源代码

正在查看: 凤凰之城 v1.0.3 应用的 a.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package m1;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
import android.os.Environment;
import android.os.Looper;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
import com.baidu.mobads.sdk.api.IAdInterListener;
import com.baidu.mobads.sdk.internal.bn;
import com.octopus.ad.Octopus;
import com.octopus.ad.internal.o;
import com.octopus.ad.utils.b.d;
import com.octopus.ad.utils.b.f;
import com.octopus.ad.utils.b.h;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.json.JSONObject;

public class a implements Thread.UncaughtExceptionHandler {

    public static a f4864c;

    public Thread.UncaughtExceptionHandler f4865a;

    public Context f4866b;

    public class RunnableC0060a implements Runnable {

        public final String f4867a;

        public final boolean f4868b;

        public RunnableC0060a(String str, boolean z2) {
            this.f4867a = str;
            this.f4868b = z2;
        }

        @Override
        public void run() {
            Looper.prepare();
            a.this.j(this.f4867a, this.f4868b);
            Looper.loop();
        }
    }

    public static java.lang.String a(java.io.File r8) {
        throw new UnsupportedOperationException("Method not decompiled: m1.a.a(java.io.File):java.lang.String");
    }

    public static a b() {
        if (f4864c == null) {
            f4864c = new a();
        }
        return f4864c;
    }

    public void c(Context context) {
        this.f4866b = context.getApplicationContext();
        this.f4865a = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this);
    }

    public final void d(String str) {
        try {
            if (!Environment.getExternalStorageState().equals("mounted")) {
                Log.e("CrashHandler", "sdcard unmounted,skip dump exception");
                return;
            }
            Context context = this.f4866b;
            if (context == null) {
                return;
            }
            File a2 = h.a(context);
            f.a("OctopusAd", "CrashHandler storagePath == " + a2);
            if (a2 != null) {
                String str2 = a2.getPath() + "/Octopus/log/";
                File file = new File(str2);
                if (!file.exists()) {
                    file.mkdirs();
                }
                String format = new SimpleDateFormat("yyyy-MM-dd HH:MM:SS").format(new Date(System.currentTimeMillis()));
                File file2 = new File(str2 + "crash_" + format + ".trace");
                file2.createNewFile();
                FileWriter fileWriter = new FileWriter(file2, true);
                BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
                bufferedWriter.write(format);
                bufferedWriter.write("\r\n");
                bufferedWriter.write("------------------crash----------------------");
                bufferedWriter.write("\r\n");
                bufferedWriter.write(str);
                bufferedWriter.write("\r\n");
                bufferedWriter.write("-------------------end-----------------------");
                bufferedWriter.newLine();
                bufferedWriter.close();
                fileWriter.close();
            }
        } catch (Exception e2) {
            f.a("OctopusAd", "An Exception Caught", e2);
        } catch (Throwable th) {
            f.a("OctopusAd", "A Throwable Caught", th);
        }
    }

    public final void e(String str, boolean z2) {
        String str2;
        try {
            if (this.f4866b == null) {
                this.f4866b = o.a().k();
            }
            PackageInfo packageInfo = this.f4866b.getPackageManager().getPackageInfo(this.f4866b.getPackageName(), 1);
            JSONObject jSONObject = new JSONObject();
            JSONObject jSONObject2 = new JSONObject();
            jSONObject.put("appId", o.a().j());
            jSONObject.put("packageName", this.f4866b.getPackageName());
            jSONObject.put("versionName", packageInfo.versionName);
            jSONObject.put("versionCode", String.valueOf(packageInfo.versionCode));
            jSONObject.put("sdkVersion", "1.6.4.6");
            jSONObject.put("sdkTag", "OctopusAd");
            jSONObject2.put("oaid", Octopus.getOaid(this.f4866b));
            jSONObject2.put("osVersion", Build.VERSION.RELEASE + "_" + Build.VERSION.SDK_INT);
            jSONObject2.put("vendor", Build.MANUFACTURER);
            jSONObject2.put(bn.f988i, Build.MODEL);
            jSONObject2.put(IAdInterListener.AdProdType.PRODUCT_CPU, Build.CPU_ABI);
            jSONObject.put("device", jSONObject2);
            jSONObject.put("crashType", z2 ? "native" : "java");
            jSONObject.put("crashMessage", str);
            String n2 = o.a().n();
            if (z2) {
                str2 = n2 + "/sdk/soCrashReport";
            } else {
                str2 = n2 + "/sdk/crashReport";
            }
            d.a(str2, jSONObject.toString().getBytes());
        } catch (Exception e2) {
            f.a("OctopusAd", "An Exception Caught", e2);
        }
    }

    public final void f(Throwable th) {
        if (th == null) {
            return;
        }
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
        th.printStackTrace(printWriter);
        for (Throwable cause = th.getCause(); cause != null; cause = cause.getCause()) {
            cause.printStackTrace(printWriter);
        }
        printWriter.close();
        i(stringWriter.toString(), false);
    }

    public void h() {
        try {
            if (this.f4866b == null) {
                this.f4866b = o.a().k();
            }
            File filesDir = this.f4866b.getFilesDir();
            if (filesDir != null) {
                File[] listFiles = new File(filesDir.getPath() + "/octopus-crash/").listFiles();
                if (listFiles != null) {
                    for (File file : listFiles) {
                        if (file.exists()) {
                            i(a(file), true);
                            file.delete();
                        }
                    }
                }
            }
        } catch (Exception e2) {
            Log.e("OctopusAd", "Catch An Exception: " + e2.getMessage());
        }
    }

    public final void i(String str, boolean z2) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        new Thread(new RunnableC0060a(str, z2)).start();
    }

    public final void j(String str, boolean z2) {
        if (str.contains("com.octopus.ad")) {
            e(str, z2);
            if (z2) {
                return;
            }
            d(str);
        }
    }

    @Override
    public void uncaughtException(@NonNull Thread thread, @NonNull Throwable th) {
        try {
            f(th);
            Thread.sleep(1000L);
        } catch (Exception e2) {
            f.a("OctopusAd", "An Exception Caught", e2);
        }
        Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.f4865a;
        if (uncaughtExceptionHandler != null) {
            uncaughtExceptionHandler.uncaughtException(thread, th);
        } else {
            Process.killProcess(Process.myPid());
        }
    }
}