Don't suppress haptic feedback on keyguard anymore.
This enables haptic feedback from virtual keys, lift-to-wake,
and long-press power to work as expected on the keyguard.
There doesn't seem to be a good reason for us to block haptic feedback
on keyguard anymore. The PIN, pattern, and password locks already
bypass this check and vibrate and require a swipe to access in
the first place. So there doesn't seem to be much potential
for accidental vibration anymore.
If this becomes a problem then we can investigate more targeted
means to suppress undesired vibration.
Added some debugging code to VibratorService.
Bug: 16535403
Change-Id: Ia7a5d8c35244009db36c358e5cbcbf8cf5d68768
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 248a303..20f6f1c 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -55,6 +55,7 @@
public class VibratorService extends IVibratorService.Stub
implements InputManager.InputDeviceListener {
private static final String TAG = "VibratorService";
+ private static final boolean DEBUG = false;
private final LinkedList<Vibration> mVibrations;
private Vibration mCurrentVibration;
@@ -205,6 +206,7 @@
}
}
+ @Override // Binder call
public boolean hasVibrator() {
return doVibratorExists();
}
@@ -220,6 +222,7 @@
Binder.getCallingPid(), Binder.getCallingUid(), null);
}
+ @Override // Binder call
public void vibrate(int uid, String opPkg, long milliseconds, int usageHint,
IBinder token) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE)
@@ -237,6 +240,10 @@
return;
}
+ if (DEBUG) {
+ Slog.d(TAG, "Vibrating for " + milliseconds + " ms.");
+ }
+
Vibration vib = new Vibration(token, milliseconds, usageHint, uid, opPkg);
final long ident = Binder.clearCallingIdentity();
@@ -262,6 +269,7 @@
return true;
}
+ @Override // Binder call
public void vibratePattern(int uid, String packageName, long[] pattern, int repeat,
int usageHint, IBinder token) {
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.VIBRATE)
@@ -272,13 +280,13 @@
// so wakelock calls will succeed
long identity = Binder.clearCallingIdentity();
try {
- if (false) {
+ if (DEBUG) {
String s = "";
int N = pattern.length;
for (int i=0; i<N; i++) {
s += " " + pattern[i];
}
- Slog.i(TAG, "vibrating with pattern: " + s);
+ Slog.d(TAG, "Vibrating with pattern:" + s);
}
// we're running in the server so we can't fail
@@ -314,6 +322,7 @@
}
}
+ @Override // Binder call
public void cancelVibrate(IBinder token) {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.VIBRATE,
@@ -325,6 +334,9 @@
synchronized (mVibrations) {
final Vibration vib = removeVibrationLocked(token);
if (vib == mCurrentVibration) {
+ if (DEBUG) {
+ Slog.d(TAG, "Canceling vibration.");
+ }
doCancelVibrateLocked();
startNextVibrationLocked();
}
@@ -336,6 +348,7 @@
}
private final Runnable mVibrationRunnable = new Runnable() {
+ @Override
public void run() {
synchronized (mVibrations) {
doCancelVibrateLocked();
@@ -516,6 +529,9 @@
private void doVibratorOn(long millis, int uid, int usageHint) {
synchronized (mInputDeviceVibrators) {
+ if (DEBUG) {
+ Slog.d(TAG, "Turning vibrator on for " + millis + " ms.");
+ }
try {
mBatteryStatsService.noteVibratorOn(uid, millis);
mCurVibUid = uid;
@@ -536,6 +552,9 @@
private void doVibratorOff() {
synchronized (mInputDeviceVibrators) {
+ if (DEBUG) {
+ Slog.d(TAG, "Turning vibrator off.");
+ }
if (mCurVibUid >= 0) {
try {
mBatteryStatsService.noteVibratorOff(mCurVibUid);