Snap for 4641295 from fb67b77c260dae1ac677a8cb656565caeb82c998 to pi-release
Change-Id: I4c32b5c6256f3aaa0e87f812754de31bcd399d63
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 2e3bc37..540e4a4 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -40,6 +40,7 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" />
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.STOP_APP_SWITCHES" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
diff --git a/res/values/config.xml b/res/values/config.xml
index ecfa12b..7db3315 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -50,4 +50,9 @@
<!-- Determines if the granting of temporary location permission to the default dialer
during an emergency call should be allowed. -->
<bool name="grant_location_permission_enabled">false</bool>
+
+ <!-- When true, a simple full intensity on/off vibration pattern will be used when calls ring.
+ When false, a fancy vibration pattern which ramps up and down will be used.
+ Devices should overlay this value based on the type of vibration hardware they employ. -->
+ <bool name="use_simple_vibration_pattern">false</bool>
</resources>
diff --git a/src/com/android/server/telecom/Ringer.java b/src/com/android/server/telecom/Ringer.java
index 39a8185..e8b2b26 100644
--- a/src/com/android/server/telecom/Ringer.java
+++ b/src/com/android/server/telecom/Ringer.java
@@ -49,6 +49,18 @@
255, // Peak
0}; // pause before repetition
+ private static final long[] SIMPLE_VIBRATION_PATTERN = {
+ 0, // No delay before starting
+ 1000, // How long to vibrate
+ 1000, // How long to wait before vibrating again
+ };
+
+ private static final int[] SIMPLE_VIBRATION_AMPLITUDE = {
+ 0, // No delay before starting
+ 255, // Vibrate full amplitude
+ 0, // No amplitude while waiting
+ };
+
/**
* Indicates that vibration should be repeated at element 5 in the {@link #PULSE_AMPLITUDE} and
* {@link #PULSE_PATTERN} arrays. This means repetition will happen for the main ease-in/peak
@@ -56,6 +68,8 @@
*/
private static final int REPEAT_VIBRATION_AT = 5;
+ private static final int REPEAT_SIMPLE_VIBRATION_AT = 1;
+
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE)
@@ -110,8 +124,13 @@
mRingtoneFactory = ringtoneFactory;
mInCallController = inCallController;
- mVibrationEffect = VibrationEffect.createWaveform(PULSE_PATTERN, PULSE_AMPLITUDE,
- REPEAT_VIBRATION_AT);
+ if (mContext.getResources().getBoolean(R.bool.use_simple_vibration_pattern)) {
+ mVibrationEffect = VibrationEffect.createWaveform(SIMPLE_VIBRATION_PATTERN,
+ SIMPLE_VIBRATION_AMPLITUDE, REPEAT_SIMPLE_VIBRATION_AT);
+ } else {
+ mVibrationEffect = VibrationEffect.createWaveform(PULSE_PATTERN, PULSE_AMPLITUDE,
+ REPEAT_VIBRATION_AT);
+ }
}
public boolean startRinging(Call foregroundCall, boolean isHfpDeviceAttached) {