Check biometrics availability when relevant

Check the availability of biometrics when we need to know, waiting until
then to decide the presence of ScreenLockActivity, rather than checking
once during initialization and permanently disabling pages of the setup
wizard. Otherwise, a race condition may cause the system to report that
the hardware is unavailable, even though it will be ready when needed.

Reorder pages such that biometrics comes first, allowing screen lock
to act as the fallback.

Issue: calyxos#2544
Change-Id: I654ce25569b983035f1df453623c7a4acd54931d
This commit is contained in:
Tommy Webb
2024-07-08 20:08:17 +00:00
committed by Oliver Scott
parent ab9a5ea27b
commit 2db34a23d7
4 changed files with 23 additions and 19 deletions

View File

@@ -71,18 +71,18 @@
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETTINGS;end"
id="lineage_settings">
<result wizard:action="lockscreen_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end"
id="lockscreen_settings">
<result wizard:action="biometric_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_BIOMETRIC_SETTINGS;end"
id="biometric_settings">
<result wizard:action="lockscreen_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end"
id="lockscreen_settings">
<result wizard:action="theme_settings" />
</WizardAction>

View File

@@ -23,18 +23,18 @@
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCATION_SETTINGS;end"
id="location_settings">
<result wizard:action="lockscreen_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end"
id="lockscreen_settings">
<result wizard:action="biometric_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_BIOMETRIC_SETTINGS;end"
id="biometric_settings">
<result wizard:action="lockscreen_settings" />
</WizardAction>
<WizardAction
wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end"
id="lockscreen_settings">
<result wizard:action="theme_settings" />
</WizardAction>

View File

@@ -6,13 +6,24 @@
package org.lineageos.setupwizard;
import static com.google.android.setupcompat.util.ResultCodes.RESULT_SKIP;
import android.content.Intent;
import android.provider.Settings;
import org.lineageos.setupwizard.util.SetupWizardUtils;
public class BiometricActivity extends SubBaseActivity {
@Override
protected void onStartSubactivity() {
if (!SetupWizardUtils.hasBiometric(this)) {
SetupWizardUtils.enableComponent(this, ScreenLockActivity.class);
finishAction(RESULT_SKIP);
return;
} else {
SetupWizardUtils.disableComponent(this, ScreenLockActivity.class);
}
Intent intent = new Intent(Settings.ACTION_BIOMETRIC_ENROLL);
startSubactivity(intent);
}

View File

@@ -51,10 +51,8 @@ import android.telephony.TelephonyManager;
import android.util.Log;
import org.lineageos.setupwizard.BaseSetupWizardActivity;
import org.lineageos.setupwizard.BiometricActivity;
import org.lineageos.setupwizard.BluetoothSetupActivity;
import org.lineageos.setupwizard.NetworkSetupActivity;
import org.lineageos.setupwizard.ScreenLockActivity;
import org.lineageos.setupwizard.SetupWizardApp;
import org.lineageos.setupwizard.SimMissingActivity;
@@ -240,11 +238,6 @@ public class SetupWizardUtils {
if (!hasLeanback(context) || isBluetoothDisabled()) {
disableComponent(context, BluetoothSetupActivity.class);
}
if (!hasBiometric(context)) {
disableComponent(context, BiometricActivity.class);
} else {
disableComponent(context, ScreenLockActivity.class);
}
if (!hasTelephony(context)) {
disableComponent(context, SimMissingActivity.class);
}