Loading Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ filegroup { // Build the Telecom service. android_app { name: "Telecom", static_libs: ["org.lineageos.lib.phone"], static_libs: [ "org.lineageos.lib.phone", "org.lineageos.platform.internal", ], srcs: [ ":Telecom-srcs", "proto/**/*.proto", Loading src/com/android/server/telecom/Ringer.java +30 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.telecom; import android.app.Notification; import android.app.NotificationManager; import android.app.Person; import android.content.ContentResolver; import android.content.Context; import android.os.VibrationEffect; import android.telecom.Log; Loading @@ -34,6 +35,8 @@ import android.os.Vibrator; import com.android.internal.annotations.VisibleForTesting; import com.android.server.telecom.LogUtils.EventTimer; import lineageos.providers.LineageSettings; import java.util.ArrayList; import java.util.Arrays; import java.util.List; Loading Loading @@ -77,6 +80,9 @@ public class Ringer { private static final int RAMPING_RINGER_VIBRATION_DURATION = 5000; private static final int RAMPING_RINGER_DURATION = 10000; private int mRampingRingerDuration = -1; // ramping ringer duration in millisecond private float mRampingRingerStartVolume = 0f; static { // construct complete pulse pattern PULSE_PATTERN = new long[PULSE_PRIMING_PATTERN.length + PULSE_RAMPING_PATTERN.length]; Loading Loading @@ -303,9 +309,30 @@ public class Ringer { hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, mVolumeShaperConfig, isVibratorEnabled); } else { // Ramping ringtone is not enabled. hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, null, isVibratorEnabled); final ContentResolver cr = mContext.getContentResolver(); if (LineageSettings.System.getInt(cr, LineageSettings.System.INCREASING_RING, 0) != 0) { float startVolume = LineageSettings.System.getFloat(cr, LineageSettings.System.INCREASING_RING_START_VOLUME, 0.1f); int rampUpTime = LineageSettings.System.getInt(cr, LineageSettings.System.INCREASING_RING_RAMP_UP_TIME, 20); if (mVolumeShaperConfig == null || mRampingRingerDuration != rampUpTime || mRampingRingerStartVolume != startVolume) { mVolumeShaperConfig = new VolumeShaper.Configuration.Builder() .setDuration(rampUpTime * 1000) .setCurve(new float[] {0.f, 1.f}, new float[] {startVolume, 1.f}) .setInterpolatorType(VolumeShaper .Configuration.INTERPOLATOR_TYPE_LINEAR) .build(); mRampingRingerDuration = rampUpTime; mRampingRingerStartVolume = startVolume; } } else { mVolumeShaperConfig = null; } hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, mVolumeShaperConfig, isVibratorEnabled); effect = getVibrationEffectForCall(mRingtoneFactory, foregroundCall); } } else { Loading Loading
Android.bp +4 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,10 @@ filegroup { // Build the Telecom service. android_app { name: "Telecom", static_libs: ["org.lineageos.lib.phone"], static_libs: [ "org.lineageos.lib.phone", "org.lineageos.platform.internal", ], srcs: [ ":Telecom-srcs", "proto/**/*.proto", Loading
src/com/android/server/telecom/Ringer.java +30 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.server.telecom; import android.app.Notification; import android.app.NotificationManager; import android.app.Person; import android.content.ContentResolver; import android.content.Context; import android.os.VibrationEffect; import android.telecom.Log; Loading @@ -34,6 +35,8 @@ import android.os.Vibrator; import com.android.internal.annotations.VisibleForTesting; import com.android.server.telecom.LogUtils.EventTimer; import lineageos.providers.LineageSettings; import java.util.ArrayList; import java.util.Arrays; import java.util.List; Loading Loading @@ -77,6 +80,9 @@ public class Ringer { private static final int RAMPING_RINGER_VIBRATION_DURATION = 5000; private static final int RAMPING_RINGER_DURATION = 10000; private int mRampingRingerDuration = -1; // ramping ringer duration in millisecond private float mRampingRingerStartVolume = 0f; static { // construct complete pulse pattern PULSE_PATTERN = new long[PULSE_PRIMING_PATTERN.length + PULSE_RAMPING_PATTERN.length]; Loading Loading @@ -303,9 +309,30 @@ public class Ringer { hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, mVolumeShaperConfig, isVibratorEnabled); } else { // Ramping ringtone is not enabled. hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, null, isVibratorEnabled); final ContentResolver cr = mContext.getContentResolver(); if (LineageSettings.System.getInt(cr, LineageSettings.System.INCREASING_RING, 0) != 0) { float startVolume = LineageSettings.System.getFloat(cr, LineageSettings.System.INCREASING_RING_START_VOLUME, 0.1f); int rampUpTime = LineageSettings.System.getInt(cr, LineageSettings.System.INCREASING_RING_RAMP_UP_TIME, 20); if (mVolumeShaperConfig == null || mRampingRingerDuration != rampUpTime || mRampingRingerStartVolume != startVolume) { mVolumeShaperConfig = new VolumeShaper.Configuration.Builder() .setDuration(rampUpTime * 1000) .setCurve(new float[] {0.f, 1.f}, new float[] {startVolume, 1.f}) .setInterpolatorType(VolumeShaper .Configuration.INTERPOLATOR_TYPE_LINEAR) .build(); mRampingRingerDuration = rampUpTime; mRampingRingerStartVolume = startVolume; } } else { mVolumeShaperConfig = null; } hapticsFuture = mRingtonePlayer.play(mRingtoneFactory, foregroundCall, mVolumeShaperConfig, isVibratorEnabled); effect = getVibrationEffectForCall(mRingtoneFactory, foregroundCall); } } else { Loading