Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a63075f0 authored by Ajay Nadathur's avatar Ajay Nadathur Committed by Android (Google) Code Review
Browse files

Merge "Show 'screen lock options' on all lock screen types"

parents 6ee11a61 a1314df6
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -21,12 +21,13 @@
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <!-- left : cancel -->
    <Button android:id="@+id/cancel_button"
    <!-- left : skip -->
    <Button android:id="@+id/skip_button"
        style="@style/SuwGlifButton.Secondary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/lockpassword_cancel_label" />
        android:text="@string/skip_label"
        android:visibility="gone" />


    <!-- left : clear -->
+8 −0
Original line number Diff line number Diff line
@@ -107,6 +107,14 @@
            android:textSize="14sp"
            android:visibility="gone"/>

        <Button
            android:id="@+id/screen_lock_options"
            style="@style/SuwGlifButton.Tertiary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/setup_lock_settings_options_button_label"
            android:visibility="gone" />

    </com.android.internal.widget.LinearLayoutWithDefaultTouchRecepient>

</com.android.setupwizardlib.GlifLayout>
+3 −8
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ public class ChooseLockPassword extends SettingsActivity {
        private String mFirstPin;
        private RecyclerView mPasswordRestrictionView;
        protected boolean mIsAlphaMode;
        protected Button mCancelButton;
        protected Button mSkipButton;
        private Button mClearButton;
        private Button mNextButton;
        private TextView mMessage;
@@ -377,8 +377,8 @@ public class ChooseLockPassword extends SettingsActivity {
            ViewGroup container = view.findViewById(R.id.password_container);
            container.setOpticalInsets(Insets.NONE);

            mCancelButton = (Button) view.findViewById(R.id.cancel_button);
            mCancelButton.setOnClickListener(this);
            mSkipButton = (Button) view.findViewById(R.id.skip_button);
            mSkipButton.setOnClickListener(this);
            mNextButton = (Button) view.findViewById(R.id.next_button);
            mNextButton.setOnClickListener(this);
            mClearButton = view.findViewById(R.id.clear_button);
@@ -774,10 +774,6 @@ public class ChooseLockPassword extends SettingsActivity {
                    handleNext();
                    break;

                case R.id.cancel_button:
                    getActivity().finish();
                    break;

                case R.id.clear_button:
                    mPasswordEntry.setText("");
                    break;
@@ -901,7 +897,6 @@ public class ChooseLockPassword extends SettingsActivity {
            }

            mClearButton.setVisibility(toVisibility(mUiStage != Stage.Introduction));
            mCancelButton.setVisibility(toVisibility(mUiStage == Stage.Introduction));

            setNextText(mUiStage.buttonText);
            mPasswordEntryInputDisabler.setInputEnabled(canInput);
+5 −9
Original line number Diff line number Diff line
@@ -290,8 +290,6 @@ public class ChooseLockPattern extends SettingsActivity {
         * The states of the left footer button.
         */
        enum LeftButtonMode {
            Cancel(R.string.cancel, true),
            CancelDisabled(R.string.cancel, false),
            Retry(R.string.lockpattern_retry_button_text, true),
            RetryDisabled(R.string.lockpattern_retry_button_text, false),
            Gone(ID_EMPTY_MESSAGE, false);
@@ -342,7 +340,7 @@ public class ChooseLockPattern extends SettingsActivity {
                    R.string.lock_settings_picker_fingerprint_added_security_message,
                    R.string.lockpassword_choose_your_pattern_message,
                    R.string.lockpattern_recording_intro_header,
                    LeftButtonMode.Cancel, RightButtonMode.ContinueDisabled,
                    LeftButtonMode.Gone, RightButtonMode.ContinueDisabled,
                    ID_EMPTY_MESSAGE, true),
            HelpScreen(
                    ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_settings_help_how_to_record,
@@ -360,15 +358,15 @@ public class ChooseLockPattern extends SettingsActivity {
                    LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false),
            NeedToConfirm(
                    ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_confirm,
                    LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled,
                    LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
                    ID_EMPTY_MESSAGE, true),
            ConfirmWrong(
                    ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_unlock_wrong,
                    LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled,
                    LeftButtonMode.Gone, RightButtonMode.ConfirmDisabled,
                    ID_EMPTY_MESSAGE, true),
            ChoiceConfirmed(
                    ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_pattern_confirmed_header,
                    LeftButtonMode.Cancel, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false);
                    LeftButtonMode.Gone, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false);


            /**
@@ -413,7 +411,7 @@ public class ChooseLockPattern extends SettingsActivity {

        private ChooseLockSettingsHelper mChooseLockSettingsHelper;
        private SaveAndFinishWorker mSaveAndFinishWorker;
        private int mUserId;
        protected int mUserId;
        private boolean mForFingerprint;

        private static final String KEY_UI_STAGE = "uiStage";
@@ -558,8 +556,6 @@ public class ChooseLockPattern extends SettingsActivity {
                mChosenPattern = null;
                mLockPatternView.clearPattern();
                updateStage(Stage.Introduction);
            } else if (mUiStage.leftMode == LeftButtonMode.Cancel) {
                getActivity().finish();
            } else {
                throw new IllegalStateException("left footer button pressed, but stage of " +
                        mUiStage + " doesn't make sense");
+35 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.password;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
@@ -24,6 +25,7 @@ import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -33,8 +35,11 @@ import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.setupwizardlib.util.WizardManagerHelper;

import java.util.List;

@@ -60,6 +65,36 @@ public class ChooseLockTypeDialogFragment extends InstrumentedDialogFragment

    public interface OnLockTypeSelectedListener {
        void onLockTypeSelected(ScreenLockType lock);

        default void startChooseLockActivity(ScreenLockType selectedLockType, Activity activity) {
            Intent activityIntent = activity.getIntent();
            Intent intent = new Intent(activity, SetupChooseLockGeneric.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);

            // Copy the original extras into the new intent
            if (activityIntent.hasExtra(
                    ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS)) {
                intent.putExtras(activityIntent.getBundleExtra(
                        ChooseLockGenericFragment.EXTRA_CHOOSE_LOCK_GENERIC_EXTRAS));
            }
            intent.putExtra(LockPatternUtils.PASSWORD_TYPE_KEY, selectedLockType.defaultQuality);

            // Propagate the fingerprint challenge
            intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE,
                    activityIntent.getBooleanExtra(
                            ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false));
            intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE,
                    activityIntent.getLongExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0));

            // The user is already given the choice of the what screen lock to set up. No need to
            // show this button again.
            intent.putExtra(ChooseLockGenericFragment.EXTRA_SHOW_OPTIONS_BUTTON, false);

            WizardManagerHelper.copyWizardManagerExtras(activityIntent, intent);

            activity.startActivity(intent);
            activity.finish();
        }
    }

    @Override
Loading