正在查看: Easycash v3.75.13 应用的 LivenessActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Easycash v3.75.13 应用的 LivenessActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package ai.advance.liveness.sdk.activity;
import ai.advance.common.IMediaPlayer;
import ai.advance.common.utils.SystemUtil;
import ai.advance.core.PermissionActivity;
import ai.advance.liveness.lib.Detector;
import ai.advance.liveness.lib.GuardianLivenessDetectionSDK;
import ai.advance.liveness.lib.LivenessBitmapCache;
import ai.advance.liveness.lib.LivenessView;
import ai.advance.liveness.lib.http.entity.ResultEntity;
import ai.advance.liveness.lib.impl.LivenessCallback;
import ai.advance.liveness.lib.impl.LivenessGetFaceDataCallback;
import ai.advance.liveness.sdk.R;
import android.annotation.SuppressLint;
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.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import com.sensorsdata.analytics.android.autotrack.aop.SensorsDataAutoTrackHelper;
import com.sensorsdata.analytics.android.sdk.SensorsDataInstrumented;
import com.yangqianguan.statistics.AutoTrackHelper;
public class LivenessActivity extends PermissionActivity implements LivenessCallback {
private SparseArray<AnimationDrawable> f922a;
protected ImageView f923b;
protected LivenessView f924c;
private ImageView f925d;
private TextView f926e;
private TextView f927f;
private CheckBox f928g;
private View f929h;
ProgressDialog f930i;
static class AnonymousClass6 {
static final int[] f937a;
static final int[] f938b;
static final int[] f939c;
static {
int[] iArr = new int[Detector.DetectionFailedType.values().length];
f939c = iArr;
try {
iArr[Detector.DetectionFailedType.FACEMISSING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f939c[Detector.DetectionFailedType.TIMEOUT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f939c[Detector.DetectionFailedType.MULTIPLEFACE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f939c[Detector.DetectionFailedType.MUCHMOTION.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f939c[Detector.DetectionFailedType.WEAKLIGHT.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f939c[Detector.DetectionFailedType.STRONGLIGHT.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
int[] iArr2 = new int[Detector.WarnCode.values().length];
f938b = iArr2;
try {
iArr2[Detector.WarnCode.FACEMISSING.ordinal()] = 1;
} catch (NoSuchFieldError unused7) {
}
try {
f938b[Detector.WarnCode.FACESMALL.ordinal()] = 2;
} catch (NoSuchFieldError unused8) {
}
try {
f938b[Detector.WarnCode.FACELARGE.ordinal()] = 3;
} catch (NoSuchFieldError unused9) {
}
try {
f938b[Detector.WarnCode.FACENOTCENTER.ordinal()] = 4;
} catch (NoSuchFieldError unused10) {
}
try {
f938b[Detector.WarnCode.FACENOTFRONTAL.ordinal()] = 5;
} catch (NoSuchFieldError unused11) {
}
try {
f938b[Detector.WarnCode.FACENOTSTILL.ordinal()] = 6;
} catch (NoSuchFieldError unused12) {
}
try {
f938b[Detector.WarnCode.FACECAPTURE.ordinal()] = 7;
} catch (NoSuchFieldError unused13) {
}
try {
f938b[Detector.WarnCode.WARN_EYE_OCCLUSION.ordinal()] = 8;
} catch (NoSuchFieldError unused14) {
}
try {
f938b[Detector.WarnCode.WARN_MOUTH_OCCLUSION.ordinal()] = 9;
} catch (NoSuchFieldError unused15) {
}
try {
f938b[Detector.WarnCode.WARN_WEAKLIGHT.ordinal()] = 10;
} catch (NoSuchFieldError unused16) {
}
try {
f938b[Detector.WarnCode.WARN_TOOLIGHT.ordinal()] = 11;
} catch (NoSuchFieldError unused17) {
}
try {
f938b[Detector.WarnCode.WARN_FACE_BIAS_BOTTOM.ordinal()] = 12;
} catch (NoSuchFieldError unused18) {
}
try {
f938b[Detector.WarnCode.WARN_FACE_BIAS_UP.ordinal()] = 13;
} catch (NoSuchFieldError unused19) {
}
try {
f938b[Detector.WarnCode.WARN_FACE_BIAS_RIGHT.ordinal()] = 14;
} catch (NoSuchFieldError unused20) {
}
try {
f938b[Detector.WarnCode.WARN_FACE_BIAS_LEFT.ordinal()] = 15;
} catch (NoSuchFieldError unused21) {
}
try {
f938b[Detector.WarnCode.FACEINACTION.ordinal()] = 16;
} catch (NoSuchFieldError unused22) {
}
int[] iArr3 = new int[Detector.DetectionType.values().length];
f937a = iArr3;
try {
iArr3[Detector.DetectionType.POS_YAW.ordinal()] = 1;
} catch (NoSuchFieldError unused23) {
}
try {
f937a[Detector.DetectionType.MOUTH.ordinal()] = 2;
} catch (NoSuchFieldError unused24) {
}
try {
f937a[Detector.DetectionType.BLINK.ordinal()] = 3;
} catch (NoSuchFieldError unused25) {
}
}
}
private void n(int i2) {
this.f926e.setText(i2);
}
private void p() {
this.f922a = new SparseArray<>();
this.f924c.setLivenssCallback(this);
}
public void q() {
int i2;
if (this.f928g.getVisibility() != 0) {
this.f928g.setVisibility(0);
}
Detector.DetectionType currentDetectionType = this.f924c.getCurrentDetectionType();
if (currentDetectionType != null) {
int i3 = AnonymousClass6.f937a[currentDetectionType.ordinal()];
if (i3 == 1) {
i2 = R.raw.action_turn_head;
} else if (i3 == 2) {
i2 = R.raw.action_open_mouth;
} else if (i3 == 3) {
i2 = R.raw.action_blink;
}
this.f924c.g(i2, true, 1500L);
}
i2 = -1;
this.f924c.g(i2, true, 1500L);
}
public void r() {
setResult(-1);
finish();
}
private void s() {
Detector.DetectionType currentDetectionType = this.f924c.getCurrentDetectionType();
if (currentDetectionType != null) {
int i2 = AnonymousClass6.f937a[currentDetectionType.ordinal()];
n(i2 != 1 ? i2 != 2 ? i2 != 3 ? 0 : R.string.liveness_blink : R.string.liveness_mouse : R.string.liveness_pos_raw);
AnimationDrawable drawRes = getDrawRes(currentDetectionType);
this.f925d.setImageDrawable(drawRes);
drawRes.start();
}
}
private void t() {
this.f924c.setVisibility(0);
this.f926e.setVisibility(0);
this.f925d.setVisibility(0);
this.f923b.setVisibility(0);
this.f927f.setText("");
this.f927f.setBackgroundResource(0);
this.f927f.setVisibility(0);
this.f928g.setVisibility(4);
this.f925d.setImageDrawable(null);
this.f929h.setVisibility(4);
}
private void u(Detector.WarnCode warnCode) {
if (!this.f924c.c()) {
n(R.string.liveness_hold_phone_vertical);
}
if (warnCode != null) {
switch (AnonymousClass6.f938b[warnCode.ordinal()]) {
case 1:
n(R.string.liveness_no_people_face);
break;
case 2:
n(R.string.liveness_tip_move_closer);
break;
case 3:
n(R.string.liveness_tip_move_furthre);
break;
case 4:
n(R.string.liveness_move_face_center);
break;
case 5:
n(R.string.liveness_frontal);
break;
case 6:
case 7:
n(R.string.liveness_still);
break;
case 8:
n(R.string.liveness_open_eyes);
break;
case 9:
n(R.string.liveness_face_occ);
break;
case 10:
n(R.string.liveness_weak_light);
break;
case 11:
n(R.string.liveness_too_light);
break;
case 12:
n(R.string.liveness_face_move_upper);
break;
case 13:
n(R.string.liveness_face_move_down);
break;
case 14:
n(R.string.liveness_face_move_left);
break;
case 15:
n(R.string.liveness_face_move_right);
break;
case 16:
s();
break;
}
}
}
@Override
protected String[] d() {
return new String[]{"android.permission.CAMERA"};
}
@Override
protected void f() {
new AlertDialog.Builder(this).setMessage(getString(R.string.liveness_no_camera_permission)).setPositiveButton(getString(R.string.liveness_perform), new DialogInterface.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(DialogInterface dialogInterface, int i2) {
LivenessActivity.this.finish();
SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i2);
AutoTrackHelper.trackViewOnClick(dialogInterface, i2);
}
}).create().show();
}
public android.graphics.drawable.AnimationDrawable getDrawRes(ai.advance.liveness.lib.Detector.DetectionType r3) {
throw new UnsupportedOperationException("Method not decompiled: ai.advance.liveness.sdk.activity.LivenessActivity.getDrawRes(ai.advance.liveness.lib.Detector$DetectionType):android.graphics.drawable.AnimationDrawable");
}
protected void o() {
this.f923b = (ImageView) findViewById(R.id.mask_view);
this.f924c = (LivenessView) findViewById(R.id.liveness_view);
this.f925d = (ImageView) findViewById(R.id.tip_image_view);
this.f926e = (TextView) findViewById(R.id.tip_text_view);
this.f927f = (TextView) findViewById(R.id.timer_text_view_camera_activity);
this.f929h = findViewById(R.id.progress_layout);
this.f928g = (CheckBox) findViewById(R.id.voice_check_box);
findViewById(R.id.back_view_camera_activity).setOnClickListener(new View.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(View view) {
LivenessActivity.this.onBackPressed();
SensorsDataAutoTrackHelper.trackViewOnClick(view);
AutoTrackHelper.trackViewOnClick(view);
}
});
this.f928g.setChecked(IMediaPlayer.g());
this.f928g.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
@SensorsDataInstrumented
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
LivenessActivity.this.f924c.setSoundPlayEnable(z);
if (z) {
LivenessActivity.this.q();
}
SensorsDataAutoTrackHelper.trackViewOnClick(compoundButton);
AutoTrackHelper.b(compoundButton, z);
}
});
}
@Override
@SuppressLint({"SetTextI18n"})
public void onActionRemainingTimeChanged(long j2) {
int i2 = (int) (j2 / 1000);
this.f927f.setText(i2 + "s");
}
@Override
protected void onCreate(@Nullable Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_liveness);
SystemUtil.a(this, 255);
o();
p();
if (!GuardianLivenessDetectionSDK.m() || c()) {
return;
}
requestPermissions();
}
@Override
protected void onDestroy() {
this.f924c.d();
this.f922a.clear();
super.onDestroy();
}
@Override
public void onDetectionActionChanged() {
q();
s();
this.f927f.setBackgroundResource(R.drawable.liveness_shape_right_timer);
}
@Override
public void onDetectionFailed(Detector.DetectionFailedType detectionFailedType, Detector.DetectionType detectionType) {
String string;
int[] iArr = AnonymousClass6.f939c;
int i2 = iArr[detectionFailedType.ordinal()];
if (i2 == 5) {
n(R.string.liveness_weak_light);
return;
}
if (i2 == 6) {
n(R.string.liveness_too_light);
return;
}
int i3 = iArr[detectionFailedType.ordinal()];
String str = null;
if (i3 == 1) {
int i4 = AnonymousClass6.f937a[detectionType.ordinal()];
if (i4 == 1) {
string = getString(R.string.liveness_failed_reason_facemissing_pos_yaw);
} else if (i4 == 2 || i4 == 3) {
string = getString(R.string.liveness_failed_reason_facemissing_blink_mouth);
}
str = string;
} else if (i3 == 2) {
str = getString(R.string.liveness_failed_reason_timeout);
} else if (i3 == 3) {
str = getString(R.string.liveness_failed_reason_multipleface);
} else if (i3 == 4) {
str = getString(R.string.liveness_failed_reason_muchaction);
}
LivenessBitmapCache.n(str);
r();
}
@Override
public void onDetectionFrameStateChanged(Detector.WarnCode warnCode) {
u(warnCode);
}
@Override
public void onDetectionSuccess() {
this.f924c.b(new LivenessGetFaceDataCallback() {
@Override
public void a(ResultEntity resultEntity, String str) {
LivenessActivity.this.r();
}
@Override
public void b() {
LivenessActivity.this.f929h.setVisibility(0);
LivenessActivity.this.f927f.setVisibility(4);
LivenessActivity.this.f924c.setVisibility(4);
LivenessActivity.this.f928g.setVisibility(4);
LivenessActivity.this.f925d.setVisibility(4);
LivenessActivity.this.f926e.setVisibility(4);
LivenessActivity.this.f923b.setVisibility(4);
}
@Override
public void c(ResultEntity resultEntity) {
if (!resultEntity.f713b && "NO_RESPONSE".equals(resultEntity.f712a)) {
LivenessBitmapCache.n(LivenessActivity.this.getString(R.string.liveness_failed_reason_bad_network));
}
LivenessActivity.this.r();
}
});
}
@Override
public void onDetectorInitComplete(boolean z, String str, final String str2) {
ProgressDialog progressDialog = this.f930i;
if (progressDialog != null) {
progressDialog.dismiss();
}
if (z) {
u(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 DialogInterface.OnClickListener() {
@Override
@SensorsDataInstrumented
public void onClick(DialogInterface dialogInterface, int i2) {
LivenessBitmapCache.n(str2);
dialogInterface.dismiss();
LivenessActivity.this.setResult(-1);
LivenessActivity.this.finish();
SensorsDataAutoTrackHelper.trackDialog(dialogInterface, i2);
AutoTrackHelper.trackViewOnClick(dialogInterface, i2);
}
}).create().show();
}
@Override
public void onDetectorInitStart() {
ProgressDialog progressDialog = this.f930i;
if (progressDialog != null) {
progressDialog.dismiss();
}
ProgressDialog progressDialog2 = new ProgressDialog(this);
this.f930i = progressDialog2;
progressDialog2.setMessage(getString(R.string.liveness_auth_check));
this.f930i.setCanceledOnTouchOutside(false);
this.f930i.show();
}
@Override
protected void onPause() {
ProgressDialog progressDialog = this.f930i;
if (progressDialog != null) {
progressDialog.dismiss();
}
this.f924c.e();
super.onPause();
}
@Override
protected void onResume() {
t();
if (c()) {
this.f924c.f();
}
super.onResume();
}
@Override
protected void e() {
}
}