Update Telephony to follow framework vibration api change.
Bug:15279516
Change-Id: Ib023ac1f7c8b0d51098d37d850172d81f66aeed4
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 9ab2b5e..8baded6 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -35,6 +35,7 @@
import android.bluetooth.BluetoothHeadset;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
+import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.ToneGenerator;
import android.net.Uri;
@@ -79,6 +80,11 @@
// Time to display the DisplayInfo Record sent by CDMA network
private static final int DISPLAYINFO_NOTIFICATION_TIME = 2000; // msec
+ private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
+ .setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
+ .setUsage(AudioAttributes.USAGE_VOICE_COMMUNICATION)
+ .build();
+
/** The singleton instance. */
private static CallNotifier sInstance;
@@ -1705,7 +1711,7 @@
} else if (mIsEmergencyToneOn == EMERGENCY_TONE_VIBRATE) {
log("EmergencyTonePlayerVibrator.start(): emergency vibrate...");
if (mEmgVibrator != null) {
- mEmgVibrator.vibrate(mVibratePattern, 0, AudioManager.STREAM_VOICE_CALL);
+ mEmgVibrator.vibrate(mVibratePattern, 0, VIBRATION_ATTRIBUTES);
mCurrentEmergencyToneState = EMERGENCY_TONE_VIBRATE;
}
}
diff --git a/src/com/android/phone/Ringer.java b/src/com/android/phone/Ringer.java
index 4688ba3..87becaa 100644
--- a/src/com/android/phone/Ringer.java
+++ b/src/com/android/phone/Ringer.java
@@ -17,6 +17,7 @@
package com.android.phone;
import android.content.Context;
+import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
@@ -49,6 +50,11 @@
private static final int VIBRATE_LENGTH = 1000; // ms
private static final int PAUSE_LENGTH = 1000; // ms
+ private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
+ .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
+ .setUsage(AudioAttributes.USAGE_NOTIFICATION_TELEPHONY_RINGTONE)
+ .build();
+
/** The singleton instance. */
private static Ringer sInstance;
@@ -253,7 +259,7 @@
private class VibratorThread extends Thread {
public void run() {
while (mContinueVibrating) {
- mVibrator.vibrate(VIBRATE_LENGTH, AudioManager.STREAM_RING);
+ mVibrator.vibrate(VIBRATE_LENGTH, VIBRATION_ATTRIBUTES);
SystemClock.sleep(VIBRATE_LENGTH + PAUSE_LENGTH);
}
}