package h.c.b;

import android.R;
import android.app.Activity;
import android.os.Build;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.lang.reflect.Method;
import okhttp3.HttpUrl;

/* JADX INFO: compiled from: MultiWinController.java */
/* JADX INFO: loaded from: classes.dex */
public class a {
    public final String a;
    public final RelativeLayout b;
    public final TextView c;
    public final FrameLayout d;
    public final Button e;
    public final View f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final Button f817g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final Button f818h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public final Button f819i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public Class<?> f820j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public Method f821k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public Method f822l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public final int f823m;
    public final int n;

    private a(Activity activity) {
        int i2;
        activity.getApplicationContext();
        View decorView = activity.getWindow().getDecorView();
        this.b = (RelativeLayout) decorView.findViewWithTag("zza_caption");
        this.c = (TextView) decorView.findViewWithTag("zza_app_name");
        this.d = (FrameLayout) decorView.findViewById(R.id.custom);
        this.e = (Button) decorView.findViewWithTag("zza_orientation_changed");
        this.f = decorView.findViewWithTag("zza_divider");
        this.f817g = (Button) decorView.findViewWithTag("zza_minimize_window");
        this.f818h = (Button) decorView.findViewWithTag("maximize_window");
        this.f819i = (Button) decorView.findViewWithTag("close_window");
        decorView.findViewWithTag("zza_divider2");
        c();
        d();
        this.a = d() ? "sys.ff.version_feature" : "ctm.ff.version_feature";
        d();
        int i3 = 0;
        try {
            String[] strArrSplit = a(this.a, "0-0").split("-");
            i2 = Integer.parseInt(strArrSplit[0]);
            try {
                i3 = Integer.parseInt(strArrSplit[1]);
            } catch (Exception unused) {
            }
        } catch (Exception unused2) {
            i2 = 0;
        }
        this.f823m = i2;
        this.n = i3;
        Log.d("@MultiWinController", "mVersion: " + this.f823m + ", mFeature: " + this.n);
    }

    private String a(String str, String str2) {
        c();
        try {
            return (String) this.f822l.invoke(null, str, str2);
        } catch (Exception e) {
            Log.w("@MultiWinController", "getProp: ", e);
            return str2;
        }
    }

    private void c() {
        if (this.f822l == null || this.f821k == null) {
            try {
                Class<?> cls = Class.forName("android.os.SystemProperties");
                this.f820j = cls;
                this.f821k = cls.getMethod("set", String.class, String.class);
                this.f822l = this.f820j.getMethod("get", String.class, String.class);
            } catch (Exception e) {
                Log.w("@MultiWinController", "MultiWinController: ", e);
            }
        }
    }

    private boolean d() {
        return Build.VERSION.SDK_INT >= 30 && !("982".equals(a("ro.cvte.ic", HttpUrl.FRAGMENT_ENCODE_SET)) && Build.VERSION.SDK_INT == 30);
    }

    public static a e(Activity activity) {
        if (Build.VERSION.SDK_INT < 24) {
            Log.w("@MultiWinController", "device android version is not support multi window mode. " + Build.VERSION.SDK_INT);
            return null;
        }
        if (!activity.isInMultiWindowMode()) {
            Log.w("@MultiWinController", "activity is not in multi window mode. " + activity);
            return null;
        }
        a aVar = new a(activity);
        if (aVar.b != null && aVar.c != null && aVar.d != null && aVar.e != null && aVar.f != null && aVar.f817g != null && aVar.f818h != null && aVar.f819i != null) {
            return aVar;
        }
        Log.w("@MultiWinController", "can not find captionView, id error. check your system if it is latest.");
        return null;
    }

    public void b() {
        this.b.setVisibility(8);
    }
}
