导航菜单

页面标题

页面副标题

Pulsar v1.0.0 - LivenessActivity.java 源代码

正在查看: Pulsar v1.0.0 应用的 LivenessActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package aai.liveness.activity;

import a3d2025032899291233071.n;
import a3d2025032899291233071.p;
import aai.liveness.LivenessView;
import aai.liveness.c;
import aai.liveness.g;
import ai.advance.core.PermissionActivity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.util.SparseArray;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import com.facebook.react.uimanager.events.PointerEventHelper;

public class LivenessActivity extends PermissionActivity implements a.a {

    private SparseArray<AnimationDrawable> f381b;

    protected ImageView f382c;

    protected LivenessView f383d;

    private ImageView f384e;

    private TextView f385f;

    private TextView f386g;

    private CheckBox f387i;

    private View f388n;

    ProgressDialog f389s;

    class a implements View.OnClickListener {
        a() {
        }

        @Override
        public void onClick(View view) {
            LivenessActivity.this.onBackPressed();
        }
    }

    class b implements CompoundButton.OnCheckedChangeListener {
        b() {
        }

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean z4) {
            LivenessActivity.this.f383d.setSoundPlayEnable(z4);
            if (z4) {
                LivenessActivity.this.G();
            }
        }
    }

    class c implements DialogInterface.OnClickListener {

        final String f392a;

        c(String str) {
            this.f392a = str;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i5) {
            p.setErrorMsg(this.f392a);
            dialogInterface.dismiss();
            LivenessActivity.this.setResult(-1);
            LivenessActivity.this.finish();
        }
    }

    class d implements a.b {
        d() {
        }

        @Override
        public void onGetFaceDataFailed(aai.liveness.http.entity.a aVar) {
            if (!aVar.f18990b && "NO_RESPONSE".equals(aVar.f18989a)) {
                p.setErrorMsg(LivenessActivity.this.getString(g.C0008g.f572n));
            }
            LivenessActivity.this.H();
        }

        @Override
        public void onGetFaceDataStart() {
            LivenessActivity.this.f388n.setVisibility(0);
            LivenessActivity.this.f386g.setVisibility(4);
            LivenessActivity.this.f383d.setVisibility(4);
            LivenessActivity.this.f387i.setVisibility(4);
            LivenessActivity.this.f384e.setVisibility(4);
            LivenessActivity.this.f385f.setVisibility(4);
            LivenessActivity.this.f382c.setVisibility(4);
        }

        @Override
        public void onGetFaceDataSuccess(aai.liveness.http.entity.a aVar, String str) {
            LivenessActivity.this.H();
        }
    }

    class e implements DialogInterface.OnClickListener {
        e() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i5) {
            LivenessActivity.this.finish();
        }
    }

    static class f {

        static final int[] f396a;

        static final int[] f397b;

        static final int[] f398c;

        static {
            int[] iArr = new int[c.a.values().length];
            f398c = iArr;
            try {
                iArr[c.a.FACEMISSING.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f398c[c.a.TIMEOUT.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                f398c[c.a.MULTIPLEFACE.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
            try {
                f398c[c.a.MUCHMOTION.ordinal()] = 4;
            } catch (NoSuchFieldError unused4) {
            }
            try {
                f398c[c.a.WEAKLIGHT.ordinal()] = 5;
            } catch (NoSuchFieldError unused5) {
            }
            try {
                f398c[c.a.STRONGLIGHT.ordinal()] = 6;
            } catch (NoSuchFieldError unused6) {
            }
            int[] iArr2 = new int[c.e.values().length];
            f397b = iArr2;
            try {
                iArr2[c.e.FACEMISSING.ordinal()] = 1;
            } catch (NoSuchFieldError unused7) {
            }
            try {
                f397b[c.e.FACESMALL.ordinal()] = 2;
            } catch (NoSuchFieldError unused8) {
            }
            try {
                f397b[c.e.FACELARGE.ordinal()] = 3;
            } catch (NoSuchFieldError unused9) {
            }
            try {
                f397b[c.e.FACENOTCENTER.ordinal()] = 4;
            } catch (NoSuchFieldError unused10) {
            }
            try {
                f397b[c.e.FACENOTFRONTAL.ordinal()] = 5;
            } catch (NoSuchFieldError unused11) {
            }
            try {
                f397b[c.e.FACENOTSTILL.ordinal()] = 6;
            } catch (NoSuchFieldError unused12) {
            }
            try {
                f397b[c.e.FACECAPTURE.ordinal()] = 7;
            } catch (NoSuchFieldError unused13) {
            }
            try {
                f397b[c.e.WARN_EYE_OCCLUSION.ordinal()] = 8;
            } catch (NoSuchFieldError unused14) {
            }
            try {
                f397b[c.e.WARN_MOUTH_OCCLUSION.ordinal()] = 9;
            } catch (NoSuchFieldError unused15) {
            }
            try {
                f397b[c.e.WARN_WEAKLIGHT.ordinal()] = 10;
            } catch (NoSuchFieldError unused16) {
            }
            try {
                f397b[c.e.WARN_TOOLIGHT.ordinal()] = 11;
            } catch (NoSuchFieldError unused17) {
            }
            try {
                f397b[c.e.WARN_FACE_BIAS_BOTTOM.ordinal()] = 12;
            } catch (NoSuchFieldError unused18) {
            }
            try {
                f397b[c.e.WARN_FACE_BIAS_UP.ordinal()] = 13;
            } catch (NoSuchFieldError unused19) {
            }
            try {
                f397b[c.e.WARN_FACE_BIAS_RIGHT.ordinal()] = 14;
            } catch (NoSuchFieldError unused20) {
            }
            try {
                f397b[c.e.WARN_FACE_BIAS_LEFT.ordinal()] = 15;
            } catch (NoSuchFieldError unused21) {
            }
            try {
                f397b[c.e.FACEINACTION.ordinal()] = 16;
            } catch (NoSuchFieldError unused22) {
            }
            int[] iArr3 = new int[c.EnumC0006c.values().length];
            f396a = iArr3;
            try {
                iArr3[c.EnumC0006c.POS_YAW.ordinal()] = 1;
            } catch (NoSuchFieldError unused23) {
            }
            try {
                f396a[c.EnumC0006c.MOUTH.ordinal()] = 2;
            } catch (NoSuchFieldError unused24) {
            }
            try {
                f396a[c.EnumC0006c.BLINK.ordinal()] = 3;
            } catch (NoSuchFieldError unused25) {
            }
        }
    }

    private void D(int i5) {
        this.f385f.setText(i5);
    }

    private void F() {
        this.f381b = new SparseArray<>();
        this.f383d.setLivenssCallback(this);
    }

    public void G() {
        int i5;
        if (this.f387i.getVisibility() != 0) {
            this.f387i.setVisibility(0);
        }
        c.EnumC0006c currentDetectionType = this.f383d.getCurrentDetectionType();
        if (currentDetectionType != null) {
            int i6 = f.f396a[currentDetectionType.ordinal()];
            if (i6 == 1) {
                i5 = g.f.f556c;
            } else if (i6 == 2) {
                i5 = g.f.f555b;
            } else if (i6 == 3) {
                i5 = g.f.f554a;
            }
            this.f383d.playSound(i5, true, 1500L);
        }
        i5 = -1;
        this.f383d.playSound(i5, true, 1500L);
    }

    public void H() {
        setResult(-1);
        finish();
    }

    private void I() {
        c.EnumC0006c currentDetectionType = this.f383d.getCurrentDetectionType();
        if (currentDetectionType != null) {
            int i5 = f.f396a[currentDetectionType.ordinal()];
            D(i5 != 1 ? i5 != 2 ? i5 != 3 ? 0 : g.C0008g.f561c : g.C0008g.f581w : g.C0008g.D);
            AnimationDrawable drawRes = getDrawRes(currentDetectionType);
            this.f384e.setImageDrawable(drawRes);
            drawRes.start();
        }
    }

    private void J() {
        this.f383d.setVisibility(0);
        this.f385f.setVisibility(0);
        this.f384e.setVisibility(0);
        this.f382c.setVisibility(0);
        this.f386g.setText(PointerEventHelper.POINTER_TYPE_UNKNOWN);
        this.f386g.setBackgroundResource(0);
        this.f386g.setVisibility(0);
        this.f387i.setVisibility(4);
        this.f384e.setImageDrawable(null);
        this.f388n.setVisibility(4);
    }

    private void K(c.e eVar) {
        int i5;
        if (!this.f383d.isVertical()) {
            i5 = g.C0008g.f579u;
        } else if (eVar != null) {
            switch (f.f397b[eVar.ordinal()]) {
                case 1:
                    i5 = g.C0008g.f584z;
                    break;
                case 2:
                    i5 = g.C0008g.G;
                    break;
                case 3:
                    i5 = g.C0008g.H;
                    break;
                case 4:
                    i5 = g.C0008g.f582x;
                    break;
                case 5:
                    i5 = g.C0008g.f578t;
                    break;
                case 6:
                case 7:
                    i5 = g.C0008g.E;
                    break;
                case 8:
                    i5 = g.C0008g.B;
                    break;
                case 9:
                    i5 = g.C0008g.f570l;
                    break;
                case 10:
                    i5 = g.C0008g.K;
                    break;
                case 11:
                    i5 = g.C0008g.I;
                    break;
                case 12:
                    i5 = g.C0008g.f569k;
                    break;
                case 13:
                    i5 = g.C0008g.f566h;
                    break;
                case 14:
                    i5 = g.C0008g.f567i;
                    break;
                case 15:
                    i5 = g.C0008g.f568j;
                    break;
                case 16:
                    I();
                    return;
                default:
                    return;
            }
        } else {
            return;
        }
        D(i5);
    }

    protected void E() {
        this.f382c = (ImageView) findViewById(g.d.f546c);
        this.f383d = (LivenessView) findViewById(g.d.f545b);
        this.f384e = (ImageView) findViewById(g.d.f550g);
        this.f385f = (TextView) findViewById(g.d.f551h);
        this.f386g = (TextView) findViewById(g.d.f549f);
        this.f388n = findViewById(g.d.f547d);
        this.f387i = (CheckBox) findViewById(g.d.f552i);
        findViewById(g.d.f544a).setOnClickListener(new a());
        this.f387i.setChecked(this.f383d.isSoundPlayEnable());
        this.f387i.setOnCheckedChangeListener(new b());
    }

    public android.graphics.drawable.AnimationDrawable getDrawRes(aai.liveness.c.EnumC0006c r3) {
        throw new UnsupportedOperationException("Method not decompiled: aai.liveness.activity.LivenessActivity.getDrawRes(aai.liveness.c$c):android.graphics.drawable.AnimationDrawable");
    }

    @Override
    public void onActionRemainingTimeChanged(long j5) {
        this.f386g.setText(((int) (j5 / 1000)) + "s");
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(g.e.f553a);
        ai.advance.common.utils.p.changeActivityBrightness(this, 255);
        E();
        F();
        if (!n.isSDKHandleCameraPermission() || s()) {
            return;
        }
        requestPermissions();
    }

    @Override
    protected void onDestroy() {
        this.f383d.onDestroy();
        this.f381b.clear();
        super.onDestroy();
    }

    @Override
    public void onDetectionActionChanged() {
        G();
        I();
        this.f386g.setBackgroundResource(g.c.f534o);
    }

    @Override
    public void onDetectionFailed(c.a aVar, c.EnumC0006c enumC0006c) {
        int i5;
        int i6;
        int[] iArr = f.f398c;
        int i7 = iArr[aVar.ordinal()];
        if (i7 == 5) {
            i5 = g.C0008g.K;
        } else {
            if (i7 != 6) {
                int i8 = iArr[aVar.ordinal()];
                String str = null;
                if (i8 != 1) {
                    if (i8 == 2) {
                        i6 = g.C0008g.f577s;
                    } else {
                        if (i8 != 3) {
                            if (i8 == 4) {
                                i6 = g.C0008g.f575q;
                            }
                            p.setErrorMsg(str);
                            H();
                            return;
                        }
                        i6 = g.C0008g.f576r;
                    }
                    str = getString(i6);
                    p.setErrorMsg(str);
                    H();
                    return;
                }
                int i9 = f.f396a[enumC0006c.ordinal()];
                if (i9 != 1) {
                    if (i9 == 2 || i9 == 3) {
                        i6 = g.C0008g.f573o;
                    }
                    p.setErrorMsg(str);
                    H();
                    return;
                }
                i6 = g.C0008g.f574p;
                str = getString(i6);
                p.setErrorMsg(str);
                H();
                return;
            }
            i5 = g.C0008g.I;
        }
        D(i5);
    }

    @Override
    public void onDetectionFrameStateChanged(c.e eVar) {
        K(eVar);
    }

    @Override
    public void onDetectionSuccess() {
        this.f383d.getLivenessData(new d());
    }

    @Override
    public void onDetectorInitComplete(boolean z4, String str, String str2) {
        ProgressDialog progressDialog = this.f389s;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        if (z4) {
            K(null);
            return;
        }
        if ("NO_RESPONSE".equals(str)) {
            str2 = getString(g.C0008g.f571m);
        }
        new AlertDialog.a(this).setMessage(str2).setPositiveButton(g.C0008g.C, new c(str2)).create().show();
    }

    @Override
    public void onDetectorInitStart() {
        ProgressDialog progressDialog = this.f389s;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        ProgressDialog progressDialog2 = new ProgressDialog(this);
        this.f389s = progressDialog2;
        progressDialog2.setMessage(getString(g.C0008g.f560b));
        this.f389s.setCanceledOnTouchOutside(false);
        this.f389s.show();
    }

    @Override
    protected void onPause() {
        ProgressDialog progressDialog = this.f389s;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        this.f383d.onPause();
        super.onPause();
    }

    @Override
    protected void onResume() {
        J();
        if (s()) {
            this.f383d.onResume();
        }
        super.onResume();
    }

    @Override
    protected String[] t() {
        return new String[]{"android.permission.CAMERA"};
    }

    @Override
    protected void u() {
    }

    @Override
    protected void v() {
        new AlertDialog.a(this).setMessage(getString(g.C0008g.f583y)).setPositiveButton(getString(g.C0008g.C), new e()).create().show();
    }
}