package com.tencent.mm.plugin.ipcall.a.g;

import android.database.Cursor;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.cd.g;
import com.tencent.mm.cd.g.a;
import com.tencent.mm.sdk.e.e;
import com.tencent.mm.sdk.e.n;
import com.tencent.mm.sdk.platformtools.ab;

public final class j extends com.tencent.mm.sdk.e.j<i> implements a {
    public static final String[] fnj = new String[]{com.tencent.mm.sdk.e.j.a(i.ccO, "IPCallPopularCountry")};
    private e bSd;
    public n gvC = new 1(this);

    static {
        AppMethodBeat.i(21941);
        AppMethodBeat.o(21941);
    }

    public j(e eVar) {
        super(eVar, i.ccO, "IPCallPopularCountry", null);
        AppMethodBeat.i(21938);
        this.bSd = eVar;
        AppMethodBeat.o(21938);
    }

    public final String getTableName() {
        return "IPCallPopularCountry";
    }

    public final int a(g gVar) {
        this.bSd = gVar;
        return 0;
    }

    public final void O(int i, long j) {
        boolean a;
        AppMethodBeat.i(21939);
        i iVar = new i();
        Cursor a2 = this.bSd.a("IPCallPopularCountry", null, "countryCode=?", new String[]{Integer.toString(i)}, null, null, null, 2);
        if (a2.moveToFirst()) {
            iVar.d(a2);
            iVar.field_callTimeCount++;
            iVar.field_lastCallTime = j;
            a = super.a(iVar);
            a2.close();
        } else {
            ab.i("MicroMsg.IPCallPopularCountryStorage", "get null with countryCode:".concat(String.valueOf(i)));
            a2.close();
            iVar.field_countryCode = i;
            iVar.field_lastCallTime = j;
            iVar.field_callTimeCount = 1;
            a = b(iVar);
        }
        ab.i("MicroMsg.IPCallPopularCountryStorage", "updatePopularCountryCode ret:".concat(String.valueOf(a)));
        AppMethodBeat.o(21939);
    }

    /* JADX WARNING: Removed duplicated region for block: B:8:0x0057  */
    public final java.util.ArrayList<java.lang.Integer> bIa() {
        /*
        r6 = this;
        r5 = 21940; // 0x55b4 float:3.0744E-41 double:1.084E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r5);
        r0 = new java.util.ArrayList;
        r0.<init>();
        r1 = new java.lang.StringBuilder;
        r1.<init>();
        r2 = " ORDER BY IPCallPopularCountry.callTimeCount DESC,IPCallPopularCountry.lastCallTime DESC";
        r1.append(r2);
        r2 = r6.bSd;
        r3 = new java.lang.StringBuilder;
        r4 = "SELECT IPCallPopularCountry.countryCode,IPCallPopularCountry.callTimeCount,IPCallPopularCountry.lastCallTime FROM IPCallPopularCountry  ";
        r3.<init>(r4);
        r1 = r1.toString();
        r1 = r3.append(r1);
        r1 = r1.toString();
        r3 = 0;
        r4 = 2;
        r1 = r2.a(r1, r3, r4);
        if (r1 == 0) goto L_0x0055;
    L_0x0033:
        r2 = r1.moveToFirst();
        if (r2 == 0) goto L_0x0055;
    L_0x0039:
        r2 = new java.util.ArrayList;
        r2.<init>();
    L_0x003e:
        r2 = new com.tencent.mm.plugin.ipcall.a.g.i;
        r2.<init>();
        r2.d(r1);
        r2 = r2.field_countryCode;
        r2 = java.lang.Integer.valueOf(r2);
        r0.add(r2);
        r2 = r1.moveToNext();
        if (r2 != 0) goto L_0x003e;
    L_0x0055:
        if (r1 == 0) goto L_0x005a;
    L_0x0057:
        r1.close();
    L_0x005a:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        return r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.plugin.ipcall.a.g.j.bIa():java.util.ArrayList");
    }
}
