正在查看: TruCred v1.1.3 应用的 LivenessActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: TruCred v1.1.3 应用的 LivenessActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package aai.liveness.activity;
import a3d2025071099291226074.oo00oOO;
import a3d2025071099291226074.ooO00O0O0Oo;
import aai.liveness.Detector;
import aai.liveness.LivenessView;
import aai.liveness.http.entity.ResultEntity;
import aai.liveness.impl.LivenessCallback;
import aai.liveness.impl.LivenessGetFaceDataCallback;
import ai.advance.common.utils.SystemUtil;
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;
public class LivenessActivity extends PermissionActivity implements LivenessCallback {
private SparseArray<AnimationDrawable> mDrawableCache;
ProgressDialog mInitProgressDialog;
protected LivenessView mLivenessView;
private View mProgressLayout;
private View mTextViewLoading;
private TextView mTimerView;
private ImageView mTipImageView;
private TextView mTipTextView;
private CheckBox mVoiceCheckBox;
public static class AnonymousClass6 {
static final int[] $SwitchMap$aai$liveness$Detector$DetectionFailedType;
static final int[] $SwitchMap$aai$liveness$Detector$DetectionType;
static final int[] $SwitchMap$aai$liveness$Detector$WarnCode;
static {
int[] iArr = new int[Detector.DetectionFailedType.values().length];
$SwitchMap$aai$liveness$Detector$DetectionFailedType = iArr;
try {
iArr[Detector.DetectionFailedType.FACEMISSING.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionFailedType[Detector.DetectionFailedType.TIMEOUT.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionFailedType[Detector.DetectionFailedType.MULTIPLEFACE.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionFailedType[Detector.DetectionFailedType.MUCHMOTION.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionFailedType[Detector.DetectionFailedType.WEAKLIGHT.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionFailedType[Detector.DetectionFailedType.STRONGLIGHT.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
int[] iArr2 = new int[Detector.WarnCode.values().length];
$SwitchMap$aai$liveness$Detector$WarnCode = iArr2;
try {
iArr2[Detector.WarnCode.FACEMISSING.ordinal()] = 1;
} catch (NoSuchFieldError unused7) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACESMALL.ordinal()] = 2;
} catch (NoSuchFieldError unused8) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACELARGE.ordinal()] = 3;
} catch (NoSuchFieldError unused9) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACENOTCENTER.ordinal()] = 4;
} catch (NoSuchFieldError unused10) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACENOTFRONTAL.ordinal()] = 5;
} catch (NoSuchFieldError unused11) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACENOTSTILL.ordinal()] = 6;
} catch (NoSuchFieldError unused12) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACECAPTURE.ordinal()] = 7;
} catch (NoSuchFieldError unused13) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_EYE_OCCLUSION.ordinal()] = 8;
} catch (NoSuchFieldError unused14) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_MOUTH_OCCLUSION.ordinal()] = 9;
} catch (NoSuchFieldError unused15) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_WEAKLIGHT.ordinal()] = 10;
} catch (NoSuchFieldError unused16) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_TOOLIGHT.ordinal()] = 11;
} catch (NoSuchFieldError unused17) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_FACE_BIAS_BOTTOM.ordinal()] = 12;
} catch (NoSuchFieldError unused18) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_FACE_BIAS_UP.ordinal()] = 13;
} catch (NoSuchFieldError unused19) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_FACE_BIAS_RIGHT.ordinal()] = 14;
} catch (NoSuchFieldError unused20) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_FACE_BIAS_LEFT.ordinal()] = 15;
} catch (NoSuchFieldError unused21) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.PLEASE_BLINK.ordinal()] = 16;
} catch (NoSuchFieldError unused22) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.FACEINACTION.ordinal()] = 17;
} catch (NoSuchFieldError unused23) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_LARGE_YAW.ordinal()] = 18;
} catch (NoSuchFieldError unused24) {
}
try {
$SwitchMap$aai$liveness$Detector$WarnCode[Detector.WarnCode.WARN_MULTIPLEFACES.ordinal()] = 19;
} catch (NoSuchFieldError unused25) {
}
int[] iArr3 = new int[Detector.DetectionType.values().length];
$SwitchMap$aai$liveness$Detector$DetectionType = iArr3;
try {
iArr3[Detector.DetectionType.POS_YAW.ordinal()] = 1;
} catch (NoSuchFieldError unused26) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionType[Detector.DetectionType.MOUTH.ordinal()] = 2;
} catch (NoSuchFieldError unused27) {
}
try {
$SwitchMap$aai$liveness$Detector$DetectionType[Detector.DetectionType.BLINK.ordinal()] = 3;
} catch (NoSuchFieldError unused28) {
}
}
}
private void changeTipTextView(int i2) {
this.mTipTextView.setText(i2);
}
private void initData() {
this.mDrawableCache = new SparseArray<>();
this.mLivenessView.setLivenssCallback(this);
}
public void playSound() {
int i2;
if (this.mVoiceCheckBox.getVisibility() != 0) {
this.mVoiceCheckBox.setVisibility(0);
}
Detector.DetectionType currentDetectionType = this.mLivenessView.getCurrentDetectionType();
if (currentDetectionType != null) {
int i3 = AnonymousClass6.$SwitchMap$aai$liveness$Detector$DetectionType[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.mLivenessView.playSound(i2, true, 1500L);
}
i2 = -1;
this.mLivenessView.playSound(i2, true, 1500L);
}
public void setResultData() {
setResult(-1);
finish();
}
private void showActionTipUIView() {
Detector.DetectionType currentDetectionType = this.mLivenessView.getCurrentDetectionType();
if (currentDetectionType != null) {
int i2 = AnonymousClass6.$SwitchMap$aai$liveness$Detector$DetectionType[currentDetectionType.ordinal()];
changeTipTextView(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.mTipImageView.setImageDrawable(drawRes);
drawRes.start();
}
}
private void uiReset() {
this.mLivenessView.setVisibility(0);
this.mTipTextView.setVisibility(0);
this.mTipImageView.setVisibility(0);
this.mTimerView.setText("");
this.mTimerView.setBackgroundResource(0);
this.mTimerView.setVisibility(0);
this.mVoiceCheckBox.setVisibility(4);
this.mTipImageView.setImageDrawable(null);
this.mProgressLayout.setVisibility(4);
this.mTextViewLoading.setVisibility(4);
}
private void updateTipUIView(Detector.WarnCode warnCode) {
if (!this.mLivenessView.isVertical()) {
changeTipTextView(R.string.liveness_hold_phone_vertical);
}
if (warnCode != null) {
switch (AnonymousClass6.$SwitchMap$aai$liveness$Detector$WarnCode[warnCode.ordinal()]) {
case 1:
changeTipTextView(R.string.liveness_no_people_face);
break;
case 2:
changeTipTextView(R.string.liveness_tip_move_closer);
break;
case 3:
changeTipTextView(R.string.liveness_tip_move_furthre);
break;
case 4:
changeTipTextView(R.string.liveness_move_face_center);
break;
case 5:
changeTipTextView(R.string.liveness_frontal);
break;
case 6:
case 7:
changeTipTextView(R.string.liveness_still);
break;
case 8:
changeTipTextView(R.string.liveness_open_eyes);
break;
case 9:
changeTipTextView(R.string.liveness_face_occ);
break;
case 10:
changeTipTextView(R.string.liveness_weak_light);
break;
case 11:
changeTipTextView(R.string.liveness_too_light);
break;
case 12:
case 13:
case 14:
case 15:
changeTipTextView(R.string.liveness_face_move);
break;
case 16:
changeTipTextView(R.string.liveness_blink);
break;
case 17:
showActionTipUIView();
break;
case 18:
changeTipTextView(R.string.liveness_large_yaw);
break;
case 19:
changeTipTextView(R.string.liveness_multi_faces);
break;
}
}
}
public void findViews() {
this.mLivenessView = (LivenessView) findViewById(R.id.liveness_view);
this.mTipImageView = (ImageView) findViewById(R.id.tip_image_view);
this.mTipTextView = (TextView) findViewById(R.id.tip_text_view);
this.mTimerView = (TextView) findViewById(R.id.timer_text_view_camera_activity);
this.mProgressLayout = findViewById(R.id.progress_layout);
this.mVoiceCheckBox = (CheckBox) findViewById(R.id.voice_check_box);
View findViewById = findViewById(R.id.back_view_camera_activity);
this.mTextViewLoading = findViewById(R.id.text_view_loading);
findViewById.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LivenessActivity.this.onBackPressed();
}
});
this.mVoiceCheckBox.setChecked(this.mLivenessView.isSoundPlayEnable());
this.mVoiceCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
LivenessActivity.this.mLivenessView.setSoundPlayEnable(z);
if (z) {
LivenessActivity.this.playSound();
}
}
});
}
public android.graphics.drawable.AnimationDrawable getDrawRes(aai.liveness.Detector.DetectionType r3) {
throw new UnsupportedOperationException("Method not decompiled: aai.liveness.activity.LivenessActivity.getDrawRes(aai.liveness.Detector$DetectionType):android.graphics.drawable.AnimationDrawable");
}
@Override
public String[] getRequiredPermissions() {
return new String[]{"android.permission.CAMERA"};
}
@Override
public void onActionRemainingTimeChanged(long j) {
this.mTimerView.setText(((int) (j / 1000)) + "s");
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_liveness);
SystemUtil.changeActivityBrightness(this, 255);
findViews();
initData();
if (!oo00oOO.isSDKHandleCameraPermission() || allPermissionsGranted()) {
return;
}
requestPermissions();
}
@Override
public void onDestroy() {
this.mLivenessView.onDestroy();
this.mDrawableCache.clear();
super.onDestroy();
}
@Override
public void onDetectionActionChanged() {
playSound();
showActionTipUIView();
this.mTimerView.setBackgroundResource(R.drawable.liveness_shape_right_timer);
}
@Override
public void onDetectionFailed(Detector.DetectionFailedType detectionFailedType, Detector.DetectionType detectionType) {
int[] iArr = AnonymousClass6.$SwitchMap$aai$liveness$Detector$DetectionFailedType;
int i2 = iArr[detectionFailedType.ordinal()];
if (i2 == 5) {
changeTipTextView(R.string.liveness_weak_light);
return;
}
if (i2 == 6) {
changeTipTextView(R.string.liveness_too_light);
return;
}
int i3 = iArr[detectionFailedType.ordinal()];
String str = null;
if (i3 == 1) {
int i4 = AnonymousClass6.$SwitchMap$aai$liveness$Detector$DetectionType[detectionType.ordinal()];
if (i4 == 1) {
str = getString(R.string.liveness_failed_reason_facemissing_pos_yaw);
} else if (i4 == 2 || i4 == 3) {
str = getString(R.string.liveness_failed_reason_facemissing_blink_mouth);
}
} 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);
}
ooO00O0O0Oo.setErrorMsg(str);
setResultData();
}
@Override
public void onDetectionFrameStateChanged(Detector.WarnCode warnCode) {
updateTipUIView(warnCode);
}
@Override
public void onDetectionSuccess() {
this.mLivenessView.getLivenessData(new LivenessGetFaceDataCallback() {
@Override
public void onGetFaceDataFailed(ResultEntity resultEntity) {
if (!resultEntity.success && "NO_RESPONSE".equals(resultEntity.code)) {
ooO00O0O0Oo.setErrorMsg(LivenessActivity.this.getString(R.string.liveness_failed_reason_bad_network));
}
LivenessActivity.this.setResultData();
}
@Override
public void onGetFaceDataStart() {
LivenessActivity.this.mProgressLayout.setVisibility(0);
LivenessActivity.this.mTimerView.setVisibility(4);
LivenessActivity.this.mLivenessView.setVisibility(4);
LivenessActivity.this.mVoiceCheckBox.setVisibility(4);
LivenessActivity.this.mTipImageView.setVisibility(4);
LivenessActivity.this.mTipTextView.setVisibility(4);
LivenessActivity.this.mTextViewLoading.setVisibility(0);
}
@Override
public void onGetFaceDataSuccess(ResultEntity resultEntity, String str) {
LivenessActivity.this.setResultData();
}
});
}
@Override
public void onDetectorInitComplete(boolean z, String str, final String str2) {
ProgressDialog progressDialog = this.mInitProgressDialog;
if (progressDialog != null) {
progressDialog.dismiss();
}
if (z) {
updateTipUIView(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
public void onClick(DialogInterface dialogInterface, int i2) {
ooO00O0O0Oo.setErrorMsg(str2);
dialogInterface.dismiss();
LivenessActivity.this.setResult(-1);
LivenessActivity.this.finish();
}
}).create().show();
}
@Override
public void onDetectorInitStart() {
ProgressDialog progressDialog = this.mInitProgressDialog;
if (progressDialog != null) {
progressDialog.dismiss();
}
ProgressDialog progressDialog2 = new ProgressDialog(this);
this.mInitProgressDialog = progressDialog2;
progressDialog2.setMessage(getString(R.string.liveness_auth_check));
this.mInitProgressDialog.setCanceledOnTouchOutside(false);
this.mInitProgressDialog.show();
}
@Override
public void onPause() {
ProgressDialog progressDialog = this.mInitProgressDialog;
if (progressDialog != null) {
progressDialog.dismiss();
}
this.mLivenessView.onPause();
super.onPause();
}
@Override
public void onPermissionGranted() {
}
@Override
public void onPermissionRefused() {
new AlertDialog.Builder(this).setMessage(getString(R.string.liveness_no_camera_permission)).setPositiveButton(getString(R.string.liveness_perform), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i2) {
LivenessActivity.this.finish();
}
}).create().show();
}
@Override
public void onResume() {
uiReset();
if (allPermissionsGranted()) {
this.mLivenessView.onResume();
}
super.onResume();
}
}