导航菜单

页面标题

页面副标题

Tasker v6.5.11 - f.java 源代码

正在查看: Tasker v6.5.11 应用的 f.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package al;

import dl.f;
import dl.n;
import el.m;
import hk.o;
import java.io.IOException;
import java.lang.ref.Reference;
import java.net.ConnectException;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketException;
import java.security.cert.Certificate;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLPeerUnverifiedException;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import jl.j0;
import jl.z0;
import kotlin.collections.r;
import net.dinglisch.android.taskerm.c6;
import vk.a0;
import vk.b0;
import vk.d0;
import vk.f0;
import vk.l;
import vk.t;
import vk.v;
import vk.z;
import yj.p;
import yj.q;

public final class f extends f.c implements vk.j {
    public static final a t = new a(null);
    private final g c;
    private final f0 d;
    private Socket e;
    private Socket f;
    private t g;
    private a0 h;
    private dl.f i;
    private jl.g j;
    private jl.f k;
    private boolean l;
    private boolean m;
    private int n;
    private int o;
    private int p;
    private int q;
    private final List<Reference<e>> r;
    private long s;

    public static final class a {
        public a(yj.h hVar) {
            this();
        }

        private a() {
        }
    }

    public class b {
        public static final int[] a;

        static {
            int[] iArr = new int[Proxy.Type.values().length];
            try {
                iArr[Proxy.Type.DIRECT.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                iArr[Proxy.Type.HTTP.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            a = iArr;
        }
    }

    static final class c extends q implements xj.a<List<? extends Certificate>> {
        final vk.g i;
        final t q;
        final vk.a r;

        c(vk.g gVar, t tVar, vk.a aVar) {
            super(0);
            this.i = gVar;
            this.q = tVar;
            this.r = aVar;
        }

        @Override
        public final List<? extends Certificate> invoke() {
            hl.c d = this.i.d();
            p.f(d);
            return d.a(this.q.d(), this.r.l().i());
        }
    }

    static final class d extends q implements xj.a<List<? extends X509Certificate>> {
        d() {
            super(0);
        }

        @Override
        public final List<? extends X509Certificate> invoke() {
            t tVar = f.this.g;
            p.f(tVar);
            List<Certificate> d = tVar.d();
            ArrayList arrayList = new ArrayList(r.v(d, 10));
            for (Certificate certificate : d) {
                p.g(certificate, "null cannot be cast to non-null type java.security.cert.X509Certificate");
                arrayList.add((X509Certificate) certificate);
            }
            return arrayList;
        }
    }

    public f(g gVar, f0 f0Var) {
        p.i(gVar, "connectionPool");
        p.i(f0Var, "route");
        this.c = gVar;
        this.d = f0Var;
        this.q = 1;
        this.r = new ArrayList();
        this.s = Long.MAX_VALUE;
    }

    private final boolean B(List<f0> list) {
        if ((list instanceof Collection) && list.isEmpty()) {
            return false;
        }
        for (f0 f0Var : list) {
            Proxy.Type type = f0Var.b().type();
            Proxy.Type type2 = Proxy.Type.DIRECT;
            if (type == type2 && this.d.b().type() == type2 && p.d(this.d.d(), f0Var.d())) {
                return true;
            }
        }
        return false;
    }

    private final void F(int i) throws IOException {
        Socket socket = this.f;
        p.f(socket);
        jl.g gVar = this.j;
        p.f(gVar);
        jl.f fVar = this.k;
        p.f(fVar);
        socket.setSoTimeout(0);
        dl.f a2 = new f.a(true, zk.e.i).q(socket, this.d.a().l().i(), gVar, fVar).k(this).l(i).a();
        this.i = a2;
        this.q = dl.f.R.a().d();
        dl.f.d1(a2, false, null, 3, null);
    }

    private final boolean G(v vVar) {
        t tVar;
        if (wk.d.h && !Thread.holdsLock(this)) {
            throw new AssertionError("Thread " + Thread.currentThread().getName() + " MUST hold lock on " + this);
        }
        v l = this.d.a().l();
        if (vVar.n() != l.n()) {
            return false;
        }
        if (p.d(vVar.i(), l.i())) {
            return true;
        }
        if (this.m || (tVar = this.g) == null) {
            return false;
        }
        p.f(tVar);
        return f(vVar, tVar);
    }

    private final boolean f(v vVar, t tVar) {
        List<Certificate> d2 = tVar.d();
        if (d2.isEmpty()) {
            return false;
        }
        hl.d dVar = hl.d.a;
        String i = vVar.i();
        Certificate certificate = d2.get(0);
        p.g(certificate, "null cannot be cast to non-null type java.security.cert.X509Certificate");
        return dVar.e(i, (X509Certificate) certificate);
    }

    private final void i(int i, int i2, vk.e eVar, vk.r rVar) throws IOException {
        Socket createSocket;
        Proxy b2 = this.d.b();
        vk.a a2 = this.d.a();
        Proxy.Type type = b2.type();
        int i3 = type == null ? -1 : b.a[type.ordinal()];
        if (i3 == 1 || i3 == 2) {
            createSocket = a2.j().createSocket();
            p.f(createSocket);
        } else {
            createSocket = new Socket(b2);
        }
        this.e = createSocket;
        rVar.i(eVar, this.d.d(), b2);
        createSocket.setSoTimeout(i2);
        try {
            m.a.g().f(createSocket, this.d.d(), i);
            try {
                this.j = j0.c(j0.k(createSocket));
                this.k = j0.b(j0.g(createSocket));
            } catch (NullPointerException e) {
                if (p.d(e.getMessage(), "throw with null exception")) {
                    throw new IOException(e);
                }
            }
        } catch (ConnectException e2) {
            ConnectException connectException = new ConnectException("Failed to connect to " + this.d.d());
            connectException.initCause(e2);
            throw connectException;
        }
    }

    private final void j(al.b bVar) throws IOException {
        SSLSocket sSLSocket;
        vk.a a2 = this.d.a();
        SSLSocketFactory k = a2.k();
        SSLSocket sSLSocket2 = null;
        try {
            p.f(k);
            Socket createSocket = k.createSocket(this.e, a2.l().i(), a2.l().n(), true);
            p.g(createSocket, "null cannot be cast to non-null type javax.net.ssl.SSLSocket");
            sSLSocket = (SSLSocket) createSocket;
        } catch (Throwable th2) {
            th = th2;
        }
        try {
            l a3 = bVar.a(sSLSocket);
            if (a3.h()) {
                m.a.g().e(sSLSocket, a2.l().i(), a2.f());
            }
            sSLSocket.startHandshake();
            SSLSession session = sSLSocket.getSession();
            t.a aVar = t.e;
            p.h(session, "sslSocketSession");
            t a4 = aVar.a(session);
            HostnameVerifier e = a2.e();
            p.f(e);
            if (e.verify(a2.l().i(), session)) {
                vk.g a5 = a2.a();
                p.f(a5);
                this.g = new t(a4.e(), a4.a(), a4.c(), new c(a5, a4, a2));
                a5.b(a2.l().i(), new d());
                String g = a3.h() ? m.a.g().g(sSLSocket) : null;
                this.f = sSLSocket;
                this.j = j0.c(j0.k(sSLSocket));
                this.k = j0.b(j0.g(sSLSocket));
                this.h = g != null ? a0.q.a(g) : a0.HTTP_1_1;
                m.a.g().b(sSLSocket);
                return;
            }
            List<Certificate> d2 = a4.d();
            if (d2.isEmpty()) {
                throw new SSLPeerUnverifiedException("Hostname " + a2.l().i() + " not verified (no certificates)");
            }
            Certificate certificate = d2.get(0);
            p.g(certificate, "null cannot be cast to non-null type java.security.cert.X509Certificate");
            X509Certificate x509Certificate = (X509Certificate) certificate;
            throw new SSLPeerUnverifiedException(o.i("\n              |Hostname " + a2.l().i() + " not verified:\n              |    certificate: " + vk.g.c.a(x509Certificate) + "\n              |    DN: " + x509Certificate.getSubjectDN().getName() + "\n              |    subjectAltNames: " + hl.d.a.a(x509Certificate) + "\n              ", null, 1, null));
        } catch (Throwable th3) {
            th = th3;
            sSLSocket2 = sSLSocket;
            if (sSLSocket2 != null) {
                m.a.g().b(sSLSocket2);
            }
            if (sSLSocket2 != null) {
                wk.d.n(sSLSocket2);
            }
            throw th;
        }
    }

    private final void k(int i, int i2, int i3, vk.e eVar, vk.r rVar) throws IOException {
        b0 m = m();
        v j = m.j();
        for (int i4 = 0; i4 < 21; i4++) {
            i(i, i2, eVar, rVar);
            m = l(i2, i3, m, j);
            if (m == null) {
                return;
            }
            Socket socket = this.e;
            if (socket != null) {
                wk.d.n(socket);
            }
            this.e = null;
            this.k = null;
            this.j = null;
            rVar.g(eVar, this.d.d(), this.d.b(), null);
        }
    }

    private final b0 l(int i, int i2, b0 b0Var, v vVar) throws IOException {
        String str = "CONNECT " + wk.d.Q(vVar, true) + " HTTP/1.1";
        while (true) {
            jl.g gVar = this.j;
            p.f(gVar);
            jl.f fVar = this.k;
            p.f(fVar);
            cl.b bVar = new cl.b(null, this, gVar, fVar);
            TimeUnit timeUnit = TimeUnit.MILLISECONDS;
            gVar.timeout().g(i, timeUnit);
            fVar.timeout().g(i2, timeUnit);
            bVar.A(b0Var.e(), str);
            bVar.a();
            d0.a d2 = bVar.d(false);
            p.f(d2);
            d0 c2 = d2.r(b0Var).c();
            bVar.z(c2);
            int j = c2.j();
            if (j == 200) {
                if (gVar.f().G() && fVar.f().G()) {
                    return null;
                }
                throw new IOException("TLS tunnel buffered too many bytes!");
            }
            if (j != 407) {
                throw new IOException("Unexpected response code for CONNECT: " + c2.j());
            }
            b0 a2 = this.d.a().h().a(this.d, c2);
            if (a2 == null) {
                throw new IOException("Failed to authenticate with proxy");
            }
            if (o.u("close", d0.s(c2, "Connection", null, 2, null), true)) {
                return a2;
            }
            b0Var = a2;
        }
    }

    private final b0 m() throws IOException {
        b0 b2 = new b0.a().k(this.d.a().l()).f("CONNECT", null).d("Host", wk.d.Q(this.d.a().l(), true)).d("Proxy-Connection", "Keep-Alive").d("User-Agent", "okhttp/4.12.0").b();
        b0 a2 = this.d.a().h().a(this.d, new d0.a().r(b2).p(a0.HTTP_1_1).g(407).m("Preemptive Authenticate").b(wk.d.c).s(-1L).q(-1L).j("Proxy-Authenticate", "OkHttp-Preemptive").c());
        return a2 == null ? b2 : a2;
    }

    private final void n(al.b bVar, int i, vk.e eVar, vk.r rVar) throws IOException {
        if (this.d.a().k() != null) {
            rVar.B(eVar);
            j(bVar);
            rVar.A(eVar, this.g);
            if (this.h == a0.HTTP_2) {
                F(i);
                return;
            }
            return;
        }
        List<a0> f = this.d.a().f();
        a0 a0Var = a0.H2_PRIOR_KNOWLEDGE;
        if (!f.contains(a0Var)) {
            this.f = this.e;
            this.h = a0.HTTP_1_1;
        } else {
            this.f = this.e;
            this.h = a0Var;
            F(i);
        }
    }

    public f0 A() {
        return this.d;
    }

    public final void C(long j) {
        this.s = j;
    }

    public final void D(boolean z) {
        this.l = z;
    }

    public Socket E() {
        Socket socket = this.f;
        p.f(socket);
        return socket;
    }

    public final synchronized void H(e eVar, IOException iOException) {
        try {
            p.i(eVar, c6.CALL_LABEL);
            if (iOException instanceof n) {
                if (((n) iOException).i == dl.b.REFUSED_STREAM) {
                    int i = this.p + 1;
                    this.p = i;
                    if (i > 1) {
                        this.l = true;
                        this.n++;
                    }
                } else if (((n) iOException).i != dl.b.CANCEL || !eVar.o()) {
                    this.l = true;
                    this.n++;
                }
            } else if (!w() || (iOException instanceof dl.a)) {
                this.l = true;
                if (this.o == 0) {
                    if (iOException != null) {
                        h(eVar.m(), this.d, iOException);
                    }
                    this.n++;
                }
            }
        } catch (Throwable th2) {
            throw th2;
        }
    }

    @Override
    public a0 a() {
        a0 a0Var = this.h;
        p.f(a0Var);
        return a0Var;
    }

    @Override
    public synchronized void b(dl.f fVar, dl.m mVar) {
        p.i(fVar, "connection");
        p.i(mVar, c6.SETTINGS_LABEL);
        this.q = mVar.d();
    }

    @Override
    public void c(dl.i iVar) throws IOException {
        p.i(iVar, "stream");
        iVar.d(dl.b.REFUSED_STREAM, null);
    }

    public final void e() {
        Socket socket = this.e;
        if (socket != null) {
            wk.d.n(socket);
        }
    }

    public final void g(int r17, int r18, int r19, int r20, boolean r21, vk.e r22, vk.r r23) {
        throw new UnsupportedOperationException("Method not decompiled: al.f.g(int, int, int, int, boolean, vk.e, vk.r):void");
    }

    public final void h(z zVar, f0 f0Var, IOException iOException) {
        p.i(zVar, "client");
        p.i(f0Var, "failedRoute");
        p.i(iOException, "failure");
        if (f0Var.b().type() != Proxy.Type.DIRECT) {
            vk.a a2 = f0Var.a();
            a2.i().connectFailed(a2.l().t(), f0Var.b().address(), iOException);
        }
        zVar.y().b(f0Var);
    }

    public final List<Reference<e>> o() {
        return this.r;
    }

    public final long p() {
        return this.s;
    }

    public final boolean q() {
        return this.l;
    }

    public final int r() {
        return this.n;
    }

    public t s() {
        return this.g;
    }

    public final synchronized void t() {
        this.o++;
    }

    public String toString() {
        Object obj;
        StringBuilder sb = new StringBuilder();
        sb.append("Connection{");
        sb.append(this.d.a().l().i());
        sb.append(':');
        sb.append(this.d.a().l().n());
        sb.append(", proxy=");
        sb.append(this.d.b());
        sb.append(" hostAddress=");
        sb.append(this.d.d());
        sb.append(" cipherSuite=");
        t tVar = this.g;
        if (tVar == null || (obj = tVar.a()) == null) {
            obj = "none";
        }
        sb.append(obj);
        sb.append(" protocol=");
        sb.append(this.h);
        sb.append('}');
        return sb.toString();
    }

    public final boolean u(vk.a aVar, List<f0> list) {
        p.i(aVar, "address");
        if (wk.d.h && !Thread.holdsLock(this)) {
            throw new AssertionError("Thread " + Thread.currentThread().getName() + " MUST hold lock on " + this);
        }
        if (this.r.size() >= this.q || this.l || !this.d.a().d(aVar)) {
            return false;
        }
        if (p.d(aVar.l().i(), A().a().l().i())) {
            return true;
        }
        if (this.i == null || list == null || !B(list) || aVar.e() != hl.d.a || !G(aVar.l())) {
            return false;
        }
        try {
            vk.g a2 = aVar.a();
            p.f(a2);
            String i = aVar.l().i();
            t s = s();
            p.f(s);
            a2.a(i, s.d());
            return true;
        } catch (SSLPeerUnverifiedException unused) {
            return false;
        }
    }

    public final boolean v(boolean z) {
        long j;
        if (wk.d.h && Thread.holdsLock(this)) {
            throw new AssertionError("Thread " + Thread.currentThread().getName() + " MUST NOT hold lock on " + this);
        }
        long nanoTime = System.nanoTime();
        Socket socket = this.e;
        p.f(socket);
        Socket socket2 = this.f;
        p.f(socket2);
        jl.g gVar = this.j;
        p.f(gVar);
        if (socket.isClosed() || socket2.isClosed() || socket2.isInputShutdown() || socket2.isOutputShutdown()) {
            return false;
        }
        dl.f fVar = this.i;
        if (fVar != null) {
            return fVar.F0(nanoTime);
        }
        synchronized (this) {
            j = nanoTime - this.s;
        }
        if (j < 10000000000L || !z) {
            return true;
        }
        return wk.d.F(socket2, gVar);
    }

    public final boolean w() {
        return this.i != null;
    }

    public final bl.d x(z zVar, bl.g gVar) throws SocketException {
        p.i(zVar, "client");
        p.i(gVar, "chain");
        Socket socket = this.f;
        p.f(socket);
        jl.g gVar2 = this.j;
        p.f(gVar2);
        jl.f fVar = this.k;
        p.f(fVar);
        dl.f fVar2 = this.i;
        if (fVar2 != null) {
            return new dl.g(zVar, this, gVar, fVar2);
        }
        socket.setSoTimeout(gVar.k());
        z0 timeout = gVar2.timeout();
        long h = gVar.h();
        TimeUnit timeUnit = TimeUnit.MILLISECONDS;
        timeout.g(h, timeUnit);
        fVar.timeout().g(gVar.j(), timeUnit);
        return new cl.b(zVar, this, gVar2, fVar);
    }

    public final synchronized void y() {
        this.m = true;
    }

    public final synchronized void z() {
        this.l = true;
    }
}