merge in jb-mr0-release history after reset to jb-dev
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index e8d7043..ac110f2 100755
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -39,6 +39,7 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.SystemProperties;
+import android.os.SystemVibrator;
import android.os.Vibrator;
import android.provider.CallLog.Calls;
import android.provider.Settings;
@@ -1932,7 +1933,9 @@
new long[] { EMG_VIBRATE_LENGTH, EMG_VIBRATE_PAUSE };
private ToneGenerator mToneGenerator;
- private Vibrator mEmgVibrator;
+ // We don't rely on getSystemService(Context.VIBRATOR_SERVICE) to make sure this vibrator
+ // object will be isolated from others.
+ private Vibrator mEmgVibrator = new SystemVibrator();
private int mInCallVolume;
/**
@@ -1963,7 +1966,6 @@
}
} else if (mIsEmergencyToneOn == EMERGENCY_TONE_VIBRATE) {
log("EmergencyTonePlayerVibrator.start(): emergency vibrate...");
- mEmgVibrator = (Vibrator)mApplication.getSystemService(Context.VIBRATOR_SERVICE);
if (mEmgVibrator != null) {
mEmgVibrator.vibrate(mVibratePattern, 0);
mCurrentEmergencyToneState = EMERGENCY_TONE_VIBRATE;
diff --git a/src/com/android/phone/HapticFeedback.java b/src/com/android/phone/HapticFeedback.java
index c85daa9..7001ee0 100644
--- a/src/com/android/phone/HapticFeedback.java
+++ b/src/com/android/phone/HapticFeedback.java
@@ -16,13 +16,14 @@
package com.android.phone;
-import android.content.Context;
import android.content.ContentResolver;
+import android.content.Context;
import android.content.res.Resources;
+import android.os.SystemVibrator;
import android.os.Vibrator;
-import android.util.Log;
import android.provider.Settings;
import android.provider.Settings.System;
+import android.util.Log;
/**
* Handles the haptic feedback: a light buzz happening when the user
@@ -89,7 +90,9 @@
public void init(Context context, boolean enabled) {
mEnabled = enabled;
if (enabled) {
- mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
+ // We don't rely on getSystemService(Context.VIBRATOR_SERVICE) to make sure this
+ // vibrator object will be isolated from others.
+ mVibrator = new SystemVibrator();
if (!loadHapticSystemPattern(context.getResources())) {
mHapticPattern = new long[] {0, DURATION, 2 * DURATION, 3 * DURATION};
}
diff --git a/src/com/android/phone/Ringer.java b/src/com/android/phone/Ringer.java
index da251bc..edbcdfa 100644
--- a/src/com/android/phone/Ringer.java
+++ b/src/com/android/phone/Ringer.java
@@ -29,6 +29,7 @@
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.SystemProperties;
+import android.os.SystemVibrator;
import android.os.Vibrator;
import android.provider.Settings;
import android.util.Log;
@@ -84,7 +85,9 @@
private Ringer(Context context) {
mContext = context;
mPowerManager = IPowerManager.Stub.asInterface(ServiceManager.getService(Context.POWER_SERVICE));
- mVibrator = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
+ // We don't rely on getSystemService(Context.VIBRATOR_SERVICE) to make sure this
+ // vibrator object will be isolated from others.
+ mVibrator = new SystemVibrator();
}
/**