suw: Disable ScreenLockActivity if a secure lockscreen is already set

Currently, devices that have a fingerprint prompt to add a fingerprint and
lockscreen via FingerprintActivity. However, since ScreenLockActivity is
always active, we end up with a second prompt for screen lock security.

This adds a check to see if a secure lockscreen has already been set, and
if so, just skip ScreenLockActivity.

Change-Id: I877835e8fa8628c01c96ab9732146720c1234f31
parent a3c24ddb
......@@ -22,15 +22,26 @@ import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_DETAILS;
import static org.lineageos.setupwizard.SetupWizardApp.EXTRA_TITLE;
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_SETUP_LOCKSCREEN;
import android.app.KeyguardManager;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import org.lineageos.setupwizard.util.SetupWizardUtils;
public class ScreenLockActivity extends SubBaseActivity {
public static final String TAG = ScreenLockActivity.class.getSimpleName();
@Override
protected void onStartSubactivity() {
if (isKeyguardSecure()) {
Log.v(TAG, "Screen lock already set up; skipping ScreenLockActivity");
nextAction(RESULT_OK);
SetupWizardUtils.disableComponent(this, ScreenLockActivity.class);
finish();
return;
}
setNextAllowed(true);
findViewById(R.id.setup_lockscreen).setOnClickListener(new View.OnClickListener() {
@Override
......@@ -75,4 +86,7 @@ public class ScreenLockActivity extends SubBaseActivity {
return TRANSITION_ID_SLIDE;
}
private boolean isKeyguardSecure() {
return getSystemService(KeyguardManager.class).isKeyguardSecure();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment