package u;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.util.SparseArray;
import androidx.core.app.e;
import java.util.ArrayList;
import u.a;

/* loaded from: classes.dex */
public final class b {

    /* renamed from: a, reason: collision with root package name */
    public final Intent f36630a;

    /* renamed from: b, reason: collision with root package name */
    public final Bundle f36631b;

    /* loaded from: classes.dex */
    public static final class a {

        /* renamed from: c, reason: collision with root package name */
        private ArrayList f36634c;

        /* renamed from: d, reason: collision with root package name */
        private Bundle f36635d;

        /* renamed from: e, reason: collision with root package name */
        private ArrayList f36636e;

        /* renamed from: f, reason: collision with root package name */
        private SparseArray f36637f;

        /* renamed from: g, reason: collision with root package name */
        private Bundle f36638g;

        /* renamed from: a, reason: collision with root package name */
        private final Intent f36632a = new Intent("android.intent.action.VIEW");

        /* renamed from: b, reason: collision with root package name */
        private final a.C0868a f36633b = new a.C0868a();

        /* renamed from: h, reason: collision with root package name */
        private int f36639h = 0;

        /* renamed from: i, reason: collision with root package name */
        private boolean f36640i = true;

        private void b(IBinder iBinder, PendingIntent pendingIntent) {
            Bundle bundle = new Bundle();
            e.a(bundle, "android.support.customtabs.extra.SESSION", iBinder);
            if (pendingIntent != null) {
                bundle.putParcelable("android.support.customtabs.extra.SESSION_ID", pendingIntent);
            }
            this.f36632a.putExtras(bundle);
        }

        public b a() {
            if (!this.f36632a.hasExtra("android.support.customtabs.extra.SESSION")) {
                b(null, null);
            }
            ArrayList<? extends Parcelable> arrayList = this.f36634c;
            if (arrayList != null) {
                this.f36632a.putParcelableArrayListExtra("android.support.customtabs.extra.MENU_ITEMS", arrayList);
            }
            ArrayList<? extends Parcelable> arrayList2 = this.f36636e;
            if (arrayList2 != null) {
                this.f36632a.putParcelableArrayListExtra("android.support.customtabs.extra.TOOLBAR_ITEMS", arrayList2);
            }
            this.f36632a.putExtra("android.support.customtabs.extra.EXTRA_ENABLE_INSTANT_APPS", this.f36640i);
            this.f36632a.putExtras(this.f36633b.a().a());
            Bundle bundle = this.f36638g;
            if (bundle != null) {
                this.f36632a.putExtras(bundle);
            }
            if (this.f36637f != null) {
                Bundle bundle2 = new Bundle();
                bundle2.putSparseParcelableArray("androidx.browser.customtabs.extra.COLOR_SCHEME_PARAMS", this.f36637f);
                this.f36632a.putExtras(bundle2);
            }
            this.f36632a.putExtra("androidx.browser.customtabs.extra.SHARE_STATE", this.f36639h);
            return new b(this.f36632a, this.f36635d);
        }

        public a c(int i10) {
            this.f36633b.b(i10);
            return this;
        }
    }

    b(Intent intent, Bundle bundle) {
        this.f36630a = intent;
        this.f36631b = bundle;
    }

    public void a(Context context, Uri uri) {
        this.f36630a.setData(uri);
        androidx.core.content.a.startActivity(context, this.f36630a, this.f36631b);
    }
}
