导航菜单

页面标题

页面副标题

Tasker v6.5.11 - ServiceFCM.java 源代码

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

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


package com.joaomgcd.oldtaskercompat.fcm;

import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.joaomgcd.oldtaskercompat.fcm.a;
import com.joaomgcd.oldtaskercompat.fcm.configuration.FCMConfiguration;
import com.joaomgcd.oldtaskercompat.fcm.configuration.FCMFirebaseConfiguration;
import com.joaomgcd.oldtaskercompat.fcm.configuration.FCMServiceAccount;
import com.joaomgcd.taskerm.genericaction.GenericActionServiceCoroutine;
import com.joaomgcd.taskerm.util.g8;
import com.joaomgcd.taskerm.util.u5;
import com.joaomgcd.taskerm.util.x2;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Map;
import java.util.concurrent.CancellationException;
import jk.a0;
import jk.a2;
import jk.d1;
import jk.e2;
import jk.n0;
import jk.o0;
import lj.e0;
import lj.j;
import lj.k;
import net.dinglisch.android.taskerm.r7;
import xj.l;
import yj.p;
import yj.q;

public final class ServiceFCM extends FirebaseMessagingService {
    private static boolean A;
    private final a0 w;
    private final n0 x;
    public static final Companion y = new Companion(null);
    public static final int z = 8;
    private static final Object B = new Object();
    private static final j<gd.c> C = k.b(c.i);
    private static final j<com.joaomgcd.oldtaskercompat.fcm.a> D = k.b(b.i);
    private static final j<FCMConfiguration> E = k.b(a.i);

    public static final class Companion {

        private static final class GenericActionUpdateTokenRemotely extends GenericActionServiceCoroutine {
            public static final Parcelable.Creator<GenericActionUpdateTokenRemotely> CREATOR = new a();

            public static final class a implements Parcelable.Creator<GenericActionUpdateTokenRemotely> {
                @Override
                public final GenericActionUpdateTokenRemotely createFromParcel(Parcel parcel) {
                    p.i(parcel, "parcel");
                    parcel.readInt();
                    return new GenericActionUpdateTokenRemotely();
                }

                @Override
                public final GenericActionUpdateTokenRemotely[] newArray(int i) {
                    return new GenericActionUpdateTokenRemotely[i];
                }
            }

            @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion$GenericActionUpdateTokenRemotely", f = "ServiceFCM.kt", l = {132, 133}, m = "execute")
            static final class b extends qj.d {
                Object s;
                Object t;
                int v;

                b(oj.d<? super b> dVar) {
                    super(dVar);
                }

                public final Object r(Object obj) {
                    this.t = obj;
                    this.v |= Integer.MIN_VALUE;
                    return GenericActionUpdateTokenRemotely.this.execute(null, this);
                }
            }

            public GenericActionUpdateTokenRemotely() {
                super((String) null, 1, (yj.h) null);
            }

            public int describeContents() {
                return 0;
            }

            public java.lang.Object execute(android.app.Service r6, oj.d<? super com.joaomgcd.taskerm.util.s6> r7) {
                throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.GenericActionUpdateTokenRemotely.execute(android.app.Service, oj.d):java.lang.Object");
            }

            public void writeToParcel(Parcel parcel, int i) {
                p.i(parcel, "out");
                parcel.writeInt(1);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {152}, m = "assertGoogleCloudServiceAccountValid")
        static final class a extends qj.d {
            Object s;
            int u;

            a(oj.d<? super a> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.s = obj;
                this.u |= Integer.MIN_VALUE;
                return Companion.this.c(null, null, this);
            }
        }

        static final class b extends q implements xj.a<Boolean> {
            final FCMServiceAccount i;

            b(FCMServiceAccount fCMServiceAccount) {
                super(0);
                this.i = fCMServiceAccount;
            }

            public final Boolean invoke() {
                return Boolean.valueOf(this.i.isValid());
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {118}, m = "getBearerToken")
        static final class c extends qj.d {
            Object s;
            int u;

            c(oj.d<? super c> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.s = obj;
                this.u |= Integer.MIN_VALUE;
                return Companion.this.d(this);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {102, 103}, m = "getRemoteDeviceNames")
        static final class d extends qj.d {
            Object s;
            Object t;
            boolean u;
            Object v;
            int x;

            d(oj.d<? super d> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.v = obj;
                this.x |= Integer.MIN_VALUE;
                return Companion.this.k(null, false, this);
            }
        }

        static final class e extends q implements xj.a<Boolean> {
            final String i;

            e(String str) {
                super(0);
                this.i = str;
            }

            public final Boolean invoke() {
                String h;
                FCMFirebaseConfiguration fCMFirebaseConfiguration;
                String str = this.i;
                boolean z = false;
                if (str != null && (h = ServiceFCM.y.h(str)) != null && (fCMFirebaseConfiguration = (FCMFirebaseConfiguration) wf.c.a().h(h, FCMFirebaseConfiguration.class)) != null && fCMFirebaseConfiguration.isValid()) {
                    z = true;
                }
                return Boolean.valueOf(z);
            }
        }

        static final class f extends q implements xj.a<String> {
            final String i;

            f(String str) {
                super(0);
                this.i = str;
            }

            public final String invoke() {
                File B = g8.B(this.i);
                if (B != null) {
                    return vj.c.d(B, (Charset) null, 1, (Object) null);
                }
                return null;
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {216, 217, 223, 233}, m = "runActionRemotelyByName")
        static final class g extends qj.d {
            Object A;
            Object B;
            int D;
            Object s;
            Object t;
            Object u;
            Object v;
            Object w;
            Object x;
            Object y;
            Object z;

            g(oj.d<? super g> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.B = obj;
                this.D |= Integer.MIN_VALUE;
                return Companion.this.r(null, null, null, null, this);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {183, 186}, m = "sendRemoteMessageByFCMToken")
        static final class h extends qj.d {
            Object s;
            Object t;
            Object u;
            Object v;
            Object w;
            Object x;
            int z;

            h(oj.d<? super h> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.x = obj;
                this.z |= Integer.MIN_VALUE;
                return Companion.this.s(null, null, null, this);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {190, 190}, m = "sendRemoteMessageByNameOrFCMToken")
        static final class i extends qj.d {
            Object s;
            Object t;
            Object u;
            Object v;
            int x;

            i(oj.d<? super i> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.v = obj;
                this.x |= Integer.MIN_VALUE;
                return Companion.this.t(null, null, null, this);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {198, 201}, m = "sendRemoteMessageToAllDevices")
        static final class j extends qj.d {
            int A;
            Object s;
            Object t;
            Object u;
            Object v;
            Object w;
            Object x;
            Object y;

            j(oj.d<? super j> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.y = obj;
                this.A |= Integer.MIN_VALUE;
                return Companion.this.u(null, null, this);
            }
        }

        @qj.f(c = "com.joaomgcd.oldtaskercompat.fcm.ServiceFCM$Companion", f = "ServiceFCM.kt", l = {175, 176}, m = "updateTokenRemotely")
        static final class k extends qj.d {
            Object s;
            Object t;
            Object u;
            int w;

            k(oj.d<? super k> dVar) {
                super(dVar);
            }

            public final Object r(Object obj) {
                this.u = obj;
                this.w |= Integer.MIN_VALUE;
                return Companion.this.w(null, this);
            }
        }

        public Companion(yj.h hVar) {
            this();
        }

        private final FCMConfiguration e() {
            return (FCMConfiguration) ServiceFCM.E.getValue();
        }

        private final com.joaomgcd.oldtaskercompat.fcm.a f() {
            return (com.joaomgcd.oldtaskercompat.fcm.a) ServiceFCM.D.getValue();
        }

        public final gd.c g() {
            return (gd.c) ServiceFCM.C.getValue();
        }

        public final String h(String str) {
            String str2 = (String) x2.U4((l) null, new f(str), 1, (Object) null);
            return str2 == null ? str : str2;
        }

        public final java.lang.Object c(android.content.Context r5, java.lang.String r6, oj.d<? super lj.e0> r7) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.c(android.content.Context, java.lang.String, oj.d):java.lang.Object");
        }

        public final java.lang.Object d(oj.d<? super java.lang.String> r5) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.d(oj.d):java.lang.Object");
        }

        public final Object i(Context context, oj.d<? super String> dVar) {
            o(context);
            return f().e(dVar);
        }

        public final Object j(Context context, oj.d<? super String> dVar) {
            o(context);
            return f().f(dVar);
        }

        public final java.lang.Object k(android.content.Context r7, boolean r8, oj.d<? super java.util.List<java.lang.String>> r9) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.k(android.content.Context, boolean, oj.d):java.lang.Object");
        }

        public final Object l(Context context, boolean z, oj.d<? super a.b> dVar) {
            return f().l(context, z, dVar);
        }

        public final boolean m(Context context) {
            p.i(context, "context");
            o(context);
            return e().hasFCMConfigurations(context);
        }

        public final void n(Context context) {
            p.i(context, "context");
            synchronized (ServiceFCM.B) {
                String i2 = u5.i(context);
                String h2 = u5.h(context);
                r7.f("FCM", "Initing with service account " + i2 + " and firebase " + h2);
                FCMConfiguration.INSTANCE.setFCMConfigurations(context, i2, h2);
                ServiceFCM.A = true;
                e0 e0Var = e0.a;
            }
        }

        public final void o(Context context) {
            p.i(context, "context");
            synchronized (ServiceFCM.B) {
                if (ServiceFCM.A) {
                    return;
                }
                ServiceFCM.y.n(context);
                e0 e0Var = e0.a;
            }
        }

        public final boolean p(Context context, String str) {
            p.i(context, "context");
            Boolean bool = (Boolean) x2.U4((l) null, new e(str), 1, (Object) null);
            if (bool != null) {
                return bool.booleanValue();
            }
            return false;
        }

        public final Object q(Context context, oj.d<? super e0> dVar) {
            Object i2 = f().i(context, dVar);
            return i2 == pj.b.c() ? i2 : e0.a;
        }

        public final java.lang.Object r(android.content.Context r25, net.dinglisch.android.taskerm.c r26, java.lang.String r27, java.util.Map<java.lang.String, java.lang.String> r28, oj.d<? super com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteActionResult> r29) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.r(android.content.Context, net.dinglisch.android.taskerm.c, java.lang.String, java.util.Map, oj.d):java.lang.Object");
        }

        public final java.lang.Object s(android.content.Context r8, java.lang.String r9, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage r10, oj.d<? super java.util.List<java.lang.String>> r11) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.s(android.content.Context, java.lang.String, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage, oj.d):java.lang.Object");
        }

        public final java.lang.Object t(android.content.Context r6, java.lang.String r7, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage r8, oj.d<? super java.util.List<java.lang.String>> r9) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.t(android.content.Context, java.lang.String, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage, oj.d):java.lang.Object");
        }

        public final java.lang.Object u(android.content.Context r10, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage r11, oj.d<? super java.util.List<? extends java.util.List<java.lang.String>>> r12) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.u(android.content.Context, com.joaomgcd.oldtaskercompat.fcm.remotemessage.RemoteMessage, oj.d):java.lang.Object");
        }

        public final void v(Context context, String str, String str2, boolean z) {
            p.i(context, "context");
            e().setFCMConfigurations(context, str, str2);
            if (z) {
                new GenericActionUpdateTokenRemotely().runDontTrackProgress(context);
            }
        }

        public final java.lang.Object w(android.content.Context r7, oj.d<? super com.joaomgcd.taskerm.google.drive.io.DriveMetadataV3Upload> r8) {
            throw new UnsupportedOperationException("Method not decompiled: com.joaomgcd.oldtaskercompat.fcm.ServiceFCM.Companion.w(android.content.Context, oj.d):java.lang.Object");
        }

        private Companion() {
        }
    }

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

        a() {
            super(0);
        }

        public final FCMConfiguration invoke() {
            return FCMConfiguration.INSTANCE;
        }
    }

    static final class b extends q implements xj.a<com.joaomgcd.oldtaskercompat.fcm.a> {
        public static final b i = new b();

        b() {
            super(0);
        }

        public final com.joaomgcd.oldtaskercompat.fcm.a invoke() {
            return com.joaomgcd.oldtaskercompat.fcm.a.a;
        }
    }

    static final class c extends q implements xj.a<gd.c> {
        public static final c i = new c();

        c() {
            super(0);
        }

        public final gd.c invoke() {
            return gd.c.a;
        }
    }

    public ServiceFCM() {
        a0 b2 = e2.b((a2) null, 1, (Object) null);
        this.w = b2;
        this.x = o0.a(d1.b().V(b2));
    }

    public static final boolean C(Context context) {
        return y.m(context);
    }

    public static final boolean D(Context context, String str) {
        return y.p(context, str);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        a2.a.a(this.w, (CancellationException) null, 1, (Object) null);
    }

    @Override
    public void r(RemoteMessage remoteMessage) {
        p.i(remoteMessage, "message");
        super.r(remoteMessage);
        gd.c g = y.g();
        Map<String, String> d = remoteMessage.d();
        p.h(d, "getData(...)");
        Map<String, String> a2 = g.a(d);
        if (a2 == null) {
            return;
        }
        r7.f("FCM", "Received Message: " + x2.j1(a2));
        ServiceRemoteMessageRunner.u.a(this, a2);
    }

    @Override
    public void t(String str) {
        p.i(str, "token");
        super.t(str);
        r7.f("FCM", "Refreshed token: " + str);
        new Companion.GenericActionUpdateTokenRemotely().runDontTrackProgress(this);
    }
}