Avoid API 10 issues with androidx.biometric usage.
This commit is contained in:
parent
f81f50646e
commit
55a62ead05
2 changed files with 15 additions and 7 deletions
|
@ -76,6 +76,7 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||||
private static final int ALLOWED_AUTHENTICATORS = BIOMETRIC_AUTHENTICATORS | Authenticators.DEVICE_CREDENTIAL;
|
private static final int ALLOWED_AUTHENTICATORS = BIOMETRIC_AUTHENTICATORS | Authenticators.DEVICE_CREDENTIAL;
|
||||||
private static final short AUTHENTICATE_REQUEST_CODE = 1007;
|
private static final short AUTHENTICATE_REQUEST_CODE = 1007;
|
||||||
private static final String BUNDLE_ALREADY_SHOWN = "bundle_already_shown";
|
private static final String BUNDLE_ALREADY_SHOWN = "bundle_already_shown";
|
||||||
|
public static final String FROM_FOREGROUND = "from_foreground";
|
||||||
|
|
||||||
private DynamicIntroTheme dynamicTheme = new DynamicIntroTheme();
|
private DynamicIntroTheme dynamicTheme = new DynamicIntroTheme();
|
||||||
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
private DynamicLanguage dynamicLanguage = new DynamicLanguage();
|
||||||
|
@ -109,7 +110,8 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||||
setContentView(R.layout.prompt_passphrase_activity);
|
setContentView(R.layout.prompt_passphrase_activity);
|
||||||
initializeResources();
|
initializeResources();
|
||||||
|
|
||||||
alreadyShown = savedInstanceState != null && savedInstanceState.getBoolean(BUNDLE_ALREADY_SHOWN);
|
alreadyShown = (savedInstanceState != null && savedInstanceState.getBoolean(BUNDLE_ALREADY_SHOWN)) ||
|
||||||
|
getIntent().getBooleanExtra(FROM_FOREGROUND, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -286,17 +288,21 @@ public class PassphrasePromptActivity extends PassphraseActivity {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (biometricManager.canAuthenticate(ALLOWED_AUTHENTICATORS) == BiometricManager.BIOMETRIC_SUCCESS) {
|
if (Build.VERSION.SDK_INT != 29 && biometricManager.canAuthenticate(ALLOWED_AUTHENTICATORS) == BiometricManager.BIOMETRIC_SUCCESS) {
|
||||||
if (force) {
|
if (force) {
|
||||||
Log.i(TAG, "Listening for biometric authentication...");
|
Log.i(TAG, "Listening for biometric authentication...");
|
||||||
biometricPrompt.authenticate(biometricPromptInfo);
|
biometricPrompt.authenticate(biometricPromptInfo);
|
||||||
} else {
|
} else {
|
||||||
Log.i(TAG, "Skipping show system biometric dialog unless forced");
|
Log.i(TAG, "Skipping show system biometric dialog unless forced");
|
||||||
}
|
}
|
||||||
} else if (Build.VERSION.SDK_INT >= 21){
|
} else if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
if (force) {
|
||||||
Log.i(TAG, "firing intent...");
|
Log.i(TAG, "firing intent...");
|
||||||
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent(getString(R.string.PassphrasePromptActivity_unlock_signal), "");
|
Intent intent = keyguardManager.createConfirmDeviceCredentialIntent(getString(R.string.PassphrasePromptActivity_unlock_signal), "");
|
||||||
startActivityForResult(intent, AUTHENTICATE_REQUEST_CODE);
|
startActivityForResult(intent, AUTHENTICATE_REQUEST_CODE);
|
||||||
|
} else {
|
||||||
|
Log.i(TAG, "Skipping firing intent unless forced");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.w(TAG, "Not compatible...");
|
Log.w(TAG, "Not compatible...");
|
||||||
handleAuthenticated();
|
handleAuthenticated();
|
||||||
|
|
|
@ -183,7 +183,9 @@ public abstract class PassphraseRequiredActivity extends BaseActivity implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent getPromptPassphraseIntent() {
|
private Intent getPromptPassphraseIntent() {
|
||||||
return getRoutedIntent(PassphrasePromptActivity.class, getIntent());
|
Intent intent = getRoutedIntent(PassphrasePromptActivity.class, getIntent());
|
||||||
|
intent.putExtra(PassphrasePromptActivity.FROM_FOREGROUND, ApplicationDependencies.getAppForegroundObserver().isForegrounded());
|
||||||
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Intent getUiBlockingUpgradeIntent() {
|
private Intent getUiBlockingUpgradeIntent() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue