diff options
author | Sri Lakshmi Punuru <c_spunur@qualcomm.com> | 2010-06-23 17:00:29 -0700 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2010-07-24 05:26:39 -0400 |
commit | 34a48ef431ba372ef2a444be2d4e4d2c95b756b2 (patch) | |
tree | 10a08bf1a529844b9e8d8e1b28490941c8179d1c /services/java/com/android | |
parent | 97b8515105cc9dfd812c8b9954d7ec3e46527425 (diff) | |
download | frameworks_base-34a48ef431ba372ef2a444be2d4e4d2c95b756b2.zip frameworks_base-34a48ef431ba372ef2a444be2d4e4d2c95b756b2.tar.gz frameworks_base-34a48ef431ba372ef2a444be2d4e4d2c95b756b2.tar.bz2 |
VibratorService: Death Notifications
-Remove jni references to Vibration object
When the Vibration is completed, unlinkToDeath should be called on
the binder to remove previously registered death notifications.
This in-turn removes the jni global references to Vibration objects
-Register Vibrations without pattern for a death notification
-Check whether the vibration thread is completed, before unlinking the binder
Change-Id: I328614cbd784378508e691ebcef619c456e41ec5
CRs-Fixed: 228653, 231294
Diffstat (limited to 'services/java/com/android')
-rwxr-xr-x | services/java/com/android/server/VibratorService.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java index 2e7e3e1..379c158 100755 --- a/services/java/com/android/server/VibratorService.java +++ b/services/java/com/android/server/VibratorService.java @@ -123,8 +123,17 @@ public class VibratorService extends IVibratorService.Stub { return; } Vibration vib = new Vibration(token, milliseconds); + try { + token.linkToDeath(vib, 0); + } catch (RemoteException e) { + return; + } synchronized (mVibrations) { removeVibrationLocked(token); + if ((mCurrentVibration != null) && (mThread == null)) { + mCurrentVibration.mToken.unlinkToDeath(mCurrentVibration, 0); + mCurrentVibration = null; + } doCancelVibrateLocked(); mCurrentVibration = vib; startVibrationLocked(vib); @@ -174,6 +183,10 @@ public class VibratorService extends IVibratorService.Stub { synchronized (mVibrations) { removeVibrationLocked(token); + if ((mCurrentVibration != null) && (mThread == null)) { + mCurrentVibration.mToken.unlinkToDeath(mCurrentVibration, 0); + mCurrentVibration = null; + } doCancelVibrateLocked(); if (repeat >= 0) { mVibrations.addFirst(vib); @@ -205,6 +218,10 @@ public class VibratorService extends IVibratorService.Stub { doCancelVibrateLocked(); startNextVibrationLocked(); } + if ((mCurrentVibration != null) && (mThread == null)) { + mCurrentVibration.mToken.unlinkToDeath(mCurrentVibration, 0); + mCurrentVibration = null; + } } } finally { |