package P2;

import android.app.PendingIntent;
import android.os.Bundle;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import d5.AbstractC0844a;

/* JADX INFO: loaded from: classes.dex */
public final class y extends Y2.e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ AbstractC0248e f5444a;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public y(AbstractC0248e abstractC0248e, Looper looper) {
        super(looper, 1);
        this.f5444a = abstractC0248e;
    }

    /* JADX WARN: Removed duplicated region for block: B:104:0x018e  */
    @Override // android.os.Handler
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void handleMessage(Message message) {
        Boolean bool;
        if (this.f5444a.f5382w.get() != message.arg1) {
            int i = message.what;
            if (i == 2 || i == 1 || i == 7) {
                q qVar = (q) message.obj;
                qVar.getClass();
                qVar.d();
                return;
            }
            return;
        }
        int i5 = message.what;
        if (i5 != 1 && i5 != 7) {
            if (i5 == 4) {
                this.f5444a.getClass();
            } else if (i5 == 5) {
            }
            if (!this.f5444a.b()) {
            }
        } else if (!this.f5444a.b()) {
            q qVar2 = (q) message.obj;
            qVar2.getClass();
            qVar2.d();
            return;
        }
        int i8 = message.what;
        if (i8 == 4) {
            AbstractC0248e abstractC0248e = this.f5444a;
            abstractC0248e.f5379t = new M2.b(message.arg2);
            if (!abstractC0248e.f5380u && !TextUtils.isEmpty(abstractC0248e.v()) && !TextUtils.isEmpty(null)) {
                try {
                    Class.forName(abstractC0248e.v());
                    AbstractC0248e abstractC0248e2 = this.f5444a;
                    if (!abstractC0248e2.f5380u) {
                        abstractC0248e2.A(3, null);
                        return;
                    }
                } catch (ClassNotFoundException unused) {
                }
            }
            AbstractC0248e abstractC0248e3 = this.f5444a;
            M2.b bVar = abstractC0248e3.f5379t;
            if (bVar == null) {
                bVar = new M2.b(8);
            }
            abstractC0248e3.f5369j.f(bVar);
            this.f5444a.getClass();
            System.currentTimeMillis();
            return;
        }
        if (i8 == 5) {
            AbstractC0248e abstractC0248e4 = this.f5444a;
            M2.b bVar2 = abstractC0248e4.f5379t;
            if (bVar2 == null) {
                bVar2 = new M2.b(8);
            }
            abstractC0248e4.f5369j.f(bVar2);
            this.f5444a.getClass();
            System.currentTimeMillis();
            return;
        }
        if (i8 == 3) {
            Object obj = message.obj;
            this.f5444a.f5369j.f(new M2.b(message.arg2, obj instanceof PendingIntent ? (PendingIntent) obj : null));
            this.f5444a.getClass();
            System.currentTimeMillis();
            return;
        }
        if (i8 == 6) {
            this.f5444a.A(5, null);
            InterfaceC0245b interfaceC0245b = this.f5444a.f5374o;
            if (interfaceC0245b != null) {
                interfaceC0245b.c(message.arg2);
            }
            this.f5444a.getClass();
            System.currentTimeMillis();
            AbstractC0248e.z(this.f5444a, 5, 1, null);
            return;
        }
        if (i8 == 2 && !this.f5444a.d()) {
            q qVar3 = (q) message.obj;
            qVar3.getClass();
            qVar3.d();
            return;
        }
        int i9 = message.what;
        if (i9 != 2 && i9 != 1 && i9 != 7) {
            Log.wtf("GmsClient", AbstractC0844a.j("Don't know how to handle message: ", i9), new Exception());
            return;
        }
        q qVar4 = (q) message.obj;
        synchronized (qVar4) {
            try {
                bool = qVar4.f5432a;
                if (qVar4.f5433b) {
                    Log.w("GmsClient", "Callback proxy " + qVar4.toString() + " being reused. This is not safe.");
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        if (bool != null) {
            AbstractC0248e abstractC0248e5 = qVar4.f5437f;
            int i10 = qVar4.f5435d;
            if (i10 != 0) {
                abstractC0248e5.A(1, null);
                Bundle bundle = qVar4.f5436e;
                qVar4.a(new M2.b(i10, bundle != null ? (PendingIntent) bundle.getParcelable("pendingIntent") : null));
            } else if (!qVar4.b()) {
                abstractC0248e5.A(1, null);
                qVar4.a(new M2.b(8, null));
            }
        }
        synchronized (qVar4) {
            qVar4.f5433b = true;
        }
        qVar4.d();
    }
}
