导航菜单

页面标题

页面副标题

Súper Préstamo v1.9.1 - LivenessActivity.java 源代码

正在查看: Súper Préstamo v1.9.1 应用的 LivenessActivity.java JAVA 源代码文件

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


package aai.liveness.activity;

import aai.liveness.LivenessView;
import aai.liveness.http.entity.ResultEntity;
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 defpackage.eo;
import defpackage.go;
import defpackage.h60;
import defpackage.i60;
import defpackage.io;
import defpackage.kf0;
import defpackage.pe0;
import defpackage.t01;

public class LivenessActivity extends PermissionActivity implements h60 {
    public SparseArray a;
    public ImageView b;
    public LivenessView c;
    public ImageView d;
    public TextView e;
    public TextView f;
    public CheckBox h;
    public View j;
    public ProgressDialog m;

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

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

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

        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
            LivenessActivity.this.c.setSoundPlayEnable(z);
            if (z) {
                LivenessActivity.this.E();
            }
        }
    }

    public class c implements DialogInterface.OnClickListener {
        public final String a;

        public c(String str) {
            this.a = str;
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            pe0.q(this.a);
            dialogInterface.dismiss();
            LivenessActivity.this.setResult(-1);
            LivenessActivity.this.finish();
        }
    }

    public class d implements i60 {
        public d() {
        }

        @Override
        public void a(ResultEntity resultEntity) {
            if (!resultEntity.b && "NO_RESPONSE".equals(resultEntity.a)) {
                pe0.q(LivenessActivity.this.getString(R$string.liveness_failed_reason_bad_network));
            }
            LivenessActivity.this.F();
        }

        @Override
        public void b(ResultEntity resultEntity, String str) {
            LivenessActivity.this.F();
        }

        @Override
        public void c() {
            LivenessActivity.this.j.setVisibility(0);
            LivenessActivity.this.f.setVisibility(4);
            LivenessActivity.this.c.setVisibility(4);
            LivenessActivity.this.h.setVisibility(4);
            LivenessActivity.this.d.setVisibility(4);
            LivenessActivity.this.e.setVisibility(4);
            LivenessActivity.this.b.setVisibility(4);
        }
    }

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

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

    public static class f {
        public static final int[] a;
        public static final int[] b;
        public static final int[] c;

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

    public final void A(int i) {
        this.e.setText(i);
    }

    public void B() {
        this.b = (ImageView) findViewById(R$id.mask_view);
        this.c = (LivenessView) findViewById(R$id.liveness_view);
        this.d = (ImageView) findViewById(R$id.tip_image_view);
        this.e = (TextView) findViewById(R$id.tip_text_view);
        this.f = (TextView) findViewById(R$id.timer_text_view_camera_activity);
        this.j = findViewById(R$id.progress_layout);
        this.h = (CheckBox) findViewById(R$id.voice_check_box);
        findViewById(R$id.back_view_camera_activity).setOnClickListener(new a());
        this.h.setChecked(this.c.c());
        this.h.setOnCheckedChangeListener(new b());
    }

    public android.graphics.drawable.AnimationDrawable C(defpackage.go r3) {
        throw new UnsupportedOperationException("Method not decompiled: aai.liveness.activity.LivenessActivity.C(go):android.graphics.drawable.AnimationDrawable");
    }

    public final void D() {
        this.a = new SparseArray();
        this.c.setLivenssCallback(this);
    }

    public final void E() {
        int i;
        if (this.h.getVisibility() != 0) {
            this.h.setVisibility(0);
        }
        go currentDetectionType = this.c.getCurrentDetectionType();
        if (currentDetectionType != null) {
            int i2 = f.a[currentDetectionType.ordinal()];
            if (i2 == 1) {
                i = R$raw.action_turn_head;
            } else if (i2 == 2) {
                i = R$raw.action_open_mouth;
            } else if (i2 == 3) {
                i = R$raw.action_blink;
            }
            this.c.h(i, true, 1500L);
        }
        i = -1;
        this.c.h(i, true, 1500L);
    }

    public final void F() {
        setResult(-1);
        finish();
    }

    public final void G() {
        go currentDetectionType = this.c.getCurrentDetectionType();
        if (currentDetectionType != null) {
            int i = f.a[currentDetectionType.ordinal()];
            A(i != 1 ? i != 2 ? i != 3 ? 0 : R$string.liveness_blink : R$string.liveness_mouse : R$string.liveness_pos_raw);
            AnimationDrawable C = C(currentDetectionType);
            this.d.setImageDrawable(C);
            C.start();
        }
    }

    public final void H() {
        this.c.setVisibility(0);
        this.e.setVisibility(0);
        this.d.setVisibility(0);
        this.b.setVisibility(0);
        this.f.setText("");
        this.f.setBackgroundResource(0);
        this.f.setVisibility(0);
        this.h.setVisibility(4);
        this.d.setImageDrawable(null);
        this.j.setVisibility(4);
    }

    public final void I(io ioVar) {
        if (!this.c.d()) {
            A(R$string.liveness_hold_phone_vertical);
        }
        if (ioVar != null) {
            switch (f.b[ioVar.ordinal()]) {
                case 1:
                    A(R$string.liveness_no_people_face);
                    break;
                case 2:
                    A(R$string.liveness_tip_move_closer);
                    break;
                case 3:
                    A(R$string.liveness_tip_move_furthre);
                    break;
                case 4:
                    A(R$string.liveness_move_face_center);
                    break;
                case 5:
                    A(R$string.liveness_frontal);
                    break;
                case 6:
                case 7:
                    A(R$string.liveness_still);
                    break;
                case 8:
                    A(R$string.liveness_open_eyes);
                    break;
                case 9:
                    A(R$string.liveness_face_occ);
                    break;
                case 10:
                    A(R$string.liveness_weak_light);
                    break;
                case 11:
                    A(R$string.liveness_too_light);
                    break;
                case 12:
                    A(R$string.liveness_face_move_upper);
                    break;
                case 13:
                    A(R$string.liveness_face_move_down);
                    break;
                case 14:
                    A(R$string.liveness_face_move_left);
                    break;
                case 15:
                    A(R$string.liveness_face_move_right);
                    break;
                case 16:
                    G();
                    break;
                case 17:
                    A(R$string.liveness_large_yaw);
                    break;
            }
        }
    }

    @Override
    public void a() {
        ProgressDialog progressDialog = this.m;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        ProgressDialog progressDialog2 = new ProgressDialog(this);
        this.m = progressDialog2;
        progressDialog2.setMessage(getString(R$string.liveness_auth_check));
        this.m.setCanceledOnTouchOutside(false);
        this.m.show();
    }

    @Override
    public void b(boolean z, String str, String str2) {
        ProgressDialog progressDialog = this.m;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        if (z) {
            I(null);
            return;
        }
        if ("NO_RESPONSE".equals(str)) {
            str2 = getString(R$string.liveness_failed_reason_auth_failed);
        }
        new AlertDialog.Builder(this).setMessage(str2).setPositiveButton(R$string.liveness_perform, new c(str2)).create().show();
    }

    @Override
    public void c() {
        this.c.b(new d());
    }

    @Override
    public void d(long j) {
        int i = (int) (j / 1000);
        this.f.setText(i + "s");
    }

    @Override
    public void e(io ioVar) {
        I(ioVar);
    }

    @Override
    public void f() {
        E();
        G();
        this.f.setBackgroundResource(R$drawable.liveness_shape_right_timer);
    }

    @Override
    public void g(eo eoVar, go goVar) {
        String string;
        int[] iArr = f.c;
        int i = iArr[eoVar.ordinal()];
        if (i == 5) {
            A(R$string.liveness_weak_light);
            return;
        }
        if (i == 6) {
            A(R$string.liveness_too_light);
            return;
        }
        int i2 = iArr[eoVar.ordinal()];
        String str = null;
        if (i2 == 1) {
            int i3 = f.a[goVar.ordinal()];
            if (i3 == 1) {
                string = getString(R$string.liveness_failed_reason_facemissing_pos_yaw);
            } else if (i3 == 2 || i3 == 3) {
                string = getString(R$string.liveness_failed_reason_facemissing_blink_mouth);
            }
            str = string;
        } else if (i2 == 2) {
            str = getString(R$string.liveness_failed_reason_timeout);
        } else if (i2 == 3) {
            str = getString(R$string.liveness_failed_reason_multipleface);
        } else if (i2 == 4) {
            str = getString(R$string.liveness_failed_reason_muchaction);
        }
        pe0.q(str);
        F();
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R$layout.activity_liveness);
        t01.a(this, 255);
        B();
        D();
        if (!kf0.m() || o()) {
            return;
        }
        s();
    }

    @Override
    public void onDestroy() {
        this.c.e();
        this.a.clear();
        super.onDestroy();
    }

    @Override
    public void onPause() {
        ProgressDialog progressDialog = this.m;
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        this.c.f();
        super.onPause();
    }

    @Override
    public void onResume() {
        H();
        if (o()) {
            this.c.g();
        }
        super.onResume();
    }

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

    @Override
    public void q() {
    }

    @Override
    public void r() {
        new AlertDialog.Builder(this).setMessage(getString(R$string.liveness_no_camera_permission)).setPositiveButton(getString(R$string.liveness_perform), new e()).create().show();
    }
}