summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-06-10 15:58:08 -0700
committerJorim Jaggi <jjaggi@google.com>2015-06-10 23:17:32 +0000
commit9ff1510aeba910c22b2e31c29a93b08281feae4f (patch)
treed4c72bbab54b992fb6d48c39512f5247a0f71456
parentdcaf1227de020069adf7d079a7b38163bbe12c7a (diff)
downloadframeworks_base-9ff1510aeba910c22b2e31c29a93b08281feae4f.zip
frameworks_base-9ff1510aeba910c22b2e31c29a93b08281feae4f.tar.gz
frameworks_base-9ff1510aeba910c22b2e31c29a93b08281feae4f.tar.bz2
Fix vibration when expanding notifications
To make it more consistent with other vibration feedback in the system. Bug: 21549323 Change-Id: Ia4ef1cf17c28f6069635797af94991a639e1cef0
-rw-r--r--packages/SystemUI/res/values/config.xml2
-rw-r--r--packages/SystemUI/src/com/android/systemui/ExpandHelper.java28
2 files changed, 4 insertions, 26 deletions
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index de5639b..260d81b 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -135,8 +135,6 @@
<!-- The maximum number of items to be displayed in quick settings -->
<integer name="quick_settings_detail_max_item_count">7</integer>
- <integer name="blinds_pop_duration_ms">10</integer>
-
<!-- Should "4G" be shown instead of "LTE" when the network is NETWORK_TYPE_LTE? -->
<bool name="config_show4GForLTE">true</bool>
diff --git a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
index fece07f..b0e2afa 100644
--- a/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/ExpandHelper.java
@@ -25,6 +25,7 @@ import android.media.AudioAttributes;
import android.os.Vibrator;
import android.util.Log;
import android.view.Gravity;
+import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.OnScaleGestureListener;
@@ -64,15 +65,6 @@ public class ExpandHelper implements Gefingerpoken {
// 2f: maximum brightness is stretching a 1U to 3U, or a 4U to 6U
private static final float STRETCH_INTERVAL = 2f;
- // level of glow for a touch, without overstretch
- // overstretch fills the range (GLOW_BASE, 1.0]
- private static final float GLOW_BASE = 0.5f;
-
- private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
- .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
- .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
- .build();
-
@SuppressWarnings("unused")
private Context mContext;
@@ -94,13 +86,11 @@ public class ExpandHelper implements Gefingerpoken {
private float mLastSpanY;
private int mTouchSlop;
private float mLastMotionY;
- private int mPopDuration;
private float mPullGestureMinXSpan;
private Callback mCallback;
private ScaleGestureDetector mSGD;
private ViewScaler mScaler;
private ObjectAnimator mScaleAnimation;
- private Vibrator mVibrator;
private boolean mEnabled = true;
private ExpandableView mResizedView;
private float mCurrentHeight;
@@ -174,7 +164,6 @@ public class ExpandHelper implements Gefingerpoken {
mScaler = new ViewScaler();
mGravity = Gravity.TOP;
mScaleAnimation = ObjectAnimator.ofFloat(mScaler, "height", 0f);
- mPopDuration = mContext.getResources().getInteger(R.integer.blinds_pop_duration_ms);
mPullGestureMinXSpan = mContext.getResources().getDimension(R.dimen.pull_span_min);
final ViewConfiguration configuration = ViewConfiguration.get(mContext);
@@ -452,7 +441,9 @@ public class ExpandHelper implements Gefingerpoken {
}
if (!mHasPopped) {
- vibrate(mPopDuration);
+ if (mEventSource != null) {
+ mEventSource.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
+ }
mHasPopped = true;
}
@@ -600,16 +591,5 @@ public class ExpandHelper implements Gefingerpoken {
public void onlyObserveMovements(boolean onlyMovements) {
mOnlyMovements = onlyMovements;
}
-
- /**
- * Triggers haptic feedback.
- */
- private synchronized void vibrate(long duration) {
- if (mVibrator == null) {
- mVibrator = (android.os.Vibrator)
- mContext.getSystemService(Context.VIBRATOR_SERVICE);
- }
- mVibrator.vibrate(duration, VIBRATION_ATTRIBUTES);
- }
}