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

Commit 69d4d879 authored by Lars Greiss's avatar Lars Greiss Committed by Michael Bestas
Browse files

Keyguard: let the user drag the challenge down if widgets are disabled

for the system clock widget this does not make much sense
but since our system default is cLock it makes sense to
allow it to see more content.

Change-Id: I0365573c6fa88117a47b01ced81eb36f75324342
parent bf04b664
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -93,6 +93,8 @@ public class KeyguardHostView extends KeyguardViewBase {

    private View mExpandChallengeView;

    private boolean mDefaultAppWidgetAttached;

    protected OnDismissAction mDismissAction;

    protected int mFailedAttempts;
@@ -430,7 +432,8 @@ public class KeyguardHostView extends KeyguardViewBase {

        // Don't let the user drag the challenge down if widgets are disabled.
        if (mSlidingChallengeLayout != null) {
            mSlidingChallengeLayout.setEnableChallengeDragging(!widgetsDisabled());
            mSlidingChallengeLayout.setEnableChallengeDragging(
                    !widgetsDisabled() || mDefaultAppWidgetAttached);
        }

        // Select the appropriate page
@@ -1362,13 +1365,13 @@ public class KeyguardHostView extends KeyguardViewBase {

            final boolean userAddedWidgetsEnabled = !widgetsDisabled();

            boolean addedDefaultAppWidget = false;
            mDefaultAppWidgetAttached = false;

            if (!mSafeModeEnabled) {
                if (userAddedWidgetsEnabled) {
                    int appWidgetId = allocateIdForDefaultAppWidget();
                    if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
                        addedDefaultAppWidget = addWidget(appWidgetId, insertPageIndex, true);
                        mDefaultAppWidgetAttached = addWidget(appWidgetId, insertPageIndex, true);
                    }
                } else {
                    // note: even if widgetsDisabledByDpm() returns true, we still bind/create
@@ -1381,8 +1384,8 @@ public class KeyguardHostView extends KeyguardViewBase {
                        }
                    }
                    if (appWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
                        addedDefaultAppWidget = addWidget(appWidgetId, insertPageIndex, false);
                        if (!addedDefaultAppWidget) {
                        mDefaultAppWidgetAttached = addWidget(appWidgetId, insertPageIndex, false);
                        if (!mDefaultAppWidgetAttached) {
                            mAppWidgetHost.deleteAppWidgetId(appWidgetId);
                            mLockPatternUtils.writeFallbackAppWidgetId(
                                    AppWidgetManager.INVALID_APPWIDGET_ID);
@@ -1392,7 +1395,7 @@ public class KeyguardHostView extends KeyguardViewBase {
            }

            // Use the built-in status/clock view if we can't inflate the default widget
            if (!addedDefaultAppWidget) {
            if (!mDefaultAppWidgetAttached) {
                addDefaultStatusWidget(insertPageIndex);
            }