导航菜单

页面标题

页面副标题

CreditNow v1.0.2 - c.java 源代码

正在查看: CreditNow v1.0.2 应用的 c.java JAVA 源代码文件

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


package com.regula.facesdk;

import android.content.Intent;
import android.graphics.Point;
import android.graphics.RectF;
import android.hardware.Camera;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Vibrator;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.Observer;
import com.regula.common.VideoRecordingActivity;
import com.regula.common.customization.b;
import com.regula.facesdk.api.r0;
import com.regula.facesdk.c;
import com.regula.facesdk.configuration.CameraConfiguration;
import com.regula.facesdk.exception.FaceCaptureException;
import com.regula.facesdk.view.FaceAreaView;
import defpackage.c15;
import defpackage.cm2;
import defpackage.d31;
import defpackage.ef3;
import defpackage.es3;
import defpackage.f71;
import defpackage.fx;
import defpackage.g35;
import defpackage.g71;
import defpackage.gx;
import defpackage.h35;
import defpackage.hx;
import defpackage.i71;
import defpackage.iz4;
import defpackage.j25;
import defpackage.ju0;
import defpackage.kl4;
import defpackage.lz4;
import defpackage.m71;
import defpackage.mq4;
import defpackage.q25;
import defpackage.s05;
import defpackage.s15;
import defpackage.s71;
import defpackage.t25;
import defpackage.t72;
import defpackage.tz4;
import defpackage.w05;
import defpackage.y62;
import defpackage.yp1;
import defpackage.zw;
import java.io.File;
import java.lang.ref.WeakReference;
import java.lang.reflect.InvocationTargetException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
import org.json.JSONException;
import org.json.JSONObject;

public abstract class c extends VideoRecordingActivity implements fx, s71.a, s05 {
    public boolean A1;
    public s15 E1;
    public t25 F1;
    public boolean G1;
    public Vibrator H1;
    public CameraConfiguration I1;
    public boolean J1;
    public HashMap K1;
    public int M1;
    public w05 N1;
    public int O1;
    public r0 P1;
    public s71 v1;
    public int w1;
    public float z1;
    public int x1 = -1;
    public int y1 = 1;
    public boolean B1 = true;
    public int C1 = 0;
    public Handler D1 = new Handler(Looper.getMainLooper());
    public boolean L1 = false;
    public final View.OnClickListener Q1 = new lz4(this);
    public final Observer R1 = new Observer() {
        public final void onChanged(Object obj) {
            c.this.N0((kl4) obj);
        }
    };

    public abstract void K0(gx gxVar);

    public final void L0(g71 g71Var) {
        m71.o().b.b("Notify client and finish activity");
        m1();
        m71 o = m71.o();
        o.getClass();
        o.d = false;
        o.m = null;
        o.f();
        finish();
    }

    public abstract void M0(y62 y62Var);

    public final void N0(kl4 kl4Var) {
        this.P1.g.i(kl4Var);
    }

    public final void O0(mq4 mq4Var, int i, String str, int i2, String str2) {
        P0(mq4Var, str2, i, str, false);
    }

    public void P0(mq4 mq4Var, String str, int i, String str2, boolean z) {
        m71.o().b.b("Encoding finished, output file: " + str);
        String str3 = (String) this.K1.get(str2);
        if (j1() || ((str3 != null && str3.equals(str2)) || z)) {
            Q0(mq4Var, str, str2, i);
        } else {
            m71.o().b.b("Put video to queue");
            this.K1.put(str2, str);
        }
    }

    public void Q0(mq4 mq4Var, String str, String str2, int i) {
        m71.o().b.b("Send liveness video");
        File file = new File(str);
        if (file.exists()) {
            this.F1.i(file, mq4Var.w(), mq4Var.x(), str2, b1(), i);
        }
    }

    public final void R0(RectF rectF, w05 w05Var) {
        this.J1 = this.P1.g.q(rectF, w05Var, new tz4(this));
    }

    public final void T0(defpackage.w05 r16, float r17, int r18, android.graphics.RectF r19, defpackage.c15 r20) {
        throw new UnsupportedOperationException("Method not decompiled: com.regula.facesdk.c.T0(w05, float, int, android.graphics.RectF, c15):void");
    }

    public final void U0(JSONObject jSONObject) {
        if (jSONObject != null) {
            r0 r0Var = this.P1;
            b.d(r0Var.k, r0Var.j, jSONObject, this.Q1);
        } else {
            this.P1.k.removeAllViews();
            this.P1.j.removeAllViews();
        }
    }

    public final void V0(boolean z) {
        if (this.t1.N1() && this.t1.V1() != 1) {
            this.t1.R1(z);
            return;
        }
        this.A1 = z;
        this.v1.j2(this.z1);
        this.P1.g.setLightState(z);
        r0 r0Var = this.P1;
        r0Var.e.setBackgroundColor(r0Var.g.getOverlayColor());
    }

    public abstract void W0();

    public abstract s05 X0();

    public abstract String Y0();

    public final int Z0() {
        int rotation = getWindowManager().getDefaultDisplay().getRotation();
        if (rotation == 1) {
            return 90;
        }
        if (rotation != 2) {
            return rotation != 3 ? 0 : 270;
        }
        return 180;
    }

    public abstract int a1();

    public void b() {
        p1();
        if (this.L1) {
            setRequestedOrientation(14);
        }
        m71.o().b.b("Face detection completed");
        this.P1.g.s();
        this.P1.b.e();
        this.P1.g.setFaceHoldStill(false);
        l1();
        this.P1.l.setVisibility(4);
        this.P1.d.setVisibility(4);
        this.P1.i.setVisibility(0);
        F0();
    }

    public abstract String b1();

    public void c() {
        l1();
        F0();
    }

    public abstract Float c1();

    public void d() {
        m71.o().b.b("Click on swap button in parent activity");
        this.v1.b2(false);
        V0(false);
        int i = this.x1 - 1;
        this.x1 = i;
        if (i < 0) {
            this.x1 = this.w1 - 1;
        }
        this.B1 = true;
        this.t1.D2(this.x1);
        m71 o = m71.o();
        int i2 = this.x1;
        o.b.b("Notify client with change camera id=" + i2);
    }

    public abstract Integer d1();

    @Override
    public final void e(boolean z) {
        V0(z);
    }

    public abstract Integer e1();

    public abstract Float f1();

    public final void finish() {
        super/*android.app.Activity*/.finish();
        this.G1 = true;
    }

    public abstract Float g1();

    public abstract String h1();

    public final void i1() {
        MutableLiveData<JSONObject> b = m71.o().q().b();
        if (b != null) {
            b.observe(this, new Observer() {
                public final void onChanged(Object obj) {
                    c.this.U0((JSONObject) obj);
                }
            });
        }
    }

    public abstract boolean j1();

    public abstract boolean k1();

    public final void l1() {
        this.B1 = true;
        this.E1.d();
        this.r1 = false;
    }

    @Override
    public final boolean m() {
        return this.A1 || this.t1.o2();
    }

    public void m1() {
        s71 s71Var = this.v1;
        if (s71Var != null) {
            s71Var.d2();
        }
        m71.o().q().a().removeObserver(this.R1);
    }

    @Override
    public final void n(byte[] bArr) {
        String str;
        int Z0 = Z0();
        if (Math.abs(this.M1 - Z0) == 180) {
            m71.o().b.b("recreate activity after rotate");
            ef3 ef3Var = this.t1;
            ef3Var.D2(ef3Var.U1());
            W0();
            this.M1 = Z0;
            return;
        }
        E0(bArr);
        if (this.B1) {
            int i = this.C1;
            this.C1 = i + 1;
            if (i < 5) {
                m71.o().b.b("onFrame: Preview frame when completed already, ignoring");
                return;
            }
            return;
        }
        this.C1 = 0;
        if (this.E1.H() || this.t1.T1(bArr) == null) {
            return;
        }
        m71.o().b.b("onFrame: put frame to Face Detector Module");
        s15 s15Var = this.E1;
        getApplicationContext();
        ByteBuffer T1 = this.t1.T1(Arrays.copyOf(bArr, bArr.length));
        Float j2 = this.t1.j2();
        Integer k2 = this.t1.k2();
        Float S1 = this.t1.S1();
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("ExposureTime", j2);
            jSONObject.put("ISO", k2);
            jSONObject.put("BrightnessValue", hx.f(j2, k2, S1));
            str = jSONObject.toString();
        } catch (JSONException e) {
            m71.o().b.e(e);
            str = null;
        }
        String Y0 = Y0();
        JSONObject jSONObject2 = new JSONObject();
        if (str != null) {
            try {
                jSONObject2.put("cameraState", new JSONObject(str));
            } catch (JSONException e2) {
                m71.o().b.e(e2);
            }
        }
        if (Y0 != null) {
            jSONObject2.put("deviceOrientation", new JSONObject(Y0));
        }
        s15Var.v(T1, jSONObject2.toString());
    }

    public final void n1() {
        m71.o().b.b("Start encoding video");
        final int i = this.y1;
        final String h1 = h1();
        final mq4 mq4Var = this.p1;
        mq4Var.P(new d31.c() {
            @Override
            public final void a(int i2, String str) {
                c.this.O0(mq4Var, i, h1, i2, str);
            }
        });
    }

    public boolean o1() {
        ArrayList arrayList;
        this.N1 = null;
        M0(y62.c);
        m71.o().b.b("Called start new session");
        j25 j25Var = new j25();
        j25Var.q(this.t1.e2());
        j25Var.o(this.t1.d2());
        j25Var.h((this.t1.V1() == 1 ? this.t1.W1() + Z0() : (this.t1.W1() - Z0()) + 360) % 360);
        this.t1.V1();
        j25Var.l(ju0.e(getApplicationContext()));
        j25Var.c(ju0.b(getApplicationContext()));
        j25Var.g(this.t1.f2());
        j25Var.b(this.t1.b2());
        j25Var.m(g1());
        j25Var.j(e1());
        j25Var.i(f1());
        j25Var.e(d1());
        j25Var.d(c1());
        h35 p = this.E1.p(a1(), j25Var);
        if (p == null || (arrayList = p.a) == null || arrayList.size() != 2) {
            return false;
        }
        float h2 = this.t1.h2() / (this.s1 == 0 ? this.t1.e2() : this.t1.d2());
        float i2 = this.t1.i2() / (this.s1 == 0 ? this.t1.d2() : this.t1.e2());
        this.P1.g.p(p.a, i2, h2, this.t1.i2(), this.t1.h2());
        this.P1.g.setStage(c15.a);
        this.v1.a2(this.P1.g.getOvalRectF());
        ArrayList arrayList2 = p.a;
        if (arrayList2 == null || arrayList2.size() != 2) {
            m71.o().b.f("Cannot set oval size for empty oval area list");
        } else {
            g35 g35Var = (g35) p.a.get(1);
            int i = p.b;
            ViewGroup.LayoutParams layoutParams = this.P1.b.getLayoutParams();
            Point point = g35Var.a;
            layoutParams.height = (int) (point.y * 2 * h2);
            layoutParams.width = (int) (point.x * 2 * i2);
            this.P1.b.setLayoutParams(layoutParams);
            this.P1.b.setNumSectors(i);
        }
        float h22 = this.t1.h2() / (this.s1 == 0 ? this.t1.e2() : this.t1.d2());
        float i22 = this.t1.i2() / (this.s1 == 0 ? this.t1.d2() : this.t1.e2());
        ArrayList arrayList3 = p.a;
        if (arrayList3 == null || arrayList3.size() != 2) {
            m71.o().b.f("Cannot shift camera layout for empty oval area list");
        } else {
            float height = ((this.P1.g.getHeight() - Math.max(FaceAreaView.d(this.P1.g, (g35) p.a.get(0), i22, h22, this.t1.i2(), this.t1.h2()).height(), FaceAreaView.d(this.P1.g, (g35) p.a.get(1), i22, h22, this.t1.i2(), this.t1.h2()).height())) / 2.0f) - getResources().getDimension(R$dimen.facesdk_camera_constraint_layout_shift);
            if (height >= 0.0f) {
                double d = height;
                this.P1.c.setY(-((float) Math.floor(d)));
                this.P1.j.setY((float) Math.floor(d));
            }
        }
        this.P1.g.h(p.b);
        this.P1.g.setNumSectors(p.b);
        this.P1.g.setRotation(this.t1.W1() / 90);
        if (this.r1) {
            this.p1 = new mq4(this, j1(), new File(getFilesDir(), "FaceVideo").getPath());
            G0();
            n1();
        } else {
            m71.o().b.b("Video encoder is not initialized");
        }
        return true;
    }

    public void onBackPressed() {
        m71.o().i(this);
        s15 s15Var = this.E1;
        if (s15Var != null) {
            s15Var.I();
        }
        this.q1 = 1;
        F0();
    }

    public void onCreate(Bundle bundle) {
        m71.o().b.b("onCreate in parent activity");
        super/*androidx.fragment.app.FragmentActivity*/.onCreate(bundle);
        this.H1 = (Vibrator) getSystemService("vibrator");
        Intent intent = getIntent();
        if (intent != null) {
            this.I1 = (CameraConfiguration) intent.getParcelableExtra("configuration");
        }
        CameraConfiguration cameraConfiguration = this.I1;
        int i = -1;
        if (cameraConfiguration == null || cameraConfiguration.c() == null || this.I1.c().length <= 0) {
            this.s1 = 0;
            setRequestedOrientation(1);
        } else {
            boolean contains = Arrays.asList(this.I1.c()).contains(es3.b);
            boolean contains2 = Arrays.asList(this.I1.c()).contains(es3.a);
            int Z0 = Z0();
            if (contains2 && !contains) {
                setRequestedOrientation(1);
                this.s1 = 0;
            } else if (contains2 || !contains) {
                this.L1 = true;
                m71.o().b.b("orientation " + Z0);
                if (Z0 == 270) {
                    this.s1 = 1;
                } else if (Z0 == 90) {
                    this.s1 = 2;
                } else {
                    this.s1 = 0;
                }
                setRequestedOrientation(-1);
            } else if (Z0 == 270) {
                setRequestedOrientation(8);
                this.s1 = 1;
            } else {
                this.s1 = 2;
                setRequestedOrientation(0);
            }
            this.M1 = Z0;
        }
        this.P1 = r0.a(getLayoutInflater());
        this.K1 = new HashMap();
        if (Build.VERSION.SDK_INT >= 29) {
            q8.a(getWindow().getDecorView().getRootView(), false);
        }
        setContentView(this.P1.a());
        if (intent != null) {
            CameraConfiguration cameraConfiguration2 = this.I1;
            if (cameraConfiguration2 != null) {
                this.x1 = cameraConfiguration2.a();
                if (!this.I1.d()) {
                    this.P1.f.setVisibility(8);
                }
            }
            if (!intent.getBooleanExtra("PermissionGranted", true)) {
                K0(gx.b);
                return;
            } else if (!intent.getBooleanExtra("AnyCameraAvailable", true)) {
                K0(gx.a);
                return;
            }
        }
        this.w1 = Camera.getNumberOfCameras();
        int i2 = 0;
        while (true) {
            if (i2 >= this.w1) {
                break;
            }
            Camera.CameraInfo cameraInfo = new Camera.CameraInfo();
            Camera.getCameraInfo(i2, cameraInfo);
            if (this.x1 == -1 && cameraInfo.facing == 1) {
                i = i2;
                break;
            }
            i2++;
        }
        int i3 = this.x1;
        if (i3 < 0 || i3 >= this.w1) {
            this.x1 = i;
        }
        this.P1.g.setBackgroundOverlayTransparent(false);
        FragmentManager d0 = d0();
        this.t1 = (zw) d0.h0("cameraFragmentTag");
        this.v1 = (s71) d0.h0("uiTag");
        if (this.t1 == null) {
            this.t1 = new zw();
            ju0.e = String.valueOf(this.x1);
            Bundle bundle2 = new Bundle();
            bundle2.putInt("cameraID", this.x1);
            this.t1.w1(bundle2);
            d0.m().b(R$id.cameraFrameLayout, this.t1, "cameraFragmentTag").i();
        }
        if (this.v1 == null) {
            if (this.I1.b() != null) {
                try {
                    this.v1 = this.I1.b().getConstructor(new Class[0]).newInstance(new Object[0]);
                } catch (IllegalAccessException | InstantiationException | NoSuchMethodException | InvocationTargetException e) {
                    m71.o().b.e(e);
                }
            }
            if (this.v1 == null) {
                this.v1 = new i71();
            }
            d0.m().b(R$id.uiFrameLayout, this.v1, "uiTag").i();
        }
        getApplicationContext();
        this.E1 = new s15(a1(), X0());
        this.t1.y2(true);
        this.t1.z2(1280, 720);
        this.t1.A2(Build.VERSION.SDK_INT >= 26 ? 3 : 4);
        WeakReference<t72> a = m71.o().a();
        if (a != null) {
            this.n1 = a.get();
        }
        this.P1.h.h.setText(m71.o().b(this, this.n1, R$string.livenessGuide_head));
        this.P1.h.g.setText(m71.o().b(this, this.n1, R$string.livenssStart_promptText_getReady));
        this.P1.h.j.setText(m71.o().b(this, this.n1, R$string.livenssStart_promptText_illumination));
        this.P1.h.c.setText(m71.o().b(this, this.n1, R$string.livenssStart_promptText_noAccessories));
        this.P1.h.e.setText(m71.o().b(this, this.n1, R$string.livenssStart_promptText_cameraLevel));
        this.P1.h.l.setText(m71.o().b(this, this.n1, R$string.livenessGuide_button));
        this.P1.b.setZOrderOnTop(true);
        String str = m71.o().c;
        if (intent != null) {
            str = intent.getStringExtra("serviceUrl");
        }
        if (str == null) {
            Objects.requireNonNull(m71.o());
            str = "https://faceapi.regulaforensics.com";
        }
        q25 q25Var = new q25(str);
        WeakReference weakReference = m71.o().p;
        if (weakReference != null) {
            q25Var.c((cm2) weakReference.get());
        }
        WeakReference weakReference2 = m71.o().g;
        if (weakReference2 != null) {
            q25Var.b((yp1) weakReference2.get());
        }
        this.F1 = q25Var.a();
        i1();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.D1.removeCallbacksAndMessages(null);
        s15 s15Var = this.E1;
        if (s15Var != null) {
            s15Var.I();
        }
    }

    @Override
    public void onPause() {
        m71.o().b.b("onPause in base activity");
        super.onPause();
        this.P1.b.e();
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        attributes.screenBrightness = this.z1;
        getWindow().setAttributes(attributes);
    }

    @Override
    public void onResume() {
        m71.o().b.b("onResume in base activity");
        if (this.G1) {
            finish();
            return;
        }
        super.onResume();
        m71.o().b.b("screen brightness");
        this.z1 = getWindow().getAttributes().screenBrightness;
    }

    public final void p1() {
        if (this.H1 == null || !this.I1.j()) {
            return;
        }
        this.H1.vibrate(getResources().getInteger(R$integer.facesdk_vibrate_duration));
    }

    public void u(boolean z) {
        s71 s71Var;
        int i;
        if (!z) {
            L0(new iz4().c(new FaceCaptureException(f71.f)).a());
            m71.o().b.f("Cannot successfully open camera");
            this.E1.I();
            this.v1.i2(m71.o().b(this, this.n1, R$string.noCameraPermission_title_unavailable));
        }
        if (this.t1.V1() != 0 || this.t1.N1()) {
            if (this.t1.V1() == 1) {
                this.v1.b2(true);
                if (k1()) {
                    this.v1.h2(4);
                }
            }
            s71Var = this.v1;
            i = this.I1.g() ? 0 : 4;
        } else {
            s71Var = this.v1;
            i = 8;
        }
        s71Var.h2(i);
        this.v1.g2(this.I1.f() ? 0 : 4);
        this.v1.f2(this.I1.e() ? 0 : 4);
        m71.o().q().a().observe(this, this.R1);
    }

    public void v() {
        m71.o().b.b("Called click on close button in parent activity");
        this.q1 = 1;
        s15 s15Var = this.E1;
        if (s15Var != null) {
            s15Var.I();
        }
        F0();
    }
}