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

Commit cd9db1c8 authored by David van Tonder's avatar David van Tonder Committed by Gerrit Code Review
Browse files

Merge "Lockscreen: longpress on expand challenge handle" into cm-10.1

parents 668ec5e6 1af816fa
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@
        </com.android.internal.policy.impl.keyguard.KeyguardSecurityContainer>

        <ImageButton
              android:id="@+id/expand_challenge_handle"
              android:layout_width="match_parent"
              android:layout_height="@dimen/kg_widget_pager_bottom_padding"
              androidprv:layout_childType="expandChallengeHandle"
+1 −0
Original line number Diff line number Diff line
@@ -1888,6 +1888,7 @@

  <!-- Lockscreen -->
  <java-symbol type="bool" name="config_disableHomeUnlockSetting" />
  <java-symbol type="id" name="expand_challenge_handle" />
  <!-- Lock screen always show battery -->
  <java-symbol type="string" name="lockscreen_discharging" />

+20 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
import android.view.HapticFeedbackConstants;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -79,6 +80,7 @@ public class KeyguardHostView extends KeyguardViewBase {
    private KeyguardSecurityViewFlipper mSecurityViewContainer;
    private KeyguardSelectorView mKeyguardSelectorView;
    private KeyguardTransportControlView mTransportControl;
    private View mExpandChallengeView;
    private boolean mIsVerifyUnlockOnly;
    private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
    private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
@@ -250,9 +252,27 @@ public class KeyguardHostView extends KeyguardViewBase {

        showPrimarySecurityScreen(false);
        updateSecurityViews();

        mExpandChallengeView = (View) findViewById(R.id.expand_challenge_handle);
        if (mExpandChallengeView != null) {
            mExpandChallengeView.setOnLongClickListener(mFastUnlockClickListener);
        }

        minimizeChallengeIfDesired();
    }

    private final OnLongClickListener mFastUnlockClickListener = new OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            if (mLockPatternUtils.isTactileFeedbackEnabled()) {
                v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
                        HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
            }
            showNextSecurityScreenOrFinish(false);
            return true;
        }
    };

    private int getDisabledFeatures(DevicePolicyManager dpm) {
        int disabledFeatures = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE;
        if (dpm != null) {