package m0;

import P2.l;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Rect;
import androidx.leanback.widget.y0;
import java.util.Iterator;

/* JADX INFO: renamed from: m0.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1159a {

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static C1159a f14543c;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public boolean f14544a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f14545b;

    public static C1159a a(Context context) {
        if (f14543c == null) {
            C1159a c1159a = new C1159a();
            PackageManager packageManager = context.getPackageManager();
            Iterator<ResolveInfo> it = packageManager.queryBroadcastReceivers(new Intent("android.support.v17.leanback.action.PARTNER_CUSTOMIZATION"), 0).iterator();
            l lVar = null;
            Resources resourcesForApplication = null;
            String str = null;
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                ActivityInfo activityInfo = it.next().activityInfo;
                String str2 = activityInfo.packageName;
                if (str2 != null && (activityInfo.applicationInfo.flags & 1) != 0) {
                    try {
                        resourcesForApplication = packageManager.getResourcesForApplication(str2);
                    } catch (PackageManager.NameNotFoundException unused) {
                    }
                }
                if (resourcesForApplication != null) {
                    str = str2;
                    break;
                }
                str = str2;
            }
            if (resourcesForApplication != null) {
                lVar = new l();
                lVar.f5421a = resourcesForApplication;
                lVar.f5422b = str;
            }
            Rect rect = y0.f8732x;
            c1159a.f14544a = false;
            if (lVar != null) {
                String str3 = lVar.f5422b;
                Resources resources = lVar.f5421a;
                int identifier = resources.getIdentifier("leanback_prefer_static_shadows", "bool", str3);
                c1159a.f14544a = identifier > 0 ? resources.getBoolean(identifier) : false;
            }
            boolean zIsLowRamDevice = ((ActivityManager) context.getSystemService("activity")).isLowRamDevice();
            c1159a.f14545b = zIsLowRamDevice;
            if (lVar != null) {
                String str4 = lVar.f5422b;
                Resources resources2 = lVar.f5421a;
                int identifier2 = resources2.getIdentifier("leanback_outline_clipping_disabled", "bool", str4);
                if (identifier2 > 0) {
                    zIsLowRamDevice = resources2.getBoolean(identifier2);
                }
                c1159a.f14545b = zIsLowRamDevice;
            }
            f14543c = c1159a;
        }
        return f14543c;
    }
}
