[Fingerprint] Don't show warning dialog if screen lock is set up

If the keyguard is already secure (i.e. if the backup screen lock is
already set up), do not show the skip dialog which warns user about
the danger of not having a screen lock.

Bug: 34129157
Test: adb shell am instrument -w com.android.settings.tests.unit
Change-Id: I6f777631487de89ab25a08ea017dd6194dde464d
This commit is contained in:
Maurice Lam
2017-01-12 14:35:32 -08:00
parent 382550a12d
commit 92d3c1e653
2 changed files with 121 additions and 3 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settings.fingerprint;
import android.app.KeyguardManager;
import android.content.Intent;
import android.content.res.Resources;
import android.os.UserHandle;
@@ -83,9 +84,17 @@ public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntrodu
@Override
protected void onCancelButtonClick() {
SetupSkipDialog dialog = SetupSkipDialog.newInstance(
getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
dialog.show(getFragmentManager());
KeyguardManager keyguardManager = getSystemService(KeyguardManager.class);
if (keyguardManager.isKeyguardSecure()) {
// If the keyguard is already set up securely (maybe the user added a backup screen
// lock and skipped fingerprint), return RESULT_SKIP directly.
setResult(RESULT_SKIP);
finish();
} else {
SetupSkipDialog dialog = SetupSkipDialog.newInstance(
getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
dialog.show(getFragmentManager());
}
}
@Override