导航菜单

页面标题

页面副标题

SpeedCash v6.5.1482 - LockActivity.java 源代码

正在查看: SpeedCash v6.5.1482 应用的 LockActivity.java JAVA 源代码文件

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


package com.bm.sc.bebasbayar.ui;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Bundle;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyPermanentlyInvalidatedException;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.biometric.BiometricPrompt;
import androidx.core.content.ContextCompat;
import com.andrognito.patternlockview.PatternLockView;
import com.andrognito.patternlockview.listener.PatternLockViewListener;
import com.andrognito.patternlockview.utils.PatternLockUtils;
import com.astuetz.PagerSlidingTabStrip;
import com.bm.sc.auth.ui.BottomNavigationActivity;
import com.bm.sc.auth.ui.cs.LiveChatActivity;
import com.bm.sc.bebasbayar.R;
import com.bm.sc.bebasbayar.helper.Affinity;
import com.bm.sc.bebasbayar.iface.BBCallback;
import com.bm.sc.bebasbayar.setting.session.AppSession;
import com.bm.sc.bebasbayar.ui.LockActivity;
import com.bm.sc.util.android.Device;
import com.bm.sc.util.common.Var;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;

public class LockActivity extends SuperActivity implements View.OnClickListener, PatternLockViewListener {
    public AppSession b;
    public KeyStore c;
    public Cipher d;
    public BiometricPrompt e;
    public BiometricPrompt.PromptInfo f;
    public PatternLockView g;
    public Timer h;
    public EditText i;
    public int l;
    public TextView m;
    public final String TAG = LockActivity.class.getSimpleName();
    public int j = 60;
    public boolean k = false;

    public class a extends BiometricPrompt.AuthenticationCallback {
        public a() {
        }

        public void onAuthenticationError(int i, @NonNull CharSequence charSequence) {
            super.onAuthenticationError(i, charSequence);
        }

        public void onAuthenticationFailed() {
            super.onAuthenticationFailed();
        }

        public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult authenticationResult) {
            super.onAuthenticationSucceeded(authenticationResult);
            LockActivity.this.b.remove(AppSession.PROPERTY_LOCK);
            if (LockActivity.this.isTaskRoot()) {
                Affinity.purge(LockActivity.this, BottomNavigationActivity.class);
            } else {
                LockActivity.this.finish();
            }
        }
    }

    public class b extends TimerTask {

        public class a implements Runnable {
            public a() {
            }

            @Override
            public void run() {
                LockActivity.this.g.setInputEnabled(false);
                LockActivity.this.m.setVisibility(0);
                if (LockActivity.this.j < 10) {
                    LockActivity.this.m.setText("00:0" + LockActivity.this.j);
                    return;
                }
                LockActivity.this.m.setText("00:" + LockActivity.this.j);
            }
        }

        public b() {
        }

        public void b() {
            LockActivity.this.g.setInputEnabled(true);
            LockActivity.this.m.setText("00:00");
            LockActivity.this.m.setVisibility(4);
        }

        @Override
        public void run() {
            if (LockActivity.this.j == 0) {
                String str = LockActivity.this.TAG;
                StringBuilder sb = new StringBuilder();
                sb.append("hitung mundur finish ");
                sb.append(LockActivity.this.j);
                LockActivity.this.h.cancel();
                LockActivity.this.h.purge();
                LockActivity.this.k = false;
                LockActivity.this.l = 0;
                LockActivity.this.runOnUiThread(new Runnable() {
                    @Override
                    public final void run() {
                        LockActivity.b.this.b();
                    }
                });
            }
            if (LockActivity.this.j > 0) {
                LockActivity.m(LockActivity.this, 1);
                String str2 = LockActivity.this.TAG;
                StringBuilder sb2 = new StringBuilder();
                sb2.append("salah Pattern 3 kali hitung mundur ");
                sb2.append(LockActivity.this.j);
                LockActivity.this.runOnUiThread(new a());
            }
        }
    }

    public static Bundle getBundle(boolean z, String str) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("is_quick_login", z);
        bundle.putString("sandi", str);
        return bundle;
    }

    public static int m(LockActivity lockActivity, int i) {
        int i2 = lockActivity.j - i;
        lockActivity.j = i2;
        return i2;
    }

    public void v(int i, Boolean bool) {
        if (bool.booleanValue()) {
            Affinity.logout(this, true);
        }
    }

    public void w(int i, Boolean bool) {
        if (bool.booleanValue()) {
            startActivityForResult(new Intent("android.settings.SETTINGS"), 11111);
        } else {
            this.e.cancelAuthentication();
        }
    }

    public void x(int i, Boolean bool) {
        if (bool.booleanValue()) {
            startActivity(new Intent("android.settings.SETTINGS"));
        }
    }

    public void al_clear(View view) {
        this.i.setText("");
    }

    public void al_logout(View view) {
        Affinity.confirm(this, getString(R.string.title_quit), getString(R.string.confirm_quit), new BBCallback() {
            @Override
            public final void do_callback(int i, Object obj) {
                LockActivity.this.v(i, (Boolean) obj);
            }
        });
    }

    public void al_type(View view) {
        if (view instanceof Button) {
            CharSequence text = ((Button) view).getText();
            Editable text2 = this.i.getText();
            if (text2.length() < 6) {
                this.i.setText(((Object) text2) + "" + ((Object) text));
            }
        }
    }

    public void al_unlock(View view) {
        if (!this.b.retrieve(AppSession.PROPERTY_SMARTLOCK_PROPERTIES).equals(this.i.getText().toString())) {
            al_clear(view);
            Affinity.info(this, false, "Sandi tidak sesuai !");
            return;
        }
        this.b.remove(AppSession.PROPERTY_LOCK);
        if (isTaskRoot()) {
            Affinity.purge(this, BottomNavigationActivity.class);
        } else {
            finish();
        }
    }

    public void disableSwipePattern() {
        this.h.schedule(new b(), 500L, 1000L);
    }

    @Override
    public int getContentResource() {
        return R.layout.activity_lock;
    }

    @Override
    public int getMenuResource() {
        return R.menu.awal;
    }

    @Override
    public int getToolbarIconResource() {
        return R.mipmap.ic_launcher;
    }

    public void onActivityResult(int i, int i2, @Nullable Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i, i2, intent);
        if (i == 11111) {
            if (Affinity.checkFingerprint(this) != 0 && Affinity.checkFingerprint(this) != -1) {
                this.e.cancelAuthentication();
                return;
            }
            u();
            if (t()) {
                this.e.authenticate(this.f, new BiometricPrompt.CryptoObject(this.d));
            }
        }
    }

    @Override
    public void onCleared() {
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == 2131362366) {
            Affinity.logout(this, true);
            return;
        }
        if (view.getId() != 2131364724) {
            if (view.getId() == 2131363820) {
                Affinity.launch(this, LiveChatActivity.class);
            }
        } else if (Device.isFingerprintAuthAvailable(this)) {
            s();
        } else {
            Affinity.info(this, 2, getString(R.string.title_warning), getString(R.string.title_lock_finger3), new BBCallback() {
                @Override
                public final void do_callback(int i, Object obj) {
                    LockActivity.this.x(i, (Boolean) obj);
                }
            });
        }
    }

    @Override
    public void onComplete(List<PatternLockView.Dot> list) {
        StringBuilder sb = new StringBuilder();
        sb.append("Pattern complete: ");
        sb.append(PatternLockUtils.patternToString(this.g, list));
        try {
            if (this.b.retrieve(AppSession.PROPERTY_SMARTLOCK_PROPERTIES).equals(PatternLockUtils.patternToString(this.g, list))) {
                this.b.remove(AppSession.PROPERTY_LOCK);
                this.k = false;
                this.l = 0;
                if (isTaskRoot()) {
                    Affinity.purge(this, BottomNavigationActivity.class);
                } else {
                    finish();
                }
            } else {
                this.g.clearPattern();
                int i = this.l + 1;
                this.l = i;
                if (i == 3) {
                    this.j = 60;
                    Affinity.info(this, false, "Pola Kunci tidak sesuai Silahkan Dicoba 1 Menit Lagi");
                    this.k = true;
                    this.h = new Timer();
                    disableSwipePattern();
                } else {
                    Affinity.info(this, false, "Pola Kunci tidak sesuai !");
                }
            }
        } catch (Exception e) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append("Error onComplete karena: ");
            sb2.append(e);
        }
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        boolean z = bundle != null ? bundle.getBoolean("is_quick_login") : getIntent().getExtras() != null ? getIntent().getExtras().getBoolean("is_quick_login") : false;
        this.k = false;
        this.l = 0;
        AppSession appSession = new AppSession(this);
        this.b = appSession;
        appSession.store(AppSession.PROPERTY_LOCK, "1");
        View findViewById = findViewById(R.id.fingerprint_layout);
        View findViewById2 = findViewById(R.id.lock_swipe_patern_layout);
        this.m = (TextView) findViewById2.findViewById(R.id.info_count_down);
        TextView textView = (TextView) findViewById(R.id.info_label_heading);
        if (z) {
            findViewById2.setVisibility(8);
            findViewById.setVisibility(0);
            textView.setText(getString(R.string.label_quick_login_heading, Var.toString(new AppSession(this).retrieve(AppSession.PROPERTY_OWNER_NAME), "").split(" ")[0]));
        } else {
            findViewById2.setVisibility(0);
            findViewById.setVisibility(8);
        }
        findViewById(R.id.lyt_quick_login).setOnClickListener(this);
        findViewById(R.id.btn_logout).setOnClickListener(this);
        findViewById(R.id.icon_chat_container).setOnClickListener(this);
        PatternLockView patternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view);
        this.g = patternLockView;
        patternLockView.addPatternLockListener(this);
        setPaternLock();
    }

    @Override
    public void onProgress(List<PatternLockView.Dot> list) {
        StringBuilder sb = new StringBuilder();
        sb.append("Pattern progress: ");
        sb.append(PatternLockUtils.patternToString(this.g, list));
    }

    @Override
    public void onStarted() {
    }

    public final void s() {
        this.e = new BiometricPrompt(this, ContextCompat.getMainExecutor(this), new a());
        this.f = new BiometricPrompt.PromptInfo.Builder().setTitle(getString(R.string.label_dialog_login_title)).setSubtitle(getString(R.string.label_dialog_login_subtitle)).setNegativeButtonText("Kembali").build();
        if (Affinity.checkFingerprint(this) == 11) {
            Affinity.confirm(this, getString(R.string.title_warning), getString(R.string.title_lock_finger3), new BBCallback() {
                @Override
                public final void do_callback(int i, Object obj) {
                    LockActivity.this.w(i, (Boolean) obj);
                }
            });
            return;
        }
        if (Affinity.checkFingerprint(this) == 0 || Affinity.checkFingerprint(this) == -1) {
            u();
            if (t()) {
                this.e.authenticate(this.f, new BiometricPrompt.CryptoObject(this.d));
            }
        }
    }

    public void setPaternLock() {
        this.g.setViewMode(0);
        this.g.setInStealthMode(false);
        this.g.setTactileFeedbackEnabled(true);
        this.g.setInputEnabled(true);
        this.g.setDotCount(3);
        this.g.setAspectRatioEnabled(true);
        this.g.setAspectRatio(2);
        this.g.setNormalStateColor(getResources().getColor(R.color.colorBackground));
        this.g.setCorrectStateColor(getResources().getColor(R.color.LimeGreen));
        this.g.setWrongStateColor(getResources().getColor(R.color.colorSecondary));
        this.g.setDotAnimationDuration(PagerSlidingTabStrip.DEF_VALUE_TAB_TEXT_ALPHA);
        this.g.setPathEndAnimationDuration(100);
    }

    @TargetApi(23)
    public final boolean t() {
        try {
            this.d = Cipher.getInstance("AES/CBC/PKCS7Padding");
            try {
                this.c.load(null);
                this.d.init(1, (SecretKey) this.c.getKey("BebasBayar", null));
                return true;
            } catch (KeyPermanentlyInvalidatedException unused) {
                return false;
            } catch (IOException e) {
                e = e;
                throw new RuntimeException("Failed to init Cipher", e);
            } catch (InvalidKeyException e2) {
                e = e2;
                throw new RuntimeException("Failed to init Cipher", e);
            } catch (KeyStoreException e3) {
                e = e3;
                throw new RuntimeException("Failed to init Cipher", e);
            } catch (NoSuchAlgorithmException e4) {
                e = e4;
                throw new RuntimeException("Failed to init Cipher", e);
            } catch (UnrecoverableKeyException e5) {
                e = e5;
                throw new RuntimeException("Failed to init Cipher", e);
            } catch (CertificateException e6) {
                e = e6;
                throw new RuntimeException("Failed to init Cipher", e);
            }
        } catch (NoSuchAlgorithmException | NoSuchPaddingException e7) {
            throw new RuntimeException("Failed to get Cipher!", e7);
        }
    }

    @TargetApi(23)
    public final void u() {
        try {
            this.c = KeyStore.getInstance("AndroidKeyStore");
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            KeyGenerator keyGenerator = KeyGenerator.getInstance("AES", "AndroidKeyStore");
            try {
                this.c.load(null);
                keyGenerator.init(new KeyGenParameterSpec.Builder("BebasBayar", 3).setBlockModes("CBC").setUserAuthenticationRequired(false).setEncryptionPaddings("PKCS7Padding").build());
                keyGenerator.generateKey();
            } catch (IOException | InvalidAlgorithmParameterException | NoSuchAlgorithmException | CertificateException e2) {
                throw new RuntimeException(e2);
            }
        } catch (NoSuchAlgorithmException | NoSuchProviderException e3) {
            throw new RuntimeException("Failed to get KeyGenerator instance", e3);
        }
    }
}