APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:For S9
版本号:4.5
包名称:com.jb.gokeyboard.theme.emojiztfors9.getjar

MD5 校验值:27cf44ec6e0720408f5ef017a90a3331

反编译源代码说明

b.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.jb.gokeyboard.theme.template.crashreport;

import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.Looper;
import android.os.Process;
import android.os.StatFs;
import android.support.v4.app.NotificationCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import android.util.Log;
import android.widget.Toast;
import com.gau.utils.net.util.HeartSetting;
import com.jb.gokeyboard.theme.emojiztfors9.getjar.R;
import com.jb.gokeyboard.theme.template.ThemeApplication;
import com.jb.gokeyboard.theme.template.new_template.StickerInfoBean;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;

public class b implements Thread.UncaughtExceptionHandler {
    public static final String a = Environment.getExternalStorageDirectory().getPath() + "/theme/log/";
    private static b e;
    private static Uri i;
    private Thread.UncaughtExceptionHandler d;
    private Context f;
    private Properties c = new Properties();
    Map<String, String> b = new HashMap();
    private ReportingInteractionMode g = ReportingInteractionMode.SILENT;
    private Bundle h = new Bundle();
    private String j = null;
    private boolean k = false;
    private boolean l = false;

    final class a extends Thread {
        private String b = null;
        private String c = null;

        public a() {
        }

        @Override
        public void run() {
            try {
                b.this.a(b.this.f, this.c, this.b);
            } catch (Exception e) {
                Log.e("ACRA", "send report Email failed");
            }
        }

        public void a(String str) {
            this.c = str;
        }
    }

    public static void a(Uri uri) {
        i = uri;
    }

    private String e() {
        String str = "";
        Iterator<String> it = this.b.keySet().iterator();
        while (true) {
            String str2 = str;
            if (it.hasNext()) {
                String next = it.next();
                str = str2 + next + " = " + this.b.get(next) + "\n";
            } else {
                return str2;
            }
        }
    }

    public static synchronized b a() {
        b bVar;
        synchronized (b.class) {
            if (e == null) {
                e = new b();
            }
            bVar = e;
        }
        return bVar;
    }

    public void a(Context context) {
        this.d = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this);
        this.f = context;
    }

    public static long b() {
        StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
        return statFs.getAvailableBlocks() * statFs.getBlockSize();
    }

    public static long c() {
        StatFs statFs = new StatFs(Environment.getDataDirectory().getPath());
        return statFs.getBlockCount() * statFs.getBlockSize();
    }

    private void b(Context context) {
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            if (packageInfo != null) {
                this.c.put("VersionName", packageInfo.versionName != null ? packageInfo.versionName : "not set");
                this.c.put("VersionCode", "" + packageInfo.versionCode);
            } else {
                this.c.put("PackageName", "Package info unavailable");
            }
            this.c.put("PackageName", context.getPackageName());
            this.c.put("PhoneModel", Build.MODEL);
            this.c.put("AndroidVersion", Build.VERSION.RELEASE);
            this.c.put("BOARD", Build.BOARD);
            this.c.put("BRAND", Build.BRAND);
            this.c.put("DEVICE", Build.DEVICE);
            this.c.put("DISPLAY", Build.DISPLAY);
            this.c.put("FINGERPRINT", Build.FINGERPRINT);
            this.c.put("HOST", Build.HOST);
            this.c.put("ID", Build.ID);
            this.c.put("MODEL", Build.MODEL);
            this.c.put("PRODUCT", Build.PRODUCT);
            this.c.put("TAGS", Build.TAGS);
            this.c.put("TIME", "" + Build.TIME);
            this.c.put("TYPE", Build.TYPE);
            this.c.put("USER", Build.USER);
            this.c.put("TotalMemSize", "" + c());
            this.c.put("AvaliableMemSize", "" + b());
            this.c.put("SVN", com.jb.gokeyboard.theme.template.util.b.h(context));
            this.c.put("FilePath", context.getFilesDir().getAbsolutePath());
            String str = null;
            c a2 = c.a(this.f);
            if (a2 != null) {
                str = a2.a();
            }
            if (str != null) {
                this.c.put("Mem Infos", str);
            } else {
                this.c.put("Mem Infos", "error");
            }
            this.c.put("DENSITY", String.valueOf(context.getResources().getDisplayMetrics().density));
            this.c.put("Current Heap", Integer.toString((int) ((Runtime.getRuntime().maxMemory() / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID) / PlaybackStateCompat.ACTION_PLAY_FROM_MEDIA_ID)) + "MB");
        } catch (Exception e2) {
            Log.e("ACRA", "Error while retrieving crash data", e2);
        }
    }

    @Override
    public void uncaughtException(Thread thread, Throwable th) {
        try {
            d();
            a(th);
        } catch (Exception e2) {
        }
        if (this.g == ReportingInteractionMode.TOAST) {
            try {
                Thread.sleep(4000L);
            } catch (InterruptedException e3) {
                Log.e("ACRA", "Error : ", e3);
            }
        }
        if (this.g == ReportingInteractionMode.SILENT) {
            this.d.uncaughtException(thread, th);
            return;
        }
        try {
            Log.e("ACRA", ((Object) this.f.getPackageManager().getApplicationInfo(this.f.getPackageName(), 0).loadLabel(this.f.getPackageManager())) + " fatal error : " + th.getMessage(), th);
        } catch (PackageManager.NameNotFoundException e4) {
            Log.e("ACRA", "Error : ", e4);
        } finally {
            Log.i("ACRA", "process id" + Process.myPid());
            Process.killProcess(Process.myPid());
            System.exit(10);
        }
    }

    void a(Throwable th, ReportingInteractionMode reportingInteractionMode) {
        if (reportingInteractionMode == null) {
            reportingInteractionMode = this.g;
        }
        if (th == null) {
            th = new Exception("Report requested by developer");
        }
        if (reportingInteractionMode == ReportingInteractionMode.TOAST) {
            new Thread() {
                @Override
                public void run() {
                    Looper.prepare();
                    Toast.makeText(b.this.f, b.this.h.getInt("RES_TOAST_TEXT"), 1).show();
                    Looper.loop();
                }
            }.start();
        }
        b(this.f);
        this.c.put("CustomData", e());
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
        printWriter.append((CharSequence) th.getMessage());
        th.printStackTrace(printWriter);
        Log.getStackTraceString(th);
        for (Throwable cause = th.getCause(); cause != null; cause = cause.getCause()) {
            cause.printStackTrace(printWriter);
        }
        this.c.put("StackTrace", stringWriter.toString());
        printWriter.close();
        this.k = false;
        this.l = false;
        b(th);
        f();
    }

    private void f() {
        Context a2 = ThemeApplication.a();
        Intent intent = new Intent("com.jb.gokeyboard.theme.template.getjar.SENDCRASH");
        intent.putExtra("upload_crash_commend", true);
        intent.setPackage(a2.getPackageName());
        ((AlarmManager) a2.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(1, System.currentTimeMillis() + HeartSetting.DEFAULT_HEART_TIME_INTERVAL, PendingIntent.getBroadcast(a2, 0, intent, 0));
    }

    public void a(Throwable th) {
        a(th, this.g);
    }

    private void b(Throwable th) {
        Context a2;
        FileWriter fileWriter;
        String replaceAll = c(th).replaceAll("$", "_");
        String replaceAll2 = g().replaceAll(StickerInfoBean.ANIMATED_IMAGES_SEPARATOR, "$").replaceAll("\\n", StickerInfoBean.ANIMATED_IMAGES_SEPARATOR);
        FileWriter fileWriter2 = null;
        try {
            try {
                a2 = ThemeApplication.a();
                fileWriter = new FileWriter(new File(a2.getFilesDir() + File.separator + "crash.log"), false);
            } catch (Throwable th2) {
                th = th2;
            }
        } catch (Throwable th3) {
            th = th3;
        }
        try {
            fileWriter.write(com.jb.gokeyboard.theme.template.statistics.a.a(System.currentTimeMillis(), 41, 454, a2.getPackageName(), replaceAll, 1, "-1", "", "", "", replaceAll2, "-1", "-1"));
            fileWriter.flush();
            if (fileWriter != null) {
                try {
                    fileWriter.close();
                } catch (Throwable th4) {
                    th4.printStackTrace();
                }
            }
        } catch (Throwable th5) {
            th = th5;
            fileWriter2 = fileWriter;
            th.printStackTrace();
            if (fileWriter2 != null) {
                try {
                    fileWriter2.close();
                } catch (Throwable th6) {
                    th6.printStackTrace();
                }
            }
        }
    }

    public void a(Context context, String str, String str2) {
        Log.i("ACRA", str);
        Intent intent = new Intent("android.intent.action.SEND");
        intent.addFlags(268435456);
        String str3 = ("theme single page  ( " + com.jb.gokeyboard.theme.template.util.b.i(context) + " ) " + (" v" + com.jb.gokeyboard.theme.template.util.b.e(context)) + context.getString(R.string.crash_subject)) + " ver_name:" + com.jb.gokeyboard.theme.template.util.b.f(context) + " ver_code:" + com.jb.gokeyboard.theme.template.util.b.e(context);
        intent.putExtra("android.intent.extra.EMAIL", new String[]{"goforkeyboard@gmail.com"});
        intent.putExtra("android.intent.extra.SUBJECT", str3);
        intent.putExtra("android.intent.extra.TEXT", context.getPackageName());
        intent.putExtra("android.intent.extra.STREAM", Uri.fromFile(new File(str)));
        intent.setType("plain/text");
        context.startActivity(intent);
    }

    public void a(ReportingInteractionMode reportingInteractionMode) {
        this.g = reportingInteractionMode;
    }

    public void a(Bundle bundle) {
        this.h = bundle;
    }

    public void d() {
        if (this.d != null) {
            Thread.setDefaultUncaughtExceptionHandler(this.d);
        }
    }

    public synchronized void a(OutputStream outputStream, Properties properties) throws IOException {
        if (properties != null) {
            String property = System.getProperty("line.separator");
            String str = property == null ? "\n" : property;
            StringBuilder sb = new StringBuilder(200);
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputStream);
            outputStreamWriter.write(StickerInfoBean.ANIMATED_IMAGES_SEPARATOR);
            outputStreamWriter.write(new Date().toString());
            outputStreamWriter.write(str);
            for (Map.Entry entry : properties.entrySet()) {
                sb.append((String) entry.getKey());
                sb.append('=');
                sb.append((String) entry.getValue());
                sb.append(str);
                outputStreamWriter.write(sb.toString());
                sb.setLength(0);
            }
            outputStreamWriter.flush();
        }
    }

    private String c(Throwable th) {
        StringBuilder sb = new StringBuilder();
        StackTraceElement[] stackTrace = th.getStackTrace();
        if (stackTrace.length > 0) {
            sb.append(stackTrace[0].toString());
        }
        return sb.toString();
    }

    private String g() {
        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            try {
                a(byteArrayOutputStream, this.c);
            } catch (IOException e2) {
                e2.printStackTrace();
                try {
                    byteArrayOutputStream.flush();
                    byteArrayOutputStream.close();
                } catch (IOException e3) {
                    e3.printStackTrace();
                }
            }
            String byteArrayOutputStream2 = byteArrayOutputStream.toString();
            String h = h();
            StringBuilder sb = new StringBuilder();
            sb.append(byteArrayOutputStream2);
            sb.append("\n");
            sb.append("运行状态\n");
            sb.append("crashInfo: \n");
            sb.append("com.jb.gokeyboard_preferences.xml");
            sb.append("\n");
            sb.append(h);
            sb.append("\n");
            sb.append("inputInfo");
            sb.append("\n");
            String str = "虚拟键盘";
            if (this.f.getResources().getConfiguration().hardKeyboardHidden == 1) {
                str = "硬键盘";
            }
            sb.append(" @ @" + ThemeApplication.a().getPackageName() + "@" + str);
            sb.append("\n");
            return sb.toString();
        } finally {
            try {
                byteArrayOutputStream.flush();
                byteArrayOutputStream.close();
            } catch (IOException e4) {
                e4.printStackTrace();
            }
        }
    }

    private String h() {
        BufferedReader bufferedReader;
        Context applicationContext = ThemeApplication.a().getApplicationContext();
        File file = new File(applicationContext.getFilesDir().getParent() + File.separator + "shared_prefs" + File.separator + applicationContext.getPackageName() + "_preferences.xml");
        StringBuilder sb = new StringBuilder();
        if (file.exists()) {
            LineNumberReader lineNumberReader = 0;
            try {
                try {
                    bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
                    while (true) {
                        try {
                            String readLine = bufferedReader.readLine();
                            if (readLine == null) {
                                break;
                            }
                            sb.append(readLine);
                        } catch (Throwable th) {
                            th = th;
                            th.printStackTrace();
                            if (bufferedReader != null) {
                                try {
                                    bufferedReader.close();
                                } catch (Throwable th2) {
                                    th2.printStackTrace();
                                }
                            }
                            return sb.toString();
                        }
                    }
                    if (bufferedReader != null) {
                        try {
                            bufferedReader.close();
                        } catch (Throwable th3) {
                            th3.printStackTrace();
                        }
                    }
                } catch (Throwable th4) {
                    th = th4;
                    lineNumberReader = "_preferences.xml";
                    if (lineNumberReader != 0) {
                        try {
                            lineNumberReader.close();
                        } catch (Throwable th5) {
                            th5.printStackTrace();
                        }
                    }
                    throw th;
                }
            } catch (Throwable th6) {
                th = th6;
                bufferedReader = null;
            }
        }
        return sb.toString();
    }
}