Default setup wizard to use PIN

- Added "Screen lock options" button in PIN screen, controlled by
  extra EXTRA_SHOW_OPTIONS_BUTTON, which will create a dialog to ask
  the user to choose another screen lock type.
- Extracted ScreenLockType enum and ChooseLockGenericController that
  can be shared by ChooseLockGeneric and the dialog
  ChooseLockTypeDialogFragment.
- The intent extra EXTRA_SHOW_OPTIONS_BUTTON will be set if
  ChooseLockGeneric screen starts ChooseLockPassword /
  ChooseLockPattern without asking the user. (Although the extra is
  ignored by ChooseLockPattern currently)
- Fix layout alignment for the password entry field to remove the
  extra 4dp padding on the sides.

Test: cd tests/robotests && mma
Bug: 35442933
Bug: 38002299
Change-Id: I877fbe08a0c05bb97175e1cbf0260ea6dbda22e2
This commit is contained in:
Maurice Lam
2017-04-27 18:54:33 -07:00
parent 9e8a182c31
commit edb3944984
17 changed files with 1117 additions and 183 deletions

View File

@@ -28,6 +28,7 @@ import android.app.admin.DevicePolicyManager;
import android.app.admin.PasswordMetrics;
import android.content.Context;
import android.content.Intent;
import android.graphics.Insets;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
@@ -171,7 +172,7 @@ public class ChooseLockPassword extends SettingsActivity {
private int mPasswordMinNumeric = 0;
private int mPasswordMinNonLetter = 0;
private int mPasswordMinLengthToFulfillAllPolicies = 0;
private int mUserId;
protected int mUserId;
private boolean mHideDrawer = false;
/**
* Password requirements that we need to verify.
@@ -188,7 +189,7 @@ public class ChooseLockPassword extends SettingsActivity {
private TextView mHeaderText;
private String mFirstPin;
private RecyclerView mPasswordRestrictionView;
private boolean mIsAlphaMode;
protected boolean mIsAlphaMode;
private Button mCancelButton;
private Button mNextButton;
@@ -291,6 +292,11 @@ public class ChooseLockPassword extends SettingsActivity {
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// Make the password container consume the optical insets so the edit text is aligned
// with the sides of the parent visually.
ViewGroup container = view.findViewById(R.id.password_container);
container.setOpticalInsets(Insets.NONE);
mCancelButton = (Button) view.findViewById(R.id.cancel_button);
mCancelButton.setOnClickListener(this);
mNextButton = (Button) view.findViewById(R.id.next_button);