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

Commit c0d0bfd6 authored by Dirk Rettschlag's avatar Dirk Rettschlag Committed by Danny Baumann
Browse files

LockScreen: Add option to start widgets maximized



Sources from AOKP with some modifications

This will allow the user to choose wether the lockscreen
challenge (circle, pattern, pin) is minimized when the screen
is turned on.

Patch Set 3: Remove visual jump and adhere to setting on initial inflate
Patch Set 4: Remove accidental dependency
Patch Set 5: Fix potential multi-user problem.

Signed-off-by: default avatarDirk Rettschlag <dirk.rettschlag@gmail.com>
Change-Id: Ib5bd0a84e5542a49d34ed8c8541e10a7878a616c
parent aa2a2a73
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3017,6 +3017,12 @@ public final class Settings {
          */
         public static final String KEY_ASSIST_ACTION = "key_assist_action";

        /**
         * Weather to minimize lockscreen challenge on screen turned on
         * @hide
         */
        public static final String LOCKSCREEN_MAXIMIZE_WIDGETS = "lockscreen_maximize_widgets";

         /**
          * Action to perform when the assistant (search) key is long-pressed. (Default is 4)
          * (See KEY_HOME_LONG_PRESS_ACTION for valid values)
+15 −0
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ public class KeyguardHostView extends KeyguardViewBase {

        showPrimarySecurityScreen(false);
        updateSecurityViews();
        minimizeChallengeIfDesired();
    }

    private int getDisabledFeatures(DevicePolicyManager dpm) {
@@ -830,6 +831,7 @@ public class KeyguardHostView extends KeyguardViewBase {
        if (mViewStateManager != null) {
            mViewStateManager.showUsabilityHints();
        }
        minimizeChallengeIfDesired();
    }

    @Override
@@ -917,6 +919,19 @@ public class KeyguardHostView extends KeyguardViewBase {
        }
    }

    private void minimizeChallengeIfDesired() {
        if (mSlidingChallengeLayout == null) {
            return;
        }

        int setting = Settings.System.getIntForUser(getContext().getContentResolver(),
                Settings.System.LOCKSCREEN_MAXIMIZE_WIDGETS, 0, UserHandle.USER_CURRENT);

        if (setting == 1) {
            mSlidingChallengeLayout.showChallenge(false);
        }
    }

    private int getSecurityViewIdForMode(SecurityMode securityMode) {
        switch (securityMode) {
            case None: return R.id.keyguard_selector_view;