package com.bytedance.sdk.component.ajl.fm.ro;

import android.content.Context;
import android.text.TextUtils;
import com.bytedance.sdk.component.ajl.fm.fm.jnr;
import com.bytedance.sdk.component.ajl.fm.wsy;

/* JADX INFO: loaded from: classes.dex */
public class fm {
    public static boolean ajl() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.ajl())) ? false : true;
    }

    public static long fm(int i10, Context context) {
        return ro(i10, context);
    }

    public static boolean jnr() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.lb())) ? false : true;
    }

    public static boolean lb() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.yz())) ? false : true;
    }

    private static long ro(int i10, Context context) {
        if (context == null) {
            return i10;
        }
        Runtime runtime = Runtime.getRuntime();
        long jFreeMemory = runtime.freeMemory() / 1048576;
        long jMaxMemory = (runtime.maxMemory() / 1048576) - (runtime.totalMemory() / 1048576);
        if (jMaxMemory <= 0) {
            if (jFreeMemory <= 2) {
                return 1L;
            }
            return jFreeMemory <= 10 ? Math.min(i10, 10) : Math.min((jFreeMemory / 2) * 10, i10);
        }
        long j10 = ((jFreeMemory + jMaxMemory) - 10) / 2;
        if (j10 <= 2) {
            return 1L;
        }
        return j10 <= 10 ? Math.min(i10, 10) : Math.min(j10 * 10, i10);
    }

    public static boolean yz() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.jnr())) ? false : true;
    }

    public static boolean fm() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.fm())) ? false : true;
    }

    public static boolean ro() {
        jnr jnrVarLb = wsy.ajl().lb();
        return (jnrVarLb == null || TextUtils.isEmpty(jnrVarLb.ro())) ? false : true;
    }
}
