Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96945d53 authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Ensure vibration attributes are always logged.

The SKIP_VIBRATION telecom dump log was not logged in cases where a call
is completely inaudible.  Ensure we log that as well as the factors that
go into making the vibrator inaudible.

Test: Manual test for logs
Flag: NONE logs only change
Bug: 377960349
Change-Id: Ib63f932041c75f573e4ee636a3173c05c2d1a8a6
parent 6b2d00fc
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -358,6 +358,12 @@ public class Ringer {

            mVolumeShaperConfig = null;

            String vibratorAttrs = String.format("hasVibrator=%b, userRequestsVibrate=%b, "
                            + "ringerMode=%d, isVibratorEnabled=%b",
                    mVibrator.hasVibrator(),
                    mSystemSettingsUtil.isRingVibrationEnabled(mContext),
                    mAudioManager.getRingerMode(), isVibratorEnabled);

            if (attributes.isRingerAudible()) {
                mRingingCall = foregroundCall;
                Log.addEvent(foregroundCall, LogUtils.Events.START_RINGER);
@@ -404,6 +410,8 @@ public class Ringer {
                    }
                } else {
                    foregroundCall.setUserMissed(USER_MISSED_NO_VIBRATE);
                    Log.addEvent(foregroundCall, LogUtils.Events.SKIP_VIBRATION,
                            vibratorAttrs);
                    return attributes.shouldAcquireAudioFocus(); // ringer not audible
                }
            }
@@ -436,11 +444,7 @@ public class Ringer {
            if (!vibratorReserved) {
                foregroundCall.setUserMissed(USER_MISSED_NO_VIBRATE);
                Log.addEvent(foregroundCall, LogUtils.Events.SKIP_VIBRATION,
                        "hasVibrator=%b, userRequestsVibrate=%b, ringerMode=%d, "
                                + "isVibratorEnabled=%b",
                        mVibrator.hasVibrator(),
                        mSystemSettingsUtil.isRingVibrationEnabled(mContext),
                        mAudioManager.getRingerMode(), isVibratorEnabled);
                        vibratorAttrs);
            }

            // The vibration logic depends on the loaded ringtone, but we need to defer the ringtone
@@ -556,6 +560,11 @@ public class Ringer {
                mIsVibrating = true;
                mVibrator.vibrate(effect, VIBRATION_ATTRIBUTES);
                Log.i(this, "start vibration.");
            } else {
                Log.i(this, "vibrateIfNeeded: skip; isVibrating=%b, fgCallId=%s, vibratingCall=%s",
                        mIsVibrating,
                        (foregroundCall == null ? "null" : foregroundCall.getId()),
                        (mVibratingCall == null ? "null" : mVibratingCall.getId()));
            }
            // else stopped already: this isn't started unless a reservation was made.
        }