[Settings] Pass lock type extra back to SUW

When SetupChooseLockGeneric finishes, it will include the lock type
(password quality) as an extra in the returned intent data. This extra
will be used by Setup Wizard to determine the lock type and log it for
the metrics.

Bug: 20349248
Change-Id: I501e07254ab857ad4f137e7050326415853883d1
This commit is contained in:
Lucky Zhang
2015-06-10 11:05:09 -07:00
parent f8f9088a6d
commit 1bb5648595

View File

@@ -16,6 +16,7 @@
package com.android.settings;
import com.android.internal.widget.LockPatternUtils;
import com.android.setupwizardlib.SetupWizardListLayout;
import com.android.setupwizardlib.view.NavigationBar;
@@ -25,6 +26,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.UserHandle;
import android.preference.PreferenceFragment;
import android.hardware.fingerprint.FingerprintManager;
import android.view.LayoutInflater;
@@ -60,6 +62,8 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
public static class SetupChooseLockGenericFragment extends ChooseLockGenericFragment
implements NavigationBar.NavigationBarListener {
private static final String EXTRA_PASSWORD_QUALITY = ":settings:password_quality";
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -91,6 +95,15 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode != RESULT_CANCELED) {
if (data == null) {
data = new Intent();
}
// Add the password quality extra to the intent data that will be sent back for
// Setup Wizard.
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
data.putExtra(EXTRA_PASSWORD_QUALITY,
lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
super.onActivityResult(requestCode, resultCode, data);
}
// If the started activity was cancelled (e.g. the user presses back), then this