package p138.p176.p177.p242.p265.p266;

import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ބ.֏.Ĭ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class RunnableC4756 implements Runnable {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final /* synthetic */ boolean f14322;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public final /* synthetic */ Uri f14323;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public final /* synthetic */ String f14324;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final /* synthetic */ String f14325;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final /* synthetic */ C4956 f14326;

    public RunnableC4756(C4956 c4956, boolean z, Uri uri, String str, String str2) {
        this.f14326 = c4956;
        this.f14322 = z;
        this.f14323 = uri;
        this.f14324 = str;
        this.f14325 = str2;
    }

    @Override // java.lang.Runnable
    public final void run() {
        Bundle bundleM8238;
        Bundle bundleM82382;
        C4956 c4956 = this.f14326;
        boolean z = this.f14322;
        Uri uri = this.f14323;
        String str = this.f14324;
        String str2 = this.f14325;
        c4956.f14985.mo8008();
        try {
            if (c4956.f14985.f14588.f15015.m8177(C4915.f14890) || c4956.f14985.f14588.f15015.m8177(C4915.f14892) || c4956.f14985.f14588.f15015.m8177(C4915.f14891)) {
                C4887 c4887M8167 = c4956.f14985.m8167();
                if (!TextUtils.isEmpty(str2)) {
                    if (str2.contains("gclid") || str2.contains("utm_campaign") || str2.contains("utm_source") || str2.contains("utm_medium")) {
                        bundleM8238 = c4887M8167.m8238(Uri.parse(str2.length() != 0 ? "https://google.com/search?".concat(str2) : new String("https://google.com/search?")));
                        if (bundleM8238 != null) {
                            bundleM8238.putString("_cis", "referrer");
                        }
                    } else {
                        c4887M8167.mo8165().f14451.m8034("Activity created with data 'referrer' without required params");
                    }
                }
                bundleM8238 = null;
            } else {
                bundleM8238 = null;
            }
            if (z) {
                bundleM82382 = c4956.f14985.m8167().m8238(uri);
                if (bundleM82382 != null) {
                    bundleM82382.putString("_cis", "intent");
                    if (c4956.f14985.f14588.f15015.m8177(C4915.f14890) && !bundleM82382.containsKey("gclid") && bundleM8238 != null && bundleM8238.containsKey("gclid")) {
                        bundleM82382.putString("_cer", String.format("gclid=%s", bundleM8238.getString("gclid")));
                    }
                    c4956.f14985.m7972(str, "_cmp", bundleM82382);
                    if (c4956.f14985.f14588.f15015.m8177(C4915.f14881)) {
                        c4956.f14985.f14332.m7999(str, bundleM82382);
                    }
                }
            } else {
                bundleM82382 = null;
            }
            if (c4956.f14985.f14588.f15015.m8177(C4915.f14892) && !c4956.f14985.f14588.f15015.m8177(C4915.f14891) && bundleM8238 != null && bundleM8238.containsKey("gclid") && (bundleM82382 == null || !bundleM82382.containsKey("gclid"))) {
                c4956.f14985.m7975("auto", "_lgclid", (Object) bundleM8238.getString("gclid"), true);
            }
            if (TextUtils.isEmpty(str2)) {
                return;
            }
            c4956.f14985.mo8165().f14451.m8035("Activity created with referrer", str2);
            if (c4956.f14985.f14588.f15015.m8177(C4915.f14891)) {
                if (bundleM8238 != null) {
                    c4956.f14985.m7972(str, "_cmp", bundleM8238);
                    if (c4956.f14985.f14588.f15015.m8177(C4915.f14881)) {
                        c4956.f14985.f14332.m7999(str, bundleM8238);
                    }
                } else {
                    c4956.f14985.mo8165().f14451.m8035("Referrer does not contain valid parameters", str2);
                }
                c4956.f14985.m7975("auto", "_ldl", (Object) null, true);
                return;
            }
            if (!(str2.contains("gclid") && (str2.contains("utm_campaign") || str2.contains("utm_source") || str2.contains("utm_medium") || str2.contains("utm_term") || str2.contains("utm_content")))) {
                c4956.f14985.mo8165().f14451.m8034("Activity created with data 'referrer' without required params");
            } else {
                if (TextUtils.isEmpty(str2)) {
                    return;
                }
                c4956.f14985.m7975("auto", "_ldl", (Object) str2, true);
            }
        } catch (Exception e) {
            c4956.f14985.mo8165().f14444.m8035("Throwable caught in handleReferrerForOnActivityCreated", e);
        }
    }
}
