Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Lockscreen: provide haptic feedback on longpress unlock

Change-Id: Ie7e32a0e3d410da26095bfce1a8e5ba94f0b5eaf
Signed-off-by: Dirk Rettschlag <dirk.rettschlag@gmail.com>
  • Loading branch information...
commit 41bb33320abaafe9c3dda2eac47d6c667a223932 1 parent 1d8321f
@MarcLandis MarcLandis authored
View
1  core/res/res/layout-port/keyguard_host_view.xml
@@ -93,6 +93,7 @@
android:background="@null"
android:src="@drawable/keyguard_expand_challenge_handle"
android:scaleType="center"
+ android:hapticFeedbackEnabled="true"
android:contentDescription="@string/keyguard_accessibility_expand_lock_area" />
</com.android.internal.policy.impl.keyguard.SlidingChallengeLayout>
View
10 policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -46,6 +46,7 @@
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;
@@ -263,10 +264,10 @@ protected void onFinishInflate() {
showPrimarySecurityScreen(false);
updateSecurityViews();
- if (Settings.System.getBoolean(getContext().getContentResolver(),
+ mExpandChallengeView = (View) findViewById(R.id.expand_challenge_handle);
+ if (mExpandChallengeView != null) {
+ if (Settings.System.getBoolean(getContext().getContentResolver(),
Settings.System.LOCKSCREEN_LONGPRESS_CHALLENGE, false)) {
- mExpandChallengeView = (View) findViewById(R.id.expand_challenge_handle);
- if (mExpandChallengeView != null) {
mExpandChallengeView.setOnLongClickListener(mFastUnlockClickListener);
}
}
@@ -277,6 +278,9 @@ protected void onFinishInflate() {
private final OnLongClickListener mFastUnlockClickListener = new OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
+ performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
+ HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING
+ | HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
showNextSecurityScreenOrFinish(false);
return true;
}
Please sign in to comment.
Something went wrong with that request. Please try again.