package ඓ.㸾.K;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Build;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* renamed from: ඓ.㸾.K.ᓣ  reason: contains not printable characters */
/* compiled from: SpecialBarFontUtils */
public class C1373 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static Field f5232;

    /* renamed from: ῲ  reason: contains not printable characters */
    public static Method f5233;

    /* renamed from: K  reason: contains not printable characters */
    public static Method f5234;

    /* renamed from: 㸾  reason: contains not printable characters */
    public static int f5235;

    static {
        try {
            f5234 = Activity.class.getMethod("setStatusBarDarkIcon", Integer.TYPE);
        } catch (NoSuchMethodException unused) {
        }
        try {
            f5233 = Activity.class.getMethod("setStatusBarDarkIcon", Boolean.TYPE);
        } catch (NoSuchMethodException unused2) {
        }
        try {
            f5232 = WindowManager.LayoutParams.class.getField("statusBarColor");
        } catch (NoSuchFieldException unused3) {
        }
        try {
            f5235 = View.class.getField("SYSTEM_UI_FLAG_LIGHT_STATUS_BAR").getInt(null);
        } catch (IllegalAccessException | NoSuchFieldException unused4) {
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3564(Activity activity, boolean z) {
        m3565(activity, z, true);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3566(View view, boolean z) {
        int i;
        int systemUiVisibility = view.getSystemUiVisibility();
        if (z) {
            i = f5235 | systemUiVisibility;
        } else {
            i = (~f5235) & systemUiVisibility;
        }
        if (i != systemUiVisibility) {
            view.setSystemUiVisibility(i);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3567(Window window, int i) {
        WindowManager.LayoutParams attributes = window.getAttributes();
        Field field = f5232;
        if (field != null) {
            try {
                if (field.getInt(attributes) != i) {
                    f5232.set(attributes, Integer.valueOf(i));
                    window.setAttributes(attributes);
                }
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public static void m3565(Activity activity, boolean z, boolean z2) {
        Method method = f5233;
        if (method != null) {
            try {
                method.invoke(activity, Boolean.valueOf(z));
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e2) {
                e2.printStackTrace();
            }
        } else if (z2) {
            Window window = activity.getWindow();
            if (Build.VERSION.SDK_INT < 23) {
                WindowManager.LayoutParams attributes = window.getAttributes();
                try {
                    Field declaredField = attributes.getClass().getDeclaredField("MEIZU_FLAG_DARK_STATUS_BAR_ICON");
                    declaredField.setAccessible(true);
                    int i = declaredField.getInt(attributes);
                    Field declaredField2 = attributes.getClass().getDeclaredField("meizuFlags");
                    declaredField2.setAccessible(true);
                    int i2 = declaredField2.getInt(attributes);
                    int i3 = z ? i | i2 : (~i) & i2;
                    if (i2 != i3) {
                        declaredField2.setInt(attributes, i3);
                    }
                } catch (NoSuchFieldException e3) {
                    e3.printStackTrace();
                } catch (IllegalAccessException e4) {
                    e4.printStackTrace();
                } catch (IllegalArgumentException e5) {
                    e5.printStackTrace();
                } catch (Throwable th) {
                    th.printStackTrace();
                }
            } else {
                m3566(window.getDecorView(), z);
                m3567(window, 0);
            }
        }
    }

    @SuppressLint({"PrivateApi"})
    /* renamed from: K  reason: contains not printable characters */
    public static void m3568(Window window, String str, boolean z) {
        if (window != null) {
            Class<?> cls = window.getClass();
            try {
                Class<?> cls2 = Class.forName("android.view.MiuiWindowManager$LayoutParams");
                int i = cls2.getField(str).getInt(cls2);
                Method method = cls.getMethod("setExtraFlags", Integer.TYPE, Integer.TYPE);
                if (z) {
                    method.invoke(window, Integer.valueOf(i), Integer.valueOf(i));
                    return;
                }
                method.invoke(window, 0, Integer.valueOf(i));
            } catch (Exception unused) {
            }
        }
    }
}
