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

import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import androidx.annotation.Nullable;

/* JADX INFO: loaded from: classes2.dex */
public final class h1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final Resources f21648a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final String f21649b;

    public h1(Context context, @Nullable String str) {
        com.google.android.gms.common.internal.w.checkNotNull(context);
        this.f21648a = context.getResources();
        if (TextUtils.isEmpty(str)) {
            this.f21649b = a(context);
        } else {
            this.f21649b = str;
        }
    }

    public static String a(Context context) {
        try {
            return context.getResources().getResourcePackageName(e8.i.common_google_play_services_unknown_issue);
        } catch (Resources.NotFoundException unused) {
            return context.getPackageName();
        }
    }

    @Nullable
    public final String zza(String str) {
        String str2 = this.f21649b;
        Resources resources = this.f21648a;
        int identifier = resources.getIdentifier(str, "string", str2);
        if (identifier == 0) {
            return null;
        }
        try {
            return resources.getString(identifier);
        } catch (Resources.NotFoundException unused) {
            return null;
        }
    }
}
