package ai.advance.liveness.sdk.activity;

import ai.advance.liveness.sdk.R$id;
import ai.advance.liveness.sdk.R$layout;
import ai.advance.liveness.sdk.R$string;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Window;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.progressindicator.BaseProgressIndicator;
import ῲ.ᨨ.ῲ.C1806;
import ῲ.ᨨ.K.C1826;
import ῲ.ῲ.K.DialogInterfaceC1958;
import K.K.K.ʬ.C2371;
import K.K.㸾.ῲ.ῲ.C2377;
import K.K.㸾.ῲ.K.DialogInterface$OnClickListenerC2382;
import K.K.㸾.K.C2388;

public class LivenessActivity extends AppCompatActivity {

    /* renamed from: ඓ  reason: contains not printable characters */
    public DialogInterfaceC1958 f120;

    /* renamed from: 㸾  reason: contains not printable characters */
    public C2377 f121;

    /* renamed from: ai.advance.liveness.sdk.activity.LivenessActivity$K  reason: contains not printable characters */
    public class DialogInterface$OnClickListenerC0031 implements DialogInterface.OnClickListener {
        public DialogInterface$OnClickListenerC0031() {
        }

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

    @Override // androidx.activity.ComponentActivity, androidx.core.app.ComponentActivity, androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
    public void onCreate(Bundle bundle) {
        requestWindowFeature(1);
        getWindow().setFlags(RecyclerView.AbstractC0269.FLAG_ADAPTER_FULLUPDATE, RecyclerView.AbstractC0269.FLAG_ADAPTER_FULLUPDATE);
        super.onCreate(bundle);
        setContentView(R$layout.activity_liveness);
        DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
        C2371.f8201 = displayMetrics.density;
        float f = C2371.f8201;
        int i = displayMetrics.widthPixels;
        C2371.f8200 = i;
        int i2 = displayMetrics.heightPixels;
        C2371.f8207 = i2;
        C2371.f8205 = i;
        C2371.f8203 = i2;
        int i3 = displayMetrics.densityDpi;
        float f2 = 30.0f * f;
        C2371.f8206 = f2;
        C2371.f8204 = f2;
        C2371.f8208 = 50.0f * f;
        C2371.f8202 = f * 40.0f;
        m116(BaseProgressIndicator.MAX_ALPHA);
        if (C2388.f8276 && !m114()) {
            C1826.m4722(this, m115(), 1001);
        }
    }

    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity
    public void onDestroy() {
        C2388.m6424();
        DialogInterfaceC1958 r0 = this.f120;
        if (r0 != null && r0.isShowing()) {
            this.f120.dismiss();
        }
        super.onDestroy();
    }

    @Override // androidx.fragment.app.FragmentActivity
    public void onPause() {
        C2377 k = this.f121;
        if (k != null && k.isAdded()) {
            this.f121.m6372();
            getSupportFragmentManager().m3915().m4103(this.f121).m4091();
        }
        super.onPause();
    }

    @Override // androidx.fragment.app.FragmentActivity, ῲ.ᨨ.K.C1826.AbstractC1827
    public void onRequestPermissionsResult(int i, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i, strArr, iArr);
        if (i == 1001) {
            boolean z = true;
            for (int i2 : iArr) {
                if (i2 != 0) {
                    z = false;
                }
            }
            if (!z) {
                m117();
            }
        }
    }

    @Override // androidx.fragment.app.FragmentActivity
    public void onResume() {
        if (m114()) {
            if (C2388.m6427()) {
                this.f121 = new C2377();
                if (!this.f121.isAdded()) {
                    getSupportFragmentManager().m3915().m4092(R$id.container, this.f121).m4091();
                }
            } else {
                String string = getString(R$string.liveness_device_not_support);
                this.f120 = new DialogInterfaceC1958.C1959(this).setCancelable(false).setMessage(string).setPositiveButton(R$string.liveness_perform, new DialogInterface$OnClickListenerC2382(this, string)).create();
                this.f120.show();
            }
        }
        super.onResume();
    }

    /* renamed from: ؿ  reason: contains not printable characters */
    public final boolean m114() {
        for (String str : m115()) {
            if (C1806.m4687(this, str) != 0) {
                return false;
            }
        }
        return true;
    }

    /* renamed from: ᓣ  reason: contains not printable characters */
    public String[] m115() {
        return new String[]{"android.permission.CAMERA"};
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m116(int i) {
        Window window = getWindow();
        WindowManager.LayoutParams attributes = window.getAttributes();
        if (i == -1) {
            attributes.screenBrightness = -1.0f;
        } else {
            if (i <= 0) {
                i = 1;
            }
            attributes.screenBrightness = ((float) i) / 255.0f;
        }
        window.setAttributes(attributes);
    }

    /* renamed from: 㗽  reason: contains not printable characters */
    public void m117() {
        new DialogInterfaceC1958.C1959(this).setMessage(getString(R$string.liveness_no_camera_permission)).setPositiveButton(getString(R$string.liveness_perform), new DialogInterface$OnClickListenerC0031()).create().show();
    }
}
