package com.google.android.gms.internal.pal;

import android.content.ContentResolver;
import android.content.Context;
import android.os.Handler;
import android.provider.Settings;
import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import java.io.IOException;
import java.util.concurrent.ExecutorService;

/* JADX INFO: loaded from: classes2.dex */
public final class o2 extends x2 {

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Context f21107e;

    public o2(Handler handler, ExecutorService executorService, Context context) {
        super(handler, executorService, zzagc.c(2L));
        this.f21107e = context;
    }

    @Override // com.google.android.gms.internal.pal.x2
    public final zzil a() {
        zzil zziqVar;
        Context context = this.f21107e;
        if (context.getPackageManager().hasSystemFeature("amazon.hardware.fire_tv")) {
            try {
                ContentResolver contentResolver = context.getContentResolver();
                String string = Settings.Secure.getString(contentResolver, "advertising_id");
                boolean z10 = true;
                if (Settings.Secure.getInt(contentResolver, "limit_ad_tracking") != 1) {
                    z10 = false;
                }
                zziqVar = new zziq(new q2(string, "afai", z10));
            } catch (Settings.SettingNotFoundException unused) {
                zziqVar = zzif.f21428a;
            }
        } else {
            zziqVar = zzif.f21428a;
        }
        if (zziqVar.d()) {
            return zziqVar;
        }
        try {
            com.google.android.gms.ads.identifier.a aVarA = com.google.android.gms.ads.identifier.b.a(context);
            String id2 = aVarA.getId();
            if (id2 == null) {
                id2 = "";
            }
            return new zziq(new q2(id2, "adid", aVarA.f7871a));
        } catch (GooglePlayServicesNotAvailableException | IOException | IllegalStateException unused2) {
            return zzif.f21428a;
        }
    }
}
