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

Commit 92779ce7 authored by Udam Saini's avatar Udam Saini
Browse files

Prevents drawer menu from showing depending on intent.

When ChooseLockScreenGeneric is started via the set password
intents, it should not allow the drawer menu to show.

bug:26288300
Change-Id: I10d512e20fedab2be8c725c7d524db0c55666590
parent 1997f76c
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -59,6 +59,12 @@ public class ChooseLockGeneric extends SettingsActivity {
    public Intent getIntent() {
        Intent modIntent = new Intent(super.getIntent());
        modIntent.putExtra(EXTRA_SHOW_FRAGMENT, getFragmentClass().getName());

        String action = modIntent.getAction();
        if (DevicePolicyManager.ACTION_SET_NEW_PASSWORD.equals(action)
                || DevicePolicyManager.ACTION_SET_NEW_PARENT_PROFILE_PASSWORD.equals(action)) {
            modIntent.putExtra(EXTRA_HIDE_DRAWER, true);
        }
        return modIntent;
    }

@@ -110,6 +116,7 @@ public class ChooseLockGeneric extends SettingsActivity {
        private LockPatternUtils mLockPatternUtils;
        private FingerprintManager mFingerprintManager;
        private int mUserId;
        private boolean mHideDrawer = false;
        private RemovalCallback mRemovalCallback = new RemovalCallback() {

            @Override
@@ -154,6 +161,7 @@ public class ChooseLockGeneric extends SettingsActivity {
            if (getActivity() instanceof ChooseLockGeneric.InternalActivity) {
                mPasswordConfirmed = !confirmCredentials;
            }
            mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);

            mHasChallenge = getActivity().getIntent().getBooleanExtra(
                    ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, false);
@@ -263,6 +271,7 @@ public class ChooseLockGeneric extends SettingsActivity {
                        unlockMethodIntent);
                intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT,
                        mForFingerprint);
                intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
                startActivityForResult(intent, ENABLE_ENCRYPTION_REQUEST);
            } else {
                if (mForChangeCredRequiredForBoot) {
@@ -613,6 +622,9 @@ public class ChooseLockGeneric extends SettingsActivity {
                            mUserPassword, mUserId);
                }
            }
            if (intent != null) {
                intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
            }
            return intent;
        }

+3 −0
Original line number Diff line number Diff line
@@ -186,6 +186,7 @@ public class ChooseLockPassword extends SettingsActivity {
        private static final int MSG_SHOW_ERROR = 1;

        private int mUserId;
        private boolean mHideDrawer = false;

        private Handler mHandler = new Handler() {
            @Override
@@ -267,6 +268,7 @@ public class ChooseLockPassword extends SettingsActivity {
                    mUserId));

            mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
            mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);

            if (intent.getBooleanExtra(
                    ChooseLockSettingsHelper.EXTRA_KEY_FOR_CHANGE_CRED_REQUIRED_FOR_BOOT, false)) {
@@ -673,6 +675,7 @@ public class ChooseLockPassword extends SettingsActivity {
            if (!wasSecureBefore) {
                Intent intent = getRedactionInterstitialIntent(getActivity());
                if (intent != null) {
                    intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
                    startActivity(intent);
                }
            }
+3 −0
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ public class ChooseLockPattern extends SettingsActivity {
        private TextView mFooterLeftButton;
        private TextView mFooterRightButton;
        protected List<LockPatternView.Cell> mChosenPattern = null;
        private boolean mHideDrawer = false;

        /**
         * The patten used during the help screen to show how to draw a pattern.
@@ -384,6 +385,7 @@ public class ChooseLockPattern extends SettingsActivity {
                w.start(mChooseLockSettingsHelper.utils(), required,
                        false, 0, LockPatternUtils.stringToPattern(current), current, mUserId);
            }
            mHideDrawer = getActivity().getIntent().getBooleanExtra(EXTRA_HIDE_DRAWER, false);
        }

        @Override
@@ -674,6 +676,7 @@ public class ChooseLockPattern extends SettingsActivity {
            if (!wasSecureBefore) {
                Intent intent = getRedactionInterstitialIntent(getActivity());
                if (intent != null) {
                    intent.putExtra(EXTRA_HIDE_DRAWER, mHideDrawer);
                    startActivity(intent);
                }
            }
+2 −0
Original line number Diff line number Diff line
@@ -210,6 +210,8 @@ public final class ChooseLockSettingsHelper {
        intent.putExtra(ConfirmDeviceCredentialBaseFragment.SHOW_WHEN_LOCKED, external);
        intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_HAS_CHALLENGE, hasChallenge);
        intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, challenge);
        // we should never have a drawer when confirming device credentials.
        intent.putExtra(SettingsActivity.EXTRA_HIDE_DRAWER, true);
        intent.putExtra(Intent.EXTRA_USER_ID, userId);
        intent.setClassName(ConfirmDeviceCredentialBaseFragment.PACKAGE, activityClass.getName());
        if (external) {
+5 −0
Original line number Diff line number Diff line
@@ -199,6 +199,8 @@ public class SettingsActivity extends SettingsDrawerActivity
    public static final String EXTRA_SHOW_FRAGMENT_AS_SUBSETTING =
            ":settings:show_fragment_as_subsetting";

    public static final String EXTRA_HIDE_DRAWER = ":settings:hide_drawer";

    public static final String META_DATA_KEY_FRAGMENT_CLASS =
        "com.android.settings.FRAGMENT_CLASS";

@@ -511,6 +513,9 @@ public class SettingsActivity extends SettingsDrawerActivity
        if (intent.hasExtra(EXTRA_UI_OPTIONS)) {
            getWindow().setUiOptions(intent.getIntExtra(EXTRA_UI_OPTIONS, 0));
        }
        if (intent.getBooleanExtra(EXTRA_HIDE_DRAWER, false)) {
            setIsDrawerPresent(false);
        }

        mDevelopmentPreferences = getSharedPreferences(DevelopmentSettings.PREF_FILE,
                Context.MODE_PRIVATE);