导航菜单

页面标题

页面副标题

Tasker v6.5.11 - e.java 源代码

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

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


package ie;

import android.content.Context;
import com.joaomgcd.taskerm.util.ExtensionsContextKt;
import com.joaomgcd.taskerm.util.g8;
import com.joaomgcd.taskerm.util.k8;
import com.joaomgcd.taskerm.util.x2;
import com.joaomgcd.taskerm.util.z2;
import ie.e;
import java.io.File;
import java.io.OutputStream;
import java.net.ConnectException;
import java.net.Socket;
import java.nio.charset.Charset;
import java.util.List;
import java.util.concurrent.TimeUnit;
import net.dinglisch.android.taskerm.r7;
import pg.w0;

public final class e {
    public static final c f = new c(null);
    public static final int g = 8;
    private static Boolean h;
    private final Context a;
    private final lj.j b;
    private final lj.j c;
    private final lj.j d;
    private final lj.j e;

    public static class a {
        private final String a;
        private final int b;

        public a(String str, int i) {
            yj.p.i(str, "ip");
            this.a = str;
            this.b = i;
        }

        public final String a() {
            return this.a;
        }

        public final int b() {
            return this.b;
        }
    }

    public static final class b extends a {
        private final String c;
        private final Integer d;
        private final boolean e;
        private final boolean f;
        private final String g;
        private final OutputStream h;
        private final xj.l<InterfaceC0263e, lj.e0> i;

        public b(String str, int i, String str2, Integer num, boolean z, boolean z2, String str3, OutputStream outputStream, xj.l<? super InterfaceC0263e, lj.e0> lVar) {
            super(str, i);
            yj.p.i(str, "ip");
            yj.p.i(str2, "command");
            this.c = str2;
            this.d = num;
            this.e = z;
            this.f = z2;
            this.g = str3;
            this.h = outputStream;
            this.i = lVar;
        }

        public final String c() {
            return this.c;
        }

        public final xj.l<InterfaceC0263e, lj.e0> d() {
            return this.i;
        }

        public final boolean e() {
            return this.e;
        }

        public final OutputStream f() {
            return this.h;
        }

        public final String g() {
            return this.g;
        }

        public final Integer h() {
            return this.d;
        }

        public final boolean i() {
            return this.f;
        }

        public b(String str, int i, String str2, Integer num, boolean z, boolean z2, String str3, OutputStream outputStream, xj.l lVar, int i2, yj.h hVar) {
            this(str, i, str2, (i2 & 8) != 0 ? 1000 : num, (i2 & 16) != 0 ? false : z, (i2 & 32) != 0 ? false : z2, (i2 & 64) != 0 ? null : str3, (i2 & 128) != 0 ? null : outputStream, (i2 & 256) != 0 ? null : lVar);
        }
    }

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

        public final String a(String str, String str2) {
            yj.p.i(str, "packageName");
            yj.p.i(str2, "className");
            return "cmd package set-home-activity \"" + str + "/" + str2 + "\"";
        }

        public final ji.r<Boolean> b(Context context) {
            yj.p.i(context, "context");
            return new e(context).q();
        }

        public final boolean c(Context context) {
            yj.p.i(context, "context");
            return new e(context).r();
        }

        private c() {
        }
    }

    public static final class d extends RuntimeException {
        public d() {
            super("Can't connect to ADB Wifi. Check here: https://tasker.joaoapps.com/userguide/en/help/ah_adb_wifi.html");
        }
    }

    public interface InterfaceC0263e {
        void b();
    }

    static final class f extends yj.q implements xj.a<n0> {
        public static final f i = new f();

        f() {
            super(0);
        }

        public static final String d(byte[] bArr) {
            yj.p.f(bArr);
            return x2.D0(bArr);
        }

        public final n0 invoke() {
            return new n0() {
                @Override
                public final String a(byte[] bArr) {
                    String d;
                    d = e.f.d(bArr);
                    return d;
                }
            };
        }
    }

    static final class g extends yj.q implements xj.a<p0> {
        g() {
            super(0);
        }

        public final ie.p0 invoke() {
            throw new UnsupportedOperationException("Method not decompiled: ie.e.g.invoke():ie.p0");
        }
    }

    static final class h extends yj.q implements xj.a<File> {
        h() {
            super(0);
        }

        public final File invoke() {
            return g8.w(e.this.m(), "priv.key", (String) null, 2, (Object) null);
        }
    }

    static final class i extends yj.q implements xj.a<File> {
        i() {
            super(0);
        }

        public final File invoke() {
            return g8.w(e.this.m(), "pub.key", (String) null, 2, (Object) null);
        }
    }

    public static final class j implements InterfaceC0263e {
        final yj.j0<r0> a;
        final yj.j0<o0> b;
        final b c;
        final boolean d;
        final e e;
        final rg.h f;

        j(yj.j0<r0> j0Var, yj.j0<o0> j0Var2, b bVar, boolean z, e eVar, rg.h hVar) {
            this.a = j0Var;
            this.b = j0Var2;
            this.c = bVar;
            this.d = z;
            this.e = eVar;
            this.f = hVar;
        }

        @Override
        public void b() {
            e.v(this.a, this.b, this.c, this.d, this.e, this.f);
        }
    }

    static final class k extends yj.q implements xj.a<ji.r<String>> {
        final b i;
        final e q;
        final boolean r;
        final rg.h s;
        final yj.j0<o0> t;
        final yj.j0<r0> u;

        static final class a extends yj.q implements xj.l<Throwable, ji.v<? extends String>> {
            final StringBuilder i;
            final b q;

            a(StringBuilder sb2, b bVar) {
                super(1);
                this.i = sb2;
                this.q = bVar;
            }

            public final ji.v<? extends String> invoke(Throwable th) {
                yj.p.i(th, "it");
                return ji.r.w(k.g(this.i, this.q));
            }
        }

        static final class b extends yj.q implements xj.a<String> {
            final r0 i;
            final b q;
            final StringBuilder r;
            final yj.j0<r0> s;
            final yj.j0<o0> t;
            final boolean u;
            final e v;
            final rg.h w;

            b(r0 r0Var, b bVar, StringBuilder sb2, yj.j0<r0> j0Var, yj.j0<o0> j0Var2, boolean z, e eVar, rg.h hVar) {
                super(0);
                this.i = r0Var;
                this.q = bVar;
                this.r = sb2;
                this.s = j0Var;
                this.t = j0Var2;
                this.u = z;
                this.v = eVar;
                this.w = hVar;
            }

            public final String invoke() {
                String str = null;
                while (!this.i.e()) {
                    try {
                        byte[] i = this.i.i();
                        yj.p.f(i);
                        String g = this.q.g();
                        if (g == null) {
                            g = "US-ASCII";
                        }
                        Charset forName = Charset.forName(g);
                        yj.p.h(forName, "forName(...)");
                        String str2 = new String(i, forName);
                        OutputStream f = this.q.f();
                        if (f != null) {
                            f.write(i);
                        }
                        if (this.q.f() == null || str == null) {
                            this.r.append(str2);
                        }
                        if (str != null && hk.o.N(str2, str, false, 2, (Object) null)) {
                            break;
                        }
                        if (str == null) {
                            String sb2 = this.r.toString();
                            yj.p.h(sb2, "toString(...)");
                            int i2 = 0;
                            for (int i3 = 0; i3 < sb2.length(); i3++) {
                                if (sb2.charAt(i3) == '\n') {
                                    i2++;
                                }
                            }
                            if (i2 >= 2) {
                                String sb3 = this.r.toString();
                                yj.p.h(sb3, "toString(...)");
                                str = hk.o.T0(z2.x0((String) hk.o.A0(sb3, new String[]{"\n"}, false, 0, 6, (Object) null).get(1), "^@"), ":/", (String) null, 2, (Object) null) + ":/ $";
                                if (hk.o.N(str2, "|" + str, false, 2, (Object) null)) {
                                    break;
                                }
                            } else {
                                continue;
                            }
                        }
                    } catch (Throwable th) {
                        try {
                            hk.o.j(this.r);
                            this.r.append("Error: " + th.getMessage());
                        } finally {
                            e.v(this.s, this.t, this.q, this.u, this.v, this.w);
                        }
                    }
                }
                e.v(this.s, this.t, this.q, this.u, this.v, this.w);
                return k.g(this.r, this.q);
            }
        }

        k(b bVar, e eVar, boolean z, rg.h hVar, yj.j0<o0> j0Var, yj.j0<r0> j0Var2) {
            super(0);
            this.i = bVar;
            this.q = eVar;
            this.r = z;
            this.s = hVar;
            this.t = j0Var;
            this.u = j0Var2;
        }

        public static final String g(StringBuilder sb2, b bVar) {
            String sb3 = sb2.toString();
            yj.p.h(sb3, "toString(...)");
            String x0 = z2.x0(z2.x0(sb3, "\r"), "^@");
            if (bVar.e()) {
                x0 = kotlin.collections.r.m0(kotlin.collections.r.Z(kotlin.collections.r.Y(hk.o.A0(x0, new String[]{"\n"}, false, 0, 6, (Object) null), 2), 1), "\n", (CharSequence) null, (CharSequence) null, 0, (CharSequence) null, (xj.l) null, 62, (Object) null);
            }
            c cVar = e.f;
            e.h = Boolean.TRUE;
            return x0;
        }

        public static final ji.v i(xj.l lVar, Object obj) {
            yj.p.i(lVar, "$tmp0");
            yj.p.i(obj, "p0");
            return (ji.v) lVar.invoke(obj);
        }

        public static final void k(yj.j0 j0Var, yj.j0 j0Var2, b bVar, boolean z, e eVar, rg.h hVar) {
            yj.p.i(j0Var, "$streamOuter");
            yj.p.i(j0Var2, "$adbOuter");
            yj.p.i(bVar, "$args");
            yj.p.i(eVar, "this$0");
            yj.p.i(hVar, "$toggleDebuggingSetting");
            e.v(j0Var, j0Var2, bVar, z, eVar, hVar);
        }

        public final ji.r<String> invoke() {
            String a2 = this.i.a();
            int b2 = this.i.b();
            String c = this.i.c();
            ExtensionsContextKt.E3(this.q.m(), 375).i();
            e.x("1", this.r, this.q, this.s);
            try {
                o0 K = o0.K(new Socket(a2, b2), this.q.n());
                this.t.i = K;
                K.B();
                yj.p.g(K, "null cannot be cast to non-null type com.joaomgcd.taskerm.adblib.AdbConnection");
                r0 O = K.O("shell:");
                this.u.i = O;
                O.r(c + "\n");
                StringBuilder sb2 = new StringBuilder();
                ji.r K0 = w0.K0(new b(O, this.i, sb2, this.u, this.t, this.r, this.q, this.s));
                if (this.i.h() != null) {
                    K0 = K0.L(this.i.h().intValue(), TimeUnit.MILLISECONDS);
                }
                final a aVar = new a(sb2, this.i);
                ji.r C = K0.C(new oi.e() {
                    public final Object a(Object obj) {
                        ji.v i;
                        i = e.k.i(aVar, obj);
                        return i;
                    }
                });
                final yj.j0<r0> j0Var = this.u;
                final yj.j0<o0> j0Var2 = this.t;
                final b bVar = this.i;
                final boolean z = this.r;
                final e eVar = this.q;
                final rg.h hVar = this.s;
                ji.r<String> n = C.n(new oi.a() {
                    public final void run() {
                        e.k.k(j0Var, j0Var2, bVar, z, eVar, hVar);
                    }
                });
                yj.p.h(n, "doFinally(...)");
                return n;
            } catch (ConnectException unused) {
                e.h = null;
                throw new d();
            }
        }
    }

    static final class l extends yj.q implements xj.a<ji.r<Boolean>> {

        static final class a extends yj.q implements xj.l<Boolean, Boolean> {
            public static final a i = new a();

            a() {
                super(1);
            }

            public final Boolean invoke(Boolean bool) {
                yj.p.i(bool, "it");
                if (bool.booleanValue()) {
                    return bool;
                }
                throw new RuntimeException("Can't enable debugging");
            }
        }

        l() {
            super(0);
        }

        public static final Boolean d(xj.l lVar, Object obj) {
            yj.p.i(lVar, "$tmp0");
            yj.p.i(obj, "p0");
            return (Boolean) lVar.invoke(obj);
        }

        public final ji.r<Boolean> invoke() {
            ji.r L = e.this.q().L(2L, TimeUnit.SECONDS);
            final a aVar = a.i;
            ji.r<Boolean> x = L.x(new oi.e() {
                public final Object a(Object obj) {
                    Boolean d;
                    d = e.l.d(aVar, obj);
                    return d;
                }
            });
            yj.p.h(x, "map(...)");
            return x;
        }
    }

    static final class m extends yj.q implements xj.l<String, List<? extends String>> {
        public static final m i = new m();

        m() {
            super(1);
        }

        public final List<String> invoke(String str) {
            yj.p.i(str, "it");
            return hk.o.A0(str, new String[]{"\n"}, false, 0, 6, (Object) null);
        }
    }

    static final class n extends yj.q implements xj.l<String, Boolean> {
        public static final n i = new n();

        n() {
            super(1);
        }

        public final Boolean invoke(String str) {
            yj.p.i(str, "it");
            return Boolean.TRUE;
        }
    }

    static final class o extends yj.q implements xj.l<Throwable, ji.v<? extends Boolean>> {
        public static final o i = new o();

        o() {
            super(1);
        }

        public final ji.v<? extends Boolean> invoke(Throwable th) {
            yj.p.i(th, "it");
            return ji.r.w(Boolean.FALSE);
        }
    }

    public e(Context context) {
        yj.p.i(context, "context");
        this.a = context;
        this.b = lj.k.b(new i());
        this.c = lj.k.b(new h());
        this.d = lj.k.b(f.i);
        this.e = lj.k.b(new g());
    }

    public static ji.r B(e eVar, String str, int i2, boolean z, int i3, String str2, boolean z2, int i4, Object obj) {
        int i5 = (i4 & 2) != 0 ? 1000 : i2;
        boolean z3 = (i4 & 4) != 0 ? false : z;
        if ((i4 & 8) != 0) {
            i3 = com.joaomgcd.taskerm.settings.q0.l(eVar.a);
        }
        int i6 = i3;
        if ((i4 & 16) != 0) {
            str2 = "localhost";
        }
        return eVar.A(str, i5, z3, i6, str2, (i4 & 32) != 0 ? false : z2);
    }

    public static final List C(xj.l lVar, Object obj) {
        yj.p.i(lVar, "$tmp0");
        yj.p.i(obj, "p0");
        return (List) lVar.invoke(obj);
    }

    public static ji.r E(e eVar, String str, int i2, int i3, Object obj) {
        if ((i3 & 2) != 0) {
            i2 = 1000;
        }
        return eVar.D(str, i2);
    }

    public static final Boolean F(xj.l lVar, Object obj) {
        yj.p.i(lVar, "$tmp0");
        yj.p.i(obj, "p0");
        return (Boolean) lVar.invoke(obj);
    }

    public static final ji.v G(xj.l lVar, Object obj) {
        yj.p.i(lVar, "$tmp0");
        yj.p.i(obj, "p0");
        return (ji.v) lVar.invoke(obj);
    }

    public final n0 l() {
        return (n0) this.d.getValue();
    }

    public final p0 n() {
        return (p0) this.e.getValue();
    }

    public final File o() {
        return (File) this.c.getValue();
    }

    public final File p() {
        return (File) this.b.getValue();
    }

    public static void t(e eVar, String str, Throwable th, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            th = null;
        }
        eVar.s(str, th);
    }

    public static final void v(yj.j0<r0> j0Var, yj.j0<o0> j0Var2, b bVar, boolean z, e eVar, rg.h hVar) {
        try {
            x("0", z, eVar, hVar);
            r0 r0Var = (r0) j0Var.i;
            if (r0Var != null) {
                r0Var.close();
            }
            o0 o0Var = (o0) j0Var2.i;
            if (o0Var != null) {
                o0Var.close();
            }
            OutputStream f2 = bVar.f();
            if (f2 != null) {
                f2.close();
            }
        } catch (Throwable unused) {
        }
    }

    public static final void w(yj.j0 j0Var, yj.j0 j0Var2, b bVar, boolean z, e eVar, rg.h hVar) {
        yj.p.i(j0Var, "$streamOuter");
        yj.p.i(j0Var2, "$adbOuter");
        yj.p.i(bVar, "$args");
        yj.p.i(eVar, "this$0");
        yj.p.i(hVar, "$toggleDebuggingSetting");
        v(j0Var, j0Var2, bVar, z, eVar, hVar);
    }

    public static final void x(String str, boolean z, e eVar, rg.h hVar) {
        if (z) {
            rg.j0.h(eVar.a, new rg.w(hVar, str)).f();
            k8.P(250L);
            if (yj.p.d(str, "1")) {
                w0.p1(w0.E0(eVar.new l()), 3, 1L, TimeUnit.SECONDS, (xj.l) null, 8, (Object) null).f();
            }
        }
    }

    public static ji.r z(e eVar, String str, int i2, boolean z, int i3, String str2, boolean z2, int i4, Object obj) {
        int i5 = (i4 & 2) != 0 ? 1000 : i2;
        boolean z3 = (i4 & 4) != 0 ? false : z;
        if ((i4 & 8) != 0) {
            i3 = com.joaomgcd.taskerm.settings.q0.l(eVar.a);
        }
        int i6 = i3;
        if ((i4 & 16) != 0) {
            str2 = "localhost";
        }
        return eVar.y(str, i5, z3, i6, str2, (i4 & 32) != 0 ? false : z2);
    }

    public final ji.r<List<String>> A(String str, int i2, boolean z, int i3, String str2, boolean z2) {
        yj.p.i(str, "command");
        yj.p.i(str2, "host");
        ji.r<String> y = y(str, i2, z, i3, str2, z2);
        final m mVar = m.i;
        ji.r<List<String>> x = y.x(new oi.e() {
            public final Object a(Object obj) {
                List C;
                C = e.C(mVar, obj);
                return C;
            }
        });
        yj.p.h(x, "map(...)");
        return x;
    }

    public final ji.r<Boolean> D(String str, int i2) {
        yj.p.i(str, "command");
        try {
            ji.r z = z(this, str, i2, false, 0, null, false, 60, null);
            final n nVar = n.i;
            ji.r x = z.x(new oi.e() {
                public final Object a(Object obj) {
                    Boolean F;
                    F = e.F(nVar, obj);
                    return F;
                }
            });
            final o oVar = o.i;
            ji.r<Boolean> C = x.C(new oi.e() {
                public final Object a(Object obj) {
                    ji.v G;
                    G = e.G(oVar, obj);
                    return G;
                }
            });
            yj.p.f(C);
            return C;
        } catch (Throwable unused) {
            ji.r<Boolean> w = ji.r.w(Boolean.FALSE);
            yj.p.f(w);
            return w;
        }
    }

    public final Context m() {
        return this.a;
    }

    public final ji.r<Boolean> q() {
        return E(this, "test", 0, 2, null);
    }

    public final boolean r() {
        Boolean bool = h;
        if (bool != null) {
            boolean booleanValue = bool.booleanValue();
            r7.f("ADB", "isAdbWifiAvailableWithCacheIfNeeded with cache: " + booleanValue);
            return booleanValue;
        }
        if (w0.Y0()) {
            r7.f("ADB", "isAdbWifiAvailableWithCacheIfNeeded ui thread: true");
            return true;
        }
        Boolean bool2 = (Boolean) E(this, "test", 0, 2, null).f();
        r7.f("ADB", "isAdbWifiAvailableWithCacheIfNeeded no cache: " + bool2);
        yj.p.f(bool2);
        return bool2.booleanValue();
    }

    public final void s(String str, Throwable th) {
        r7.g("ADB", str, th);
    }

    public final ji.r<String> u(final b bVar) {
        rg.h hVar;
        yj.p.i(bVar, "args");
        final yj.j0 j0Var = new yj.j0();
        final yj.j0 j0Var2 = new yj.j0();
        rg.h hVar2 = new rg.h(rg.u.v, "adb_enabled", false, 0, 0, 28, (yj.h) null);
        boolean z = bVar.i() && !yj.p.d(rg.j0.f(this.a, hVar2).f(), "1");
        xj.l<InterfaceC0263e, lj.e0> d2 = bVar.d();
        if (d2 != null) {
            hVar = hVar2;
            d2.invoke(new j(j0Var2, j0Var, bVar, z, this, hVar2));
        } else {
            hVar = hVar2;
        }
        final boolean z2 = z;
        final rg.h hVar3 = hVar;
        ji.r<String> n2 = w0.E0(new k(bVar, this, z, hVar, j0Var, j0Var2)).n(new oi.a() {
            public final void run() {
                e.w(j0Var2, j0Var, bVar, z2, this, hVar3);
            }
        });
        yj.p.h(n2, "doFinally(...)");
        return n2;
    }

    public final ji.r<String> y(String str, int i2, boolean z, int i3, String str2, boolean z2) {
        yj.p.i(str, "command");
        yj.p.i(str2, "host");
        return u(new b(str2, i3, str, Integer.valueOf(i2), z, z2, null, null, null, 448, null));
    }
}