package com.apm.insight.e;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.apm.insight.e;

/* JADX INFO: loaded from: classes.dex */
public class a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private static volatile a f5154a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private com.apm.insight.e.a.b f5155b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private SQLiteDatabase f5156c;

    private a() {
    }

    public static a a() {
        if (f5154a == null) {
            synchronized (a.class) {
                try {
                    if (f5154a == null) {
                        f5154a = new a();
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        return f5154a;
    }

    private void b() {
        if (this.f5155b == null) {
            a(e.g());
        }
    }

    public final synchronized void a(Context context) {
        try {
            this.f5156c = new b(context).getWritableDatabase();
        } catch (Throwable th) {
            com.apm.insight.a.b(th);
        }
        this.f5155b = new com.apm.insight.e.a.b();
    }

    public final synchronized void a(com.apm.insight.d.a aVar) {
        b();
        com.apm.insight.e.a.b bVar = this.f5155b;
        if (bVar != null) {
            bVar.a(this.f5156c, aVar);
        }
    }

    public final synchronized boolean a(String str) {
        b();
        com.apm.insight.e.a.b bVar = this.f5155b;
        if (bVar == null) {
            return false;
        }
        return bVar.a(this.f5156c, str);
    }
}
