package P2;

import android.app.PendingIntent;
import android.content.ContentProviderClient;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import java.util.Arrays;

/* JADX INFO: loaded from: classes.dex */
public final class E {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static final Uri f5337d = new Uri.Builder().scheme("content").authority("com.google.android.gms.chimera").build();

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final String f5338a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final String f5339b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final boolean f5340c;

    public E(String str, boolean z8) {
        w.c(str);
        this.f5338a = str;
        w.c("com.google.android.gms");
        this.f5339b = "com.google.android.gms";
        this.f5340c = z8;
    }

    /* JADX WARN: Removed duplicated region for block: B:36:0x008b  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Intent a(Context context) throws x {
        Bundle bundleCall;
        PendingIntent pendingIntent;
        ContentProviderClient contentProviderClientAcquireUnstableContentProviderClient;
        Intent intent = null;
        String str = this.f5338a;
        if (str == null) {
            return new Intent().setComponent(null);
        }
        if (this.f5340c) {
            Bundle bundle = new Bundle();
            bundle.putString("serviceActionBundleKey", str);
            try {
                contentProviderClientAcquireUnstableContentProviderClient = context.getContentResolver().acquireUnstableContentProviderClient(f5337d);
            } catch (RemoteException e8) {
                e = e8;
                bundleCall = null;
            } catch (IllegalArgumentException e9) {
                e = e9;
                bundleCall = null;
            }
            if (contentProviderClientAcquireUnstableContentProviderClient == null) {
                throw new RemoteException("Failed to acquire ContentProviderClient");
            }
            try {
                bundleCall = contentProviderClientAcquireUnstableContentProviderClient.call("serviceIntentCall", null, bundle);
                try {
                } catch (RemoteException e10) {
                    e = e10;
                    Log.w("ConnectionStatusConfig", "Dynamic intent resolution failed: ".concat(e.toString()));
                } catch (IllegalArgumentException e11) {
                    e = e11;
                    Log.w("ConnectionStatusConfig", "Dynamic intent resolution failed: ".concat(e.toString()));
                }
                if (bundleCall == null && (intent = (Intent) bundleCall.getParcelable("serviceResponseIntentKey")) == null && (pendingIntent = (PendingIntent) bundleCall.getParcelable("serviceMissingResolutionIntentKey")) != null) {
                    Log.w("ConnectionStatusConfig", "Dynamic lookup for intent failed for action " + str + " but has possible resolution");
                    throw new x(new M2.b(25, pendingIntent));
                }
                if (intent == null) {
                    Log.w("ConnectionStatusConfig", "Dynamic lookup for intent failed for action: ".concat(str));
                }
            } finally {
                contentProviderClientAcquireUnstableContentProviderClient.release();
            }
            Log.w("ConnectionStatusConfig", "Dynamic intent resolution failed: ".concat(e.toString()));
            if (bundleCall == null) {
            }
            if (intent == null) {
            }
        }
        return intent == null ? new Intent(str).setPackage(this.f5339b) : intent;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (!(obj instanceof E)) {
            return false;
        }
        E e8 = (E) obj;
        return w.i(this.f5338a, e8.f5338a) && w.i(this.f5339b, e8.f5339b) && w.i(null, null) && this.f5340c == e8.f5340c;
    }

    public final int hashCode() {
        return Arrays.hashCode(new Object[]{this.f5338a, this.f5339b, null, 4225, Boolean.valueOf(this.f5340c)});
    }

    public final String toString() {
        String str = this.f5338a;
        if (str != null) {
            return str;
        }
        w.f(null);
        throw null;
    }
}
