diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-04-13 01:55:38 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-04-13 04:05:17 -0700 |
commit | c2346134bb519a54d50655cbef940fc3fdec60a9 (patch) | |
tree | 6b86f97b2175bc2b0181cbf123e4f874867e7c91 /services/java/com/android/server/NotificationManagerService.java | |
parent | 069c4f3f0c8190289d60296ec54fafa56abb4776 (diff) |
Extract Vibrator implementation from interface.
Moved the core logic of Vibrator into SystemVibrator, potentially
allowing for the creation of other Vibrator subclasses.
Fixed several places where we were creating new Vibrator
instances unnecessarily instead of getting it from the Context.
It is safe to make Vibrator abstract because its constructor
was hidden from the SDK so it was not possible to subclass it.
Bug: 6334179
Change-Id: I18ece6544c26a7efb2d5099f8346a10aef8a5e18
Diffstat (limited to 'services/java/com/android/server/NotificationManagerService.java')
-rwxr-xr-x | services/java/com/android/server/NotificationManagerService.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 3db460107dc9..b22be76a2ec4 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -100,7 +100,7 @@ public class NotificationManagerService extends INotificationManager.Stub private int mDisabledNotifications; private NotificationRecord mVibrateNotification; - private Vibrator mVibrator = new Vibrator(); + private Vibrator mVibrator; // for enabling and disabling notification pulse behavior private boolean mScreenOn = true; @@ -398,6 +398,7 @@ public class NotificationManagerService extends INotificationManager.Stub { super(); mContext = context; + mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE); mAm = ActivityManagerNative.getDefault(); mSound = new NotificationPlayer(TAG); mSound.setUsesWakeLock(context); |