/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  javax.microedition.io.HttpConnection
 */
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import javax.microedition.io.HttpConnection;

/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public class px
implements Runnable,
jf,
pf,
w {
    public volatile boolean h;
    private final w a;
    private final HttpConnection a;
    public final aa b;
    public final Object i;
    private int a;
    private ej d;
    private ji e;
    private String g;
    private lh j;
    public long b;
    public boolean c;
    public iv d;
    public int e;
    public int f;
    public boolean g;

    public boolean d() {
        return false;
    }

    public boolean c() {
        return false;
    }

    public boolean z_() {
        return false;
    }

    public boolean A_() {
        return false;
    }

    public boolean e() {
        return true;
    }

    public String b() {
        return null;
    }

    public DataInputStream b() {
        return this.a.openDataInputStream();
    }

    public DataOutputStream a() {
        return this.a.openDataOutputStream();
    }

    public int d() {
        return this.a.getResponseCode();
    }

    public int c() {
        return this.a.c();
    }

    public int l() {
        return this.a.l();
    }

    public int t() {
        return this.a.t();
    }

    public void f() {
        this.a.close();
    }

    public long c() {
        return this.a.getLength();
    }

    public String e() {
        return this.a.getHeaderField("Content-Type");
    }

    public void a(String string, String string2) {
        this.a.setRequestProperty(string, string2);
    }

    private px(iv iv2, int n, int n2, ej ej2, ji ji2, lh lh2, String string, int n3, boolean bl2) {
        this.d = iv2;
        this.e = n;
        this.f = n2;
        this.d = ej2;
        this.e = ji2;
        this.j = lh2;
        this.g = string;
        this.a = n3;
        this.h = bl2;
        this.b = System.currentTimeMillis();
    }

    public final void a(iv iv2, int n, int n2, int n3) {
        iv iv3 = this.d;
        this.d = iv2;
        this.e = n;
        this.f = n2;
        this.a = n3;
        this.b = System.currentTimeMillis();
        this.g = true;
        lh lh2 = this.j;
        synchronized (lh2) {
            this.j.a(iv3, this);
            return;
        }
    }

    /*
     * WARNING - void declaration
     */
    public px(lh lh2, boolean bl2, boolean bl3) {
        void var3_4;
        this.h = true;
        this.i = new Object();
        this.j = lh2;
        this.g = bl2;
        this.c = var3_4;
        this.h();
        this.d = new iv(0, 0);
        this.b = 0L;
        DataInput dataInput = nz.c(this.m());
        if (dataInput != null) {
            try {
                long l = dataInput.readLong();
                if (System.currentTimeMillis() - l < 720000L) {
                    int n = dataInput.readInt();
                    this.d = iv.a(dataInput);
                    this.b = l;
                    this.a = n;
                }
            }
            catch (IOException iOException) {}
            lh.k().f().a(this.m(), null);
        }
    }

    public final synchronized void k() {
        if (!this.h) {
            this.h = true;
            Object object = this.i;
            synchronized (object) {
                this.i.notifyAll();
            }
            this.c();
            if (this.j()) {
                ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                object = new DataOutputStream(byteArrayOutputStream);
                try {
                    object.writeLong(this.b);
                    object.writeInt(this.a);
                    iv.a(this.d, (DataOutput)object);
                    lh.k().f().a(this.m(), byteArrayOutputStream.toByteArray());
                    return;
                }
                catch (IOException iOException) {}
            }
        }
    }

    /*
     * Exception decompiling
     */
    public px a(String var1_1, boolean var2_2) {
        /*
         * This method has failed to decompile.  When submitting a bug report, please provide this stack trace, and (if you hold appropriate legal rights) the relevant class file.
         * 
         * org.benf.cfr.reader.util.ConfusedCFRException: Back jump on a try block [egrp 0[TRYBLOCK] [1 : 14->222)] java.lang.Throwable
         *     at org.benf.cfr.reader.bytecode.analysis.opgraph.Op02WithProcessedDataAndRefs.insertExceptionBlocks(Op02WithProcessedDataAndRefs.java:2283)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisInner(CodeAnalyser.java:415)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysisOrWrapFail(CodeAnalyser.java:278)
         *     at org.benf.cfr.reader.bytecode.CodeAnalyser.getAnalysis(CodeAnalyser.java:201)
         *     at org.benf.cfr.reader.entities.attributes.AttributeCode.analyse(AttributeCode.java:94)
         *     at org.benf.cfr.reader.entities.Method.analyse(Method.java:531)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseMid(ClassFile.java:1055)
         *     at org.benf.cfr.reader.entities.ClassFile.analyseTop(ClassFile.java:942)
         *     at org.benf.cfr.reader.Driver.doJarVersionTypes(Driver.java:257)
         *     at org.benf.cfr.reader.Driver.doJar(Driver.java:139)
         *     at org.benf.cfr.reader.CfrDriverImpl.analyse(CfrDriverImpl.java:76)
         *     at org.benf.cfr.reader.Main.main(Main.java:54)
         */
        throw new IllegalStateException("Decompilation failed");
    }

    public void a(DataOutput dataOutput) {
        lk lk2 = new lk(kn.a);
        lk2.h(1, 1);
        lk lk3 = new lk(ky.u);
        lk2.b(2, lk3);
        lk lk4 = new lk(ky.l);
        String string = kw.a();
        if (!ed.b(string)) {
            lk4.b(3, string);
        }
        if (this.d.e()) {
            lk4.b(6, this.d.f());
        }
        if (this.e.b()) {
            lk4.b(7, this.e.c());
        }
        lk3.b(1, lk4);
        lk4 = new lk(ky.m);
        lk4.h(3, this.f);
        if (this.f == 2) {
            lk4.h(4, this.a);
            string = this.g == null ? "" : this.g;
            lk4.b(5, string);
        }
        if (this.e > 0) {
            lk4.h(6, this.e);
        }
        lk3.a(2, lk4);
        lk4 = new lk(ky.t);
        if (this.d.e()) {
            lk4.b(1, this.d.g());
        }
        if (this.e.b()) {
            lk4.b(2, this.e.d());
        }
        lk lk5 = new lk(ky.h);
        if (this.j != null) {
            lk5.b(2, this.j.d());
            lk5.h(3, this.j.f());
            lk5.b(6, this.b);
            lk5.h(12, this.j.e());
            lk5.h(13, this.j.c());
        }
        lk lk6 = new lk(ky.y);
        lk6.h(1, this.d.a * 10);
        lk6.h(2, this.d.b * 10);
        lk5.b(1, lk6);
        int n = this.j == null ? 1 : 0;
        lk5.h(8, n);
        lk4.b(3, lk5);
        lk3.a(4, lk4);
        dataOutput.writeInt(lk2.b());
        lk2.a((OutputStream)((Object)dataOutput));
    }

    public ej a() {
        int n = px.a("cellid", 16);
        if (n != -1) {
            String string = System.getProperty("com.lge.net.rat");
            int n2 = string != null ? ("GSM".equals(string) ? 3 : 5) : -1;
            int n3 = px.a("lac", 16);
            int n4 = px.a("hmnc", 10);
            int n5 = px.a("cmnc", 10);
            int n6 = px.a("hmcc", 10);
            return ej.a(null, n2, n, n3, -1, px.a("cmcc", 10), n5, n6, n4, -1);
        }
        ej.b();
        return ej.d();
    }

    public px(HttpConnection httpConnection, boolean bl2) {
        this.a = httpConnection;
        String string = bl2 ? "POST" : "GET";
        httpConnection.setRequestMethod(string);
    }

    public void c() {
        if (lh.r() && !this.c) {
            int n = this.e == 2 ? 1 : 2;
            this.e = n;
        }
    }

    public boolean a() {
        if (!this.h) {
            boolean bl2 = this.b.g("NetWorks") != null;
            this.h = true;
            this.g = bl2;
        }
        return this.g;
    }

    public synchronized boolean a(boolean bl2) {
        this.c = true;
        if (this.a() && !bl2) {
            return false;
        }
        this.g = true;
        this.b.a("NetWorks", new byte[]{0});
        return true;
    }

    public final int i() {
        if (this.g && System.currentTimeMillis() - this.b > 720000L) {
            this.h();
        }
        if (this.g) {
            return this.a;
        }
        return 99999;
    }

    public final boolean j() {
        return this.i() < 99999;
    }

    public final synchronized void l() {
        if (this.h) {
            this.h = false;
            new Thread(this).start();
        }
    }

    public void a(int n) {
        lh lh2 = this.j;
        synchronized (lh2) {
            this.j.a(n, this);
            return;
        }
    }

    public static w a(w w2) {
        if ("ja".equals(lh.o())) {
            return new px(w2);
        }
        return w2;
    }

    public void run() {
        try {
            this.a();
            return;
        }
        catch (SecurityException securityException) {
            this.a(3);
            return;
        }
    }

    public final void h() {
        this.a = 99999;
    }

    private String m() {
        return "LastLocation_" + this.getClass().getName();
    }

    private static int a(String string, int n) {
        return nz.a("com.lge.net." + string, n);
    }

    public int a(String string) {
        return this.a.a(az.a(string));
    }

    public int a(String string, int n, int n2) {
        return this.a.a(az.a(string.substring(n, n + n2)));
    }

    public int d(char c) {
        String string = String.valueOf(c);
        return this.a.a(az.a(string));
    }

    public void a(ht ht2, String string, int n, int n2) {
        this.a.a(ht2, az.a(string), n, n2);
    }

    public void i(int n) {
        this.a.i(n);
    }

    public String a(int n) {
        return this.a.getHeaderFieldKey(n);
    }

    public String b(int n) {
        return this.a.getHeaderField(n);
    }

    private px(w w2) {
        this.a = w2;
    }

    public px(boolean bl2) {
        this.b = lh.k().f();
    }

    public px(boolean bl2, boolean bl3) {
    }

    public px() {
        this(false);
        this.i = new Object();
        this.e = 1;
    }

    public void a() {
    }

    public static void a(lh lh2) {
        px.a(3, lh2, null, 0, lh2.m(), 0, false);
    }

    public static void a(lh lh2, boolean bl2) {
        px.a(4, lh2, null, 0, lh2.m(), 0, bl2);
    }

    public static void a(iv iv2, int n) {
        px.a(7, null, null, 0, iv2, n, false);
    }

    public static void a(String string, int n, iv iv2, int n2) {
        px.a(2, null, string, n, iv2, n2, false);
    }

    private static void a(int n, lh lh2, String string, int n2, iv iv2, int n3, boolean bl2) {
        new oz(lh2, iv2, n3, n, string, n2, bl2).run();
    }

    public void a(ht ht2, String string, int n, int n2, int n3, int n4) {
        this.a(ht2, string.substring(n, n + n2), n3, n4);
    }

    public boolean a(DataInput dataInput) {
        lk lk2 = new lk(kn.b);
        lk2.a((InputStream)((Object)dataInput), dataInput.readInt());
        switch (lk2.d(1)) {
            case 0: {
                if (!lk2.h(2) || !(lk2 = lk2.f(2)).h(3)) break;
                kw.a(lk2.g(3));
            }
        }
        return true;
    }

    static {
        String[] stringArray = new String[]{"TLS", "SSL"};
    }

    public px(iv iv2, int n, int n2, ej ej2, ji ji2, lh lh2, String string, int n3, boolean bl2, oz oz2) {
        this(iv2, n, n2, ej2, ji2, lh2, string, n3, bl2);
    }

    public boolean f() {
        return this.g;
    }

    public boolean b() {
        return this.c;
    }

    public boolean y_() {
        return this.h;
    }

    public int z() {
        return 41;
    }
}

