package p067w;

import android.app.AppOpsManager;
import android.app.NotificationManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import java.lang.reflect.InvocationTargetException;
import java.util.HashSet;
import java.util.Set;

/* renamed from: w.n */
/* loaded from: classes.dex */
public final class C1785n {

    /* renamed from: c */
    public static final Object f4505c = new Object();

    /* renamed from: d */
    public static Set<String> f4506d = new HashSet();

    /* renamed from: e */
    public static final Object f4507e = new Object();

    /* renamed from: a */
    public final Context f4508a;

    /* renamed from: b */
    public final NotificationManager f4509b;

    public C1785n(Context context) {
        this.f4508a = context;
        this.f4509b = (NotificationManager) context.getSystemService("notification");
    }

    /* renamed from: b */
    public static C1785n m408b(Context context) {
        return new C1785n(context);
    }

    /* renamed from: a */
    public boolean m409a() {
        boolean areNotificationsEnabled;
        int i = Build.VERSION.SDK_INT;
        if (i >= 24) {
            areNotificationsEnabled = this.f4509b.areNotificationsEnabled();
            return areNotificationsEnabled;
        } else if (i >= 19) {
            AppOpsManager appOpsManager = (AppOpsManager) this.f4508a.getSystemService("appops");
            ApplicationInfo applicationInfo = this.f4508a.getApplicationInfo();
            String packageName = this.f4508a.getApplicationContext().getPackageName();
            int i2 = applicationInfo.uid;
            try {
                Class<?> cls = Class.forName(AppOpsManager.class.getName());
                Class<?> cls2 = Integer.TYPE;
                return ((Integer) cls.getMethod("checkOpNoThrow", cls2, cls2, String.class).invoke(appOpsManager, Integer.valueOf(((Integer) cls.getDeclaredField("OP_POST_NOTIFICATION").get(Integer.class)).intValue()), Integer.valueOf(i2), packageName)).intValue() == 0;
            } catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException | NoSuchMethodException | RuntimeException | InvocationTargetException unused) {
                return true;
            }
        } else {
            return true;
        }
    }
}