Shandong video conference v3.2.10版本的 MD5 值为:e9e908f971313b4c4bca5737f96781ef

以下内容为反编译后的 g.java 源代码,内容仅作参考


package org.acra;

import android.app.Activity;
import android.app.Application;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.os.Looper;
import android.os.Process;
import android.text.format.Time;
import java.io.File;
import java.lang.Thread;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.acra.collector.CrashReportData;
import org.acra.sender.HttpSender;
import org.acra.util.k;
public class g implements Thread.UncaughtExceptionHandler {
    private static final h f21952k = new a();
    private static int l = 0;
    private boolean a;
    private final Application f21953b;
    private final SharedPreferences f21954c;
    private final org.acra.collector.d f21956e;
    private final Thread.UncaughtExceptionHandler f21958g;
    private final List<org.acra.sender.b> f21955d = new ArrayList();
    private final org.acra.d f21957f = new org.acra.d();
    private WeakReference<Activity> f21959h = new WeakReference<>(null);
    private boolean f21960i = true;
    private volatile h f21961j = f21952k;

    public static class a implements h {
        a() {
        }

        @Override
        public void a(g gVar) {
        }
    }

    class b implements org.acra.k.a.a.a.b {
        b() {
        }

        @Override
        public void onActivityCreated(Activity activity, Bundle bundle) {
            if (activity instanceof BaseCrashReportDialog) {
                return;
            }
            g.this.f21959h = new WeakReference(activity);
        }

        @Override
        public void onActivityDestroyed(Activity activity) {
        }

        @Override
        public void onActivityPaused(Activity activity) {
        }

        @Override
        public void onActivityResumed(Activity activity) {
        }

        @Override
        public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
        }

        @Override
        public void onActivityStarted(Activity activity) {
        }

        @Override
        public void onActivityStopped(Activity activity) {
        }
    }

    public class c extends Thread {
        final C0399g a;

        c(C0399g c0399g) {
            this.a = c0399g;
        }

        @Override
        public void run() {
            Looper.prepare();
            k.a(g.this.f21953b, org.acra.a.c().resToastText(), 1);
            this.a.a(System.currentTimeMillis());
            Looper.loop();
        }
    }

    public class d extends Thread {
        final C0399g a;

        d(C0399g c0399g) {
            this.a = c0399g;
        }

        @Override
        public void run() {
            org.acra.l.a aVar = org.acra.a.f21900c;
            String str = org.acra.a.f21899b;
            aVar.d(str, "Waiting for 2000 millis from " + this.a.a + " currentMillis=" + System.currentTimeMillis());
            while (this.a.a() < 2000) {
                try {
                    Thread.sleep(100L);
                } catch (InterruptedException e2) {
                    org.acra.a.f21900c.d(org.acra.a.f21899b, "Interrupted while waiting for Toast to end.", e2);
                }
            }
            g.this.f21960i = true;
        }
    }

    public class e extends Thread {
        final i a;
        final boolean f21964b;
        final String f21965c;
        final f f21966d;

        e(i iVar, boolean z, String str, f fVar) {
            this.a = iVar;
            this.f21964b = z;
            this.f21965c = str;
            this.f21966d = fVar;
        }

        @Override
        public void run() {
            org.acra.a.f21900c.d(org.acra.a.f21899b, "Waiting for Toast");
            while (!g.this.f21960i) {
                try {
                    Thread.sleep(100L);
                } catch (InterruptedException e2) {
                    org.acra.a.f21900c.d(org.acra.a.f21899b, "Error : ", e2);
                }
            }
            org.acra.a.f21900c.d(org.acra.a.f21899b, "Finished waiting for Toast");
            if (this.a != null) {
                org.acra.a.f21900c.d(org.acra.a.f21899b, "Waiting for Worker");
                while (this.a.isAlive()) {
                    try {
                        Thread.sleep(100L);
                    } catch (InterruptedException e3) {
                        org.acra.a.f21900c.d(org.acra.a.f21899b, "Error : ", e3);
                    }
                }
                org.acra.a.f21900c.d(org.acra.a.f21899b, "Finished waiting for Worker");
            }
            if (this.f21964b) {
                org.acra.l.a aVar = org.acra.a.f21900c;
                String str = org.acra.a.f21899b;
                aVar.d(str, "Creating CrashReportDialog for " + this.f21965c);
                Intent a = g.this.a(this.f21965c, this.f21966d);
                a.setFlags(268435456);
                g.this.f21953b.startActivity(a);
            }
            org.acra.l.a aVar2 = org.acra.a.f21900c;
            String str2 = org.acra.a.f21899b;
            aVar2.d(str2, "Wait for Toast + worker ended. Kill Application ? " + this.f21966d.f21972f);
            if (this.f21966d.f21972f) {
                g.this.a(this.f21966d.f21968b, this.f21966d.f21969c);
            }
        }
    }

    public final class f {
        private String a;
        private Thread f21968b;
        private Throwable f21969c;
        private Map<String, String> f21970d;
        private boolean f21971e = false;
        private boolean f21972f = false;

        public f() {
        }

        private void d() {
            if (this.f21970d == null) {
                this.f21970d = new HashMap();
            }
        }

        public f b() {
            this.f21971e = true;
            return this;
        }

        public void c() {
            if (this.a == null && this.f21969c == null) {
                this.a = "Report requested by developer";
            }
            g.this.a(this);
        }

        public f a(String str) {
            this.a = str;
            return this;
        }

        public f a(Thread thread) {
            this.f21968b = thread;
            return this;
        }

        public f a(Throwable th) {
            this.f21969c = th;
            return this;
        }

        public f a(Map<String, String> map) {
            d();
            this.f21970d.putAll(map);
            return this;
        }

        public f a(String str, String str2) {
            d();
            this.f21970d.put(str, str2);
            return this;
        }

        public f a() {
            this.f21972f = true;
            return this;
        }
    }

    public static class C0399g {
        private Long a;

        private C0399g() {
        }

        C0399g(a aVar) {
            this();
        }

        public void a(long j2) {
            this.a = Long.valueOf(j2);
        }

        public long a() {
            if (this.a == null) {
                return 0L;
            }
            return System.currentTimeMillis() - this.a.longValue();
        }
    }

    public g(Application application, SharedPreferences sharedPreferences, boolean z) {
        this.a = false;
        this.f21953b = application;
        this.f21954c = sharedPreferences;
        this.a = z;
        String a2 = org.acra.a.c().d().contains(ReportField.INITIAL_CONFIGURATION) ? org.acra.collector.c.a(this.f21953b) : null;
        Time time = new Time();
        time.setToNow();
        if (org.acra.collector.b.a() >= 14) {
            org.acra.k.a.a.a.d.d(application, new b());
        }
        this.f21956e = new org.acra.collector.d(this.f21953b, sharedPreferences, time, a2);
        this.f21958g = Thread.getDefaultUncaughtExceptionHandler();
        Thread.setDefaultUncaughtExceptionHandler(this);
    }

    @Deprecated
    public static g g() {
        return org.acra.a.d();
    }

    public void c(org.acra.sender.b bVar) {
        d();
        a(bVar);
    }

    public void d() {
        this.f21955d.clear();
    }

    public f e() {
        return new f();
    }

    public void f() {
        org.acra.b c2 = org.acra.a.c();
        Application b2 = org.acra.a.b();
        d();
        if (!"".equals(c2.mailTo())) {
            org.acra.l.a aVar = org.acra.a.f21900c;
            String str = org.acra.a.f21899b;
            aVar.w(str, b2.getPackageName() + " reports will be sent by email (if accepted by user).");
            c(new org.acra.sender.a(b2));
        } else if (!new org.acra.util.g(b2).a("android.permission.INTERNET")) {
            org.acra.l.a aVar2 = org.acra.a.f21900c;
            String str2 = org.acra.a.f21899b;
            aVar2.e(str2, b2.getPackageName() + " should be granted permission android.permission.INTERNET if you want your crash reports to be sent. If you don't want to add this permission to your application you can also enable sending reports by email. If this is your will then provide your email address in @ReportsCrashes(mailTo=\"your.account@domain.com\"");
        } else if (c2.formUri() == null || "".equals(c2.formUri())) {
        } else {
            c(new HttpSender(org.acra.a.c().httpMethod(), org.acra.a.c().reportType(), null));
        }
    }

    @Override
    public void uncaughtException(Thread thread, Throwable th) {
        try {
            if (!this.a) {
                if (this.f21958g != null) {
                    org.acra.l.a aVar = org.acra.a.f21900c;
                    String str = org.acra.a.f21899b;
                    aVar.e(str, "ACRA is disabled for " + this.f21953b.getPackageName() + " - forwarding uncaught Exception on to default ExceptionHandler");
                    this.f21958g.uncaughtException(thread, th);
                    return;
                }
                org.acra.l.a aVar2 = org.acra.a.f21900c;
                String str2 = org.acra.a.f21899b;
                aVar2.e(str2, "ACRA is disabled for " + this.f21953b.getPackageName() + " - no default ExceptionHandler");
                org.acra.l.a aVar3 = org.acra.a.f21900c;
                String str3 = org.acra.a.f21899b;
                aVar3.b(str3, "ACRA caught a " + th.getClass().getSimpleName() + " for " + this.f21953b.getPackageName(), th);
                return;
            }
            org.acra.l.a aVar4 = org.acra.a.f21900c;
            String str4 = org.acra.a.f21899b;
            aVar4.b(str4, "ACRA caught a " + th.getClass().getSimpleName() + " for " + this.f21953b.getPackageName(), th);
            org.acra.a.f21900c.d(org.acra.a.f21899b, "Building report");
            e().a(thread).a(th).a().c();
        } catch (Throwable unused) {
            Thread.UncaughtExceptionHandler uncaughtExceptionHandler = this.f21958g;
            if (uncaughtExceptionHandler != null) {
                uncaughtExceptionHandler.uncaughtException(thread, th);
            }
        }
    }

    public String b(String str, String str2) {
        return this.f21956e.a(str, str2);
    }

    public String b(String str) {
        return this.f21956e.b(str);
    }

    void c() {
        a(true, true, 0);
    }

    public void b() {
        this.f21956e.a();
    }

    public void b(org.acra.sender.b bVar) {
        this.f21955d.remove(bVar);
    }

    public void b(Throwable th) {
        if (this.a) {
            e().a(th).b().c();
            org.acra.a.f21900c.d(org.acra.a.f21899b, "ACRA sent Silent report.");
            return;
        }
        org.acra.a.f21900c.d(org.acra.a.f21899b, "ACRA is disabled. Silent report not sent.");
    }

    @Deprecated
    public void a(String str, String str2) {
        this.f21956e.a(str, str2);
    }

    public void a(h hVar) {
        if (hVar == null) {
            hVar = f21952k;
        }
        this.f21961j = hVar;
    }

    public String a(String str) {
        return this.f21956e.a(str);
    }

    public void a(org.acra.sender.b bVar) {
        this.f21955d.add(bVar);
    }

    public void b(boolean z) {
        org.acra.l.a aVar = org.acra.a.f21900c;
        String str = org.acra.a.f21899b;
        StringBuilder sb = new StringBuilder();
        sb.append("ACRA is ");
        sb.append(z ? "enabled" : "disabled");
        sb.append(" for ");
        sb.append(this.f21953b.getPackageName());
        aVar.i(str, sb.toString());
        this.a = z;
    }

    public void a(Class<?> cls) {
        if (org.acra.sender.b.class.isAssignableFrom(cls)) {
            for (org.acra.sender.b bVar : this.f21955d) {
                if (cls.isInstance(bVar)) {
                    this.f21955d.remove(bVar);
                }
            }
        }
    }

    private void b(String str, f fVar) {
        org.acra.b c2 = org.acra.a.c();
        Notification notification = new Notification(c2.resNotifIcon(), this.f21953b.getText(c2.resNotifTickerText()), System.currentTimeMillis());
        CharSequence text = this.f21953b.getText(c2.resNotifTitle());
        CharSequence text2 = this.f21953b.getText(c2.resNotifText());
        org.acra.a.f21900c.d(org.acra.a.f21899b, "Creating Notification for " + str);
        Intent a2 = a(str, fVar);
        Application application = this.f21953b;
        int i2 = l;
        l = i2 + 1;
        notification.setLatestEventInfo(this.f21953b, text, text2, PendingIntent.getActivity(application, i2, a2, 134217728));
        notification.flags |= 16;
        Intent a3 = a(str, fVar);
        a3.putExtra("FORCE_CANCEL", true);
        notification.deleteIntent = PendingIntent.getActivity(this.f21953b, -1, a3, 0);
        ((NotificationManager) this.f21953b.getSystemService(com.coloros.mcssdk.a.r)).notify(666, notification);
    }

    public void a(Thread thread, Throwable th) {
        boolean z = org.acra.a.c().mode() == ReportingInteractionMode.SILENT || (org.acra.a.c().mode() == ReportingInteractionMode.TOAST && org.acra.a.c().forceCloseDialogAfterToast());
        if ((thread != null) && z && this.f21958g != null) {
            org.acra.a.f21900c.d(org.acra.a.f21899b, "Handing Exception on to default ExceptionHandler");
            this.f21958g.uncaughtException(thread, th);
            return;
        }
        org.acra.l.a aVar = org.acra.a.f21900c;
        String str = org.acra.a.f21899b;
        aVar.b(str, this.f21953b.getPackageName() + " fatal error : " + th.getMessage(), th);
        Activity activity = this.f21959h.get();
        if (activity != null) {
            org.acra.a.f21900c.i(org.acra.a.f21899b, "Finishing the last Activity prior to killing the Process");
            activity.finish();
            org.acra.l.a aVar2 = org.acra.a.f21900c;
            String str2 = org.acra.a.f21899b;
            aVar2.i(str2, "Finished " + activity.getClass());
            this.f21959h.clear();
        }
        Process.killProcess(Process.myPid());
        System.exit(10);
    }

    public i a(boolean z, boolean z2) {
        i iVar = new i(this.f21953b, this.f21955d, z, z2);
        iVar.start();
        return iVar;
    }

    public void a() {
        if (org.acra.a.c().deleteOldUnsentReportsOnApplicationStart()) {
            long j2 = this.f21954c.getInt(org.acra.a.f21907j, 0);
            PackageInfo a2 = new org.acra.util.g(this.f21953b).a();
            if (a2 != null) {
                if (((long) a2.versionCode) > j2) {
                    c();
                }
                SharedPreferences.Editor edit = this.f21954c.edit();
                edit.putInt(org.acra.a.f21907j, a2.versionCode);
                edit.commit();
            }
        }
        ReportingInteractionMode mode = org.acra.a.c().mode();
        if ((mode == ReportingInteractionMode.NOTIFICATION || mode == ReportingInteractionMode.DIALOG) && org.acra.a.c().deleteUnapprovedReportsOnApplicationStart()) {
            a(true);
        }
        String[] a3 = new org.acra.e(this.f21953b).a();
        if (a3 == null || a3.length <= 0) {
            return;
        }
        boolean a4 = a(a3);
        if (mode != ReportingInteractionMode.SILENT && mode != ReportingInteractionMode.TOAST) {
            if (!a4) {
                return;
            }
            if (mode != ReportingInteractionMode.NOTIFICATION && mode != ReportingInteractionMode.DIALOG) {
                return;
            }
        }
        if (mode == ReportingInteractionMode.TOAST && !a4) {
            k.a(this.f21953b, org.acra.a.c().resToastText(), 1);
        }
        org.acra.a.f21900c.v(org.acra.a.f21899b, "About to start ReportSenderWorker from #checkReportOnApplicationStart");
        a(false, false);
    }

    public void a(boolean z) {
        a(false, true, z ? 1 : 0);
    }

    public void a(Throwable th, boolean z) {
        f a2 = e().a(th);
        if (z) {
            a2.a();
        }
        a2.c();
    }

    public void a(Throwable th) {
        e().a(th).c();
    }

    public void a(f fVar) {
        ReportingInteractionMode reportingInteractionMode;
        boolean z;
        boolean z2;
        if (this.a) {
            try {
                this.f21961j.a(this);
            } catch (Exception unused) {
                org.acra.l.a aVar = org.acra.a.f21900c;
                String str = org.acra.a.f21899b;
                aVar.d(str, "Failed to initlize " + this.f21961j + " from #handleException");
            }
            if (!fVar.f21971e) {
                reportingInteractionMode = org.acra.a.c().mode();
            } else {
                reportingInteractionMode = ReportingInteractionMode.SILENT;
                if (org.acra.a.c().mode() != ReportingInteractionMode.SILENT) {
                    z = true;
                    z2 = reportingInteractionMode != ReportingInteractionMode.TOAST || (org.acra.a.c().resToastText() != 0 && (reportingInteractionMode == ReportingInteractionMode.NOTIFICATION || reportingInteractionMode == ReportingInteractionMode.DIALOG));
                    i iVar = null;
                    C0399g c0399g = new C0399g(null);
                    if (z2) {
                        new c(c0399g).start();
                    }
                    CrashReportData a2 = this.f21956e.a(fVar.a, fVar.f21969c, fVar.f21970d, fVar.f21971e, fVar.f21968b);
                    String a3 = a(a2);
                    a(a3, a2);
                    if (fVar.f21972f && !org.acra.a.c().sendReportsAtShutdown()) {
                        a(fVar.f21968b, fVar.f21969c);
                    }
                    if (reportingInteractionMode == ReportingInteractionMode.SILENT && reportingInteractionMode != ReportingInteractionMode.TOAST && !this.f21954c.getBoolean(org.acra.a.f21906i, false)) {
                        if (reportingInteractionMode == ReportingInteractionMode.NOTIFICATION) {
                            org.acra.a.f21900c.d(org.acra.a.f21899b, "Creating Notification.");
                            b(a3, fVar);
                        }
                    } else {
                        org.acra.a.f21900c.d(org.acra.a.f21899b, "About to start ReportSenderWorker from #handleException");
                        iVar = a(z, true);
                        if (reportingInteractionMode == ReportingInteractionMode.SILENT && !fVar.f21972f) {
                            return;
                        }
                    }
                    i iVar2 = iVar;
                    this.f21960i = true;
                    if (z2) {
                        this.f21960i = false;
                        new d(c0399g).start();
                    }
                    new e(iVar2, (reportingInteractionMode == ReportingInteractionMode.DIALOG || this.f21954c.getBoolean(org.acra.a.f21906i, false)) ? false : true, a3, fVar).start();
                }
            }
            z = false;
            if (reportingInteractionMode != ReportingInteractionMode.TOAST) {
            }
            i iVar3 = null;
            C0399g c0399g2 = new C0399g(null);
            if (z2) {
            }
            CrashReportData a22 = this.f21956e.a(fVar.a, fVar.f21969c, fVar.f21970d, fVar.f21971e, fVar.f21968b);
            String a32 = a(a22);
            a(a32, a22);
            if (fVar.f21972f) {
                a(fVar.f21968b, fVar.f21969c);
            }
            if (reportingInteractionMode == ReportingInteractionMode.SILENT) {
            }
            org.acra.a.f21900c.d(org.acra.a.f21899b, "About to start ReportSenderWorker from #handleException");
            iVar3 = a(z, true);
            if (reportingInteractionMode == ReportingInteractionMode.SILENT) {
                return;
            }
            i iVar22 = iVar3;
            this.f21960i = true;
            if (z2) {
            }
            new e(iVar22, (reportingInteractionMode == ReportingInteractionMode.DIALOG || this.f21954c.getBoolean(org.acra.a.f21906i, false)) ? false : true, a32, fVar).start();
        }
    }

    public Intent a(String str, f fVar) {
        org.acra.l.a aVar = org.acra.a.f21900c;
        String str2 = org.acra.a.f21899b;
        aVar.d(str2, "Creating DialogIntent for " + str + " exception=" + fVar.f21969c);
        Intent intent = new Intent(this.f21953b, org.acra.a.c().reportDialogClass());
        intent.putExtra(org.acra.c.f21912e, str);
        intent.putExtra(org.acra.c.f21913f, fVar.f21969c);
        return intent;
    }

    private String a(CrashReportData crashReportData) {
        Time time = new Time();
        time.setToNow();
        long millis = time.toMillis(false);
        String property = crashReportData.getProperty(ReportField.IS_SILENT);
        StringBuilder sb = new StringBuilder();
        sb.append("");
        sb.append(millis);
        sb.append(property != null ? org.acra.c.f21910c : "");
        sb.append(org.acra.c.a);
        return sb.toString();
    }

    private void a(String str, CrashReportData crashReportData) {
        try {
            org.acra.l.a aVar = org.acra.a.f21900c;
            String str2 = org.acra.a.f21899b;
            aVar.d(str2, "Writing crash report file " + str + ".");
            new org.acra.f(this.f21953b).a(crashReportData, str);
        } catch (Exception e2) {
            org.acra.a.f21900c.b(org.acra.a.f21899b, "An error occurred while writing the report file...", e2);
        }
    }

    private void a(boolean z, boolean z2, int i2) {
        String[] a2 = new org.acra.e(this.f21953b).a();
        Arrays.sort(a2);
        for (int i3 = 0; i3 < a2.length - i2; i3++) {
            String str = a2[i3];
            boolean a3 = this.f21957f.a(str);
            if ((a3 && z) || (!a3 && z2)) {
                File file = new File(this.f21953b.getFilesDir(), str);
                org.acra.l.a aVar = org.acra.a.f21900c;
                String str2 = org.acra.a.f21899b;
                aVar.d(str2, "Deleting file " + str);
                if (!file.delete()) {
                    org.acra.l.a aVar2 = org.acra.a.f21900c;
                    String str3 = org.acra.a.f21899b;
                    aVar2.e(str3, "Could not delete report : " + file);
                }
            }
        }
    }

    private boolean a(String[] strArr) {
        for (String str : strArr) {
            if (!this.f21957f.a(str)) {
                return false;
            }
        }
        return true;
    }
}