package p7;

import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import android.webkit.WebSettings;
import com.google.android.gms.internal.ads.ao;
import java.util.concurrent.Callable;

/* JADX INFO: loaded from: classes2.dex */
public final /* synthetic */ class h0 implements Callable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f31680a = 0;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Context f31681b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f31682c;

    public /* synthetic */ h0(Context context, Context context2) {
        this.f31681b = context;
        this.f31682c = context2;
    }

    @Override // java.util.concurrent.Callable
    public final Object call() {
        SharedPreferences sharedPreferences;
        int i10 = this.f31680a;
        boolean z10 = false;
        Object obj = this.f31682c;
        Context context = this.f31681b;
        switch (i10) {
            case 0:
                Context context2 = (Context) obj;
                if (context != null) {
                    l0.g("Attempting to read user agent from Google Play Services.");
                    sharedPreferences = context.getSharedPreferences("admob_user_agent", 0);
                } else {
                    l0.g("Attempting to read user agent from local cache.");
                    sharedPreferences = context2.getSharedPreferences("admob_user_agent", 0);
                    z10 = true;
                }
                String string = sharedPreferences.getString("user_agent", "");
                if (TextUtils.isEmpty(string)) {
                    l0.g("Reading user agent from WebSettings");
                    string = WebSettings.getDefaultUserAgent(context2);
                    if (z10) {
                        sharedPreferences.edit().putString("user_agent", string).apply();
                        l0.g("Persisting user agent.");
                    }
                }
                return string;
            default:
                m0 m0Var = r0.f31763l;
                WebSettings webSettings = (WebSettings) obj;
                webSettings.setDatabasePath(context.getDatabasePath("com.google.android.gms.ads.db").getAbsolutePath());
                webSettings.setDatabaseEnabled(true);
                webSettings.setDomStorageEnabled(true);
                webSettings.setDisplayZoomControls(false);
                webSettings.setBuiltInZoomControls(true);
                webSettings.setSupportZoom(true);
                if (((Boolean) n7.y.f31093e.f31096c.b(ao.f8896i1)).booleanValue()) {
                    webSettings.setTextZoom(100);
                }
                webSettings.setAllowContentAccess(false);
                return Boolean.TRUE;
        }
    }

    public /* synthetic */ h0(Context context, WebSettings webSettings) {
        this.f31682c = webSettings;
        this.f31681b = context;
    }
}
