Merge "Only call finish on operations that have started." into nyc-dev
am: 6df8a9a89f
* commit '6df8a9a89fc87649595926592bf895768c861b68':
Only call finish on operations that have started.
Change-Id: I59f9c9a74cf2beba8f14906820b65ae8d22ed8ce
diff --git a/services/core/java/com/android/server/VibratorService.java b/services/core/java/com/android/server/VibratorService.java
index 4db60d5..7f3eb15 100644
--- a/services/core/java/com/android/server/VibratorService.java
+++ b/services/core/java/com/android/server/VibratorService.java
@@ -306,7 +306,6 @@
synchronized (mVibrations) {
removeVibrationLocked(token);
doCancelVibrateLocked();
- mCurrentVibration = vib;
addToPreviousVibrationsLocked(vib);
startVibrationLocked(vib);
}
@@ -368,7 +367,6 @@
} else {
// A negative repeat means that this pattern is not meant
// to repeat. Treat it like a simple vibration.
- mCurrentVibration = vib;
startVibrationLocked(vib);
}
addToPreviousVibrationsLocked(vib);
@@ -443,8 +441,7 @@
mCurrentVibration = null;
return;
}
- mCurrentVibration = mVibrations.getFirst();
- startVibrationLocked(mCurrentVibration);
+ startVibrationLocked(mVibrations.getFirst());
}
// Lock held on mVibrations
@@ -466,7 +463,9 @@
mode = mAppOpsService.startOperation(AppOpsManager.getToken(mAppOpsService),
AppOpsManager.OP_VIBRATE, vib.mUid, vib.mOpPkg);
}
- if (mode != AppOpsManager.MODE_ALLOWED) {
+ if (mode == AppOpsManager.MODE_ALLOWED) {
+ mCurrentVibration = vib;
+ } else {
if (mode == AppOpsManager.MODE_ERRORED) {
Slog.w(TAG, "Would be an error: vibrate from uid " + vib.mUid);
}