package com.bytedance.sdk.openadsdk.onz;

import android.text.TextUtils;
import com.bytedance.sdk.openadsdk.yz.dsz;
import java.util.HashSet;

/* JADX INFO: loaded from: classes2.dex */
public class yz {
    private String fm;
    private final HashSet<String> jnr = new HashSet<>();

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private volatile boolean f7522lb;
    private dsz ro;
    private volatile long yz;

    public yz(dsz dszVar) {
        this.ro = dszVar;
    }

    private boolean jnr() {
        return this.f7522lb && this.yz != 0 && System.currentTimeMillis() - this.yz <= 5000;
    }

    public void fm(String str) {
        dsz dszVar;
        if (yz() && !TextUtils.isEmpty(str)) {
            if (TextUtils.isEmpty(this.fm)) {
                this.fm = str;
            }
            if (lb(str) && !this.jnr.contains(str)) {
                this.jnr.add(str);
                boolean zRo = ro();
                boolean zJnr = jnr();
                long jCurrentTimeMillis = zRo ? System.currentTimeMillis() - this.yz : -1L;
                if (zJnr || (dszVar = this.ro) == null) {
                    return;
                }
                dszVar.fm(this.fm, str, jCurrentTimeMillis);
            }
        }
    }

    public void lb() {
        this.fm = null;
        this.yz = 0L;
        this.f7522lb = false;
        this.jnr.clear();
    }

    public boolean ro() {
        return this.f7522lb;
    }

    public boolean yz() {
        return com.bytedance.sdk.openadsdk.utils.ro.yz();
    }

    private boolean lb(String str) {
        if (str != null) {
            return str.startsWith("intent://") || str.startsWith("market://") || str.contains("play.google.com/store");
        }
        return false;
    }

    private boolean yz(String str) {
        return !TextUtils.equals(this.fm, str);
    }

    public void ro(String str) {
        dsz dszVar;
        if (yz() && !TextUtils.isEmpty(str) && lb(str) && !this.jnr.contains(str)) {
            this.jnr.add(str);
            boolean zRo = ro();
            boolean zJnr = jnr();
            boolean zYz = yz(str);
            long jCurrentTimeMillis = zRo ? System.currentTimeMillis() - this.yz : -1L;
            if (!zYz || zJnr || (dszVar = this.ro) == null) {
                return;
            }
            dszVar.fm(this.fm, str, jCurrentTimeMillis);
        }
    }

    public void fm() {
        if (yz()) {
            this.yz = System.currentTimeMillis();
            this.f7522lb = true;
        }
    }
}
