- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
99 lines
3.3 KiB
Java
99 lines
3.3 KiB
Java
package com.mbridge.msdk.foundation.db;
|
|
|
|
import android.content.ContentValues;
|
|
import android.database.Cursor;
|
|
import com.vungle.ads.internal.signals.SignalManager;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class j extends a<com.mbridge.msdk.foundation.entity.g> {
|
|
private static j a;
|
|
|
|
private j(f fVar) {
|
|
super(fVar);
|
|
}
|
|
|
|
public static j a(f fVar) {
|
|
if (a == null) {
|
|
synchronized (j.class) {
|
|
try {
|
|
if (a == null) {
|
|
a = new j(fVar);
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
return a;
|
|
}
|
|
|
|
public final synchronized void a() {
|
|
try {
|
|
long currentTimeMillis = System.currentTimeMillis() - SignalManager.TWENTY_FOUR_HOURS_MILLIS;
|
|
com.mbridge.msdk.foundation.db.a.a.a().a(currentTimeMillis);
|
|
String[] strArr = {String.valueOf(currentTimeMillis)};
|
|
if (getWritableDatabase() != null) {
|
|
getWritableDatabase().delete("frequence", "ts< ? ", strArr);
|
|
}
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
|
|
public final synchronized void a(String str) {
|
|
com.mbridge.msdk.foundation.db.a.a.a().a(str);
|
|
if (b(str) && getReadableDatabase() != null) {
|
|
getReadableDatabase().execSQL("UPDATE frequence Set impression_count=impression_count+1 WHERE id= ?", new Object[]{str});
|
|
}
|
|
}
|
|
|
|
public final synchronized boolean b(String str) {
|
|
Cursor cursor = null;
|
|
try {
|
|
try {
|
|
synchronized (str) {
|
|
Cursor rawQuery = getReadableDatabase().rawQuery("SELECT id FROM frequence WHERE id= ?", new String[]{str});
|
|
if (rawQuery != null && rawQuery.getCount() > 0) {
|
|
rawQuery.close();
|
|
return true;
|
|
}
|
|
if (rawQuery != null) {
|
|
rawQuery.close();
|
|
}
|
|
return false;
|
|
}
|
|
} catch (Exception unused) {
|
|
return false;
|
|
}
|
|
} finally {
|
|
if (0 != 0) {
|
|
cursor.close();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final synchronized void a(com.mbridge.msdk.foundation.entity.g gVar) {
|
|
if (!b(gVar.a())) {
|
|
b(gVar);
|
|
}
|
|
}
|
|
|
|
private synchronized long b(com.mbridge.msdk.foundation.entity.g gVar) {
|
|
try {
|
|
com.mbridge.msdk.foundation.db.a.a.a().a(gVar);
|
|
ContentValues contentValues = new ContentValues();
|
|
contentValues.put("id", gVar.a());
|
|
contentValues.put("fc_a", Integer.valueOf(gVar.c()));
|
|
contentValues.put("fc_b", Integer.valueOf(gVar.d()));
|
|
contentValues.put("ts", Long.valueOf(gVar.f()));
|
|
contentValues.put("impression_count", Integer.valueOf(gVar.e()));
|
|
contentValues.put("click_count", Integer.valueOf(gVar.b()));
|
|
contentValues.put("ts", Long.valueOf(gVar.f()));
|
|
if (getWritableDatabase() == null) {
|
|
return -1L;
|
|
}
|
|
return getWritableDatabase().insert("frequence", null, contentValues);
|
|
} catch (Exception unused) {
|
|
return -1L;
|
|
}
|
|
}
|
|
}
|