导航菜单

页面标题

页面副标题

Tasker v6.5.11 - p.java 源代码

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

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


package com.joaomgcd.taskerm.util;

import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.app.Service;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import hg.z1;

public final class p {

    static final class a extends yj.q implements xj.l<Notification, lj.e0> {
        final Service i;

        a(Service service) {
            super(1);
            this.i = service;
        }

        public final void a(Notification notification) {
            yj.p.i(notification, "it");
            Service service = this.i;
            p.p(service, service.hashCode(), notification);
        }

        @Override
        public lj.e0 invoke(Notification notification) {
            a(notification);
            return lj.e0.a;
        }
    }

    static final class b extends yj.q implements xj.a<lj.e0> {
        final c i;
        final Context q;

        b(c cVar, Context context) {
            super(0);
            this.i = cVar;
            this.q = context;
        }

        public final void a() {
            p.B(this.i, this.q);
        }

        @Override
        public lj.e0 invoke() {
            a();
            return lj.e0.a;
        }
    }

    public static final class c implements ServiceConnection {
        final Context a;
        final Intent b;

        c(Context context, Intent intent) {
            this.a = context;
            this.b = intent;
        }

        @Override
        public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
            yj.p.i(componentName, "componentName");
            yj.p.i(iBinder, "iBinder");
            try {
                this.a.startService(this.b);
            } catch (Throwable th2) {
                String Q4 = x2.Q4(2131887740, this.a, new Object[0]);
                net.dinglisch.android.taskerm.r7.l("Api", Q4, th2);
                z1.a aVar = hg.z1.A;
                Context context = this.a;
                String message = th2.getMessage();
                if (message == null) {
                    message = x2.Q4(2131891270, this.a, new Object[0]);
                }
                z1.a.n(aVar, context, "errorstartingserviceafterbind", Q4, message, null, 16, null);
            }
        }

        @Override
        public void onServiceDisconnected(ComponentName componentName) {
            yj.p.i(componentName, "componentName");
            p.B(this, this.a);
        }
    }

    static final class d extends yj.q implements xj.l<Activity, ji.r<ComponentName>> {
        final Intent i;

        d(Intent intent) {
            super(1);
            this.i = intent;
        }

        @Override
        public final ji.r<ComponentName> invoke(Activity activity) {
            yj.p.i(activity, "$this$getWithActivity");
            ji.r<ComponentName> w = ji.r.w(activity.startService(this.i));
            yj.p.h(w, "just(...)");
            return w;
        }
    }

    static final class e extends yj.q implements xj.l<ComponentName, lj.e0> {
        public static final e i = new e();

        e() {
            super(1);
        }

        public final void a(ComponentName componentName) {
        }

        @Override
        public lj.e0 invoke(ComponentName componentName) {
            a(componentName);
            return lj.e0.a;
        }
    }

    static final class f extends yj.q implements xj.l<Throwable, lj.e0> {
        final Context i;
        final Intent q;

        f(Context context, Intent intent) {
            super(1);
            this.i = context;
            this.q = intent;
        }

        public final void a(Throwable th2) {
            try {
                j5.a.a(this.i, this.q);
            } catch (Throwable th3) {
                net.dinglisch.android.taskerm.r7.l("Api", "tryActivityAndIfNotDoInForeground tryWithActivity", th3);
            }
        }

        @Override
        public lj.e0 invoke(Throwable th2) {
            a(th2);
            return lj.e0.a;
        }
    }

    static final class g extends yj.q implements xj.a<lj.e0> {
        final Context i;
        final ServiceConnection q;

        g(Context context, ServiceConnection serviceConnection) {
            super(0);
            this.i = context;
            this.q = serviceConnection;
        }

        public final void a() {
            this.i.unbindService(this.q);
        }

        @Override
        public lj.e0 invoke() {
            a();
            return lj.e0.a;
        }
    }

    public static final void A(xj.l lVar, Object obj) {
        yj.p.i(lVar, "$tmp0");
        lVar.invoke(obj);
    }

    public static final lj.e0 B(ServiceConnection serviceConnection, Context context) {
        return (lj.e0) x2.U4(null, new g(context, serviceConnection), 1, null);
    }

    public static final void C(Service service, String str) {
        yj.p.i(service, "<this>");
        yj.p.i(str, "tag");
        try {
            service.stopForeground(true);
        } catch (Exception e2) {
            net.dinglisch.android.taskerm.r7.f(str, "stopForeground: " + e2.getMessage());
        }
    }

    private static final NotificationChannel e(Context context) {
        return h(context).a(context);
    }

    public static final boolean f(Context context) {
        yj.p.i(context, "<this>");
        return k.a.C(26) && ExtensionsContextKt.z0(context) >= 26;
    }

    public static final Notification g(Context context) {
        PendingIntent pendingIntent;
        yj.p.i(context, "<this>");
        Notification.Builder smallIcon = l.a(context, "quick").setContentTitle("Useless Notification").setContentText("Tap to disable. You don't need these.").setSmallIcon(ExtensionsContextKt.G0(context));
        try {
            pendingIntent = PendingIntent.getActivity(context, 0, hg.r1.e(context.getPackageName(), "quick"), 67108864);
        } catch (Throwable unused) {
            pendingIntent = null;
        }
        Notification.Builder contentIntent = smallIcon.setContentIntent(pendingIntent);
        yj.p.h(contentIntent, "setContentIntent(...)");
        e(context);
        Notification build = contentIntent.build();
        yj.p.h(build, "build(...)");
        return build;
    }

    private static final hg.l1 h(Context context) {
        return new hg.l1("quick", "Placeholder - Please Disable", "Placeholder notifications. Please disable.", 5, null, null, null, false, null, false, null, null, 4048, null);
    }

    public static final boolean i(Context context, int i) {
        yj.p.i(context, "<this>");
        return ExtensionsContextKt.z0(context) < i;
    }

    public static final boolean j(Context context) {
        yj.p.i(context, "<this>");
        return i(context, 23);
    }

    public static final boolean k(Context context) {
        yj.p.i(context, "<this>");
        return i(context, 26);
    }

    public static final boolean l(Context context) {
        yj.p.i(context, "<this>");
        return i(context, 28);
    }

    public static final boolean m(Context context, int i) {
        yj.p.i(context, "<this>");
        return ExtensionsContextKt.z0(context) >= i;
    }

    public static final boolean n(Context context) {
        yj.p.i(context, "<this>");
        return m(context, 26);
    }

    @TargetApi(26)
    public static final boolean o(Context context) {
        yj.p.i(context, "<this>");
        if (k.a.p()) {
            return false;
        }
        NotificationChannel h = hg.r1.h(context, "quick");
        if (h == null) {
            return true;
        }
        return hg.r1.f(h);
    }

    public static final void p(Service service, int i, Notification notification) {
        yj.p.i(service, "<this>");
        yj.p.i(notification, "notification");
        try {
            if (k.a.k(service)) {
                com.joaomgcd.oldtaskercompat.u.a.c(service, i, notification);
            } else {
                service.startForeground(i, notification);
            }
        } catch (Exception e2) {
            net.dinglisch.android.taskerm.r7.l("Api", "Can't start foreground", e2);
        }
    }

    @TargetApi(26)
    public static final ji.b q(Service service) {
        yj.p.i(service, "service");
        if (!f(service)) {
            ji.b k = ji.b.k();
            yj.p.h(k, "complete(...)");
            return k;
        }
        ji.r<Notification> w = new hg.z1(service, null, null, null, null, null, false, null, null, null, null, 0, 0L, new hg.g(service, "quick"), false, false, null, null, null, h(service), null, false, false, 7856126, null).w();
        final a aVar = new a(service);
        ji.b P = w.x(new oi.e() {
            @Override
            public final Object a(Object obj) {
                lj.e0 r;
                r = p.r(xj.l.this, obj);
                return r;
            }
        }).P();
        yj.p.h(P, "toCompletable(...)");
        return P;
    }

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

    @TargetApi(26)
    public static final void s(Service service, int i) {
        yj.p.i(service, "<this>");
        if (f(service)) {
            p(service, i, g(service));
        }
    }

    @TargetApi(26)
    public static final void t(Service service, String str) {
        yj.p.i(service, "<this>");
        yj.p.i(str, net.dinglisch.android.taskerm.c6.EXTRA_ID);
        s(service, str.hashCode());
    }

    @TargetApi(26)
    public static final mi.b u(Context context, Intent intent, int i, boolean z) {
        yj.p.i(context, "context");
        yj.p.i(intent, "intent");
        return x(context, intent, i, z, false, null, 48, null);
    }

    @TargetApi(26)
    public static final mi.b v(Context context, Intent intent, int i, boolean z, boolean z2) {
        yj.p.i(context, "context");
        yj.p.i(intent, "intent");
        return x(context, intent, i, z, z2, null, 32, null);
    }

    @TargetApi(26)
    public static final mi.b w(Context context, Intent intent, int i, boolean z, boolean z2, m6 m6Var) {
        com.joaomgcd.taskerm.util.c<Intent> b2;
        yj.p.i(context, "context");
        yj.p.i(intent, "intent");
        if (m6Var != null && k8.J()) {
            c cVar = new c(context, intent);
            m6Var.c(new b(cVar, context));
            if (context.bindService(intent, cVar, 4609)) {
                return null;
            }
            com.joaomgcd.taskerm.util.c<Intent> b3 = m6Var.b();
            if (b3 != null) {
                b3.a(intent);
            }
        }
        if (m6Var != null && (b2 = m6Var.b()) != null) {
            b2.a(intent);
        }
        if (!k.a.g(context, i)) {
            context.startService(intent);
            return null;
        }
        if (!z) {
            return y(z2, context, intent);
        }
        try {
            if (context.startService(intent) != null) {
                return null;
            }
        } catch (Exception unused) {
        }
        return y(z2, context, intent);
    }

    public static mi.b x(Context context, Intent intent, int i, boolean z, boolean z2, m6 m6Var, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            i = ExtensionsContextKt.z0(context);
        }
        int i3 = i;
        boolean z3 = (i2 & 8) != 0 ? false : z;
        boolean z4 = (i2 & 16) != 0 ? false : z2;
        if ((i2 & 32) != 0) {
            m6Var = null;
        }
        return w(context, intent, i3, z3, z4, m6Var);
    }

    private static final mi.b y(boolean z, Context context, Intent intent) {
        if (z) {
            ji.r o2 = ExtensionsContextKt.o2(context, new d(intent));
            final e eVar = e.i;
            oi.d dVar = new oi.d() {
                @Override
                public final void accept(Object obj) {
                    p.z(xj.l.this, obj);
                }
            };
            final f fVar = new f(context, intent);
            return o2.I(dVar, new oi.d() {
                @Override
                public final void accept(Object obj) {
                    p.A(xj.l.this, obj);
                }
            });
        }
        try {
            j5.a.a(context, intent);
            return null;
        } catch (Throwable th2) {
            net.dinglisch.android.taskerm.r7.l("Api", "tryActivityAndIfNotDoInForeground !tryWithActivity", th2);
            return null;
        }
    }

    public static final void z(xj.l lVar, Object obj) {
        yj.p.i(lVar, "$tmp0");
        lVar.invoke(obj);
    }
}