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

Commit bd644831 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Use classic vibration when ramping ringer" into main

parents 3ff81d45 1b023b9b
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -433,11 +433,6 @@ public class Ringer {
                    && isVibratorEnabled) {
                Log.i(this, "Muted haptic channels since audio coupled ramping ringer is disabled");
                hapticChannelsMuted = true;
                if (useCustomVibration(foregroundCall)) {
                    Log.i(this,
                            "Not muted haptic channel for customization when apply ramping ringer");
                    hapticChannelsMuted = false;
                }
            } else if (hapticChannelsMuted) {
                Log.i(this,
                        "Muted haptic channels isVibratorEnabled=%s, hapticPlaybackSupported=%s",
+0 −32
Original line number Diff line number Diff line
@@ -890,38 +890,6 @@ public class RingerTest extends TelecomTestCase {
        }
    }

    @SmallTest
    @Test
    @EnableFlags(Flags.FLAG_ENABLE_RINGTONE_HAPTICS_CUSTOMIZATION)
    public void testNotMuteHapticChannelWithRampingRinger() throws Exception {
        final Context context = ApplicationProvider.getApplicationContext();
        Uri defaultRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(context,
                RingtoneManager.TYPE_RINGTONE);
        assumeNotNull(defaultRingtoneUri);
        Uri FAKE_RINGTONE_VIBRATION_URI = defaultRingtoneUri.buildUpon().appendQueryParameter(
                        VIBRATION_PARAM, FAKE_VIBRATION_URI.toString()).build();
        mComponentContextFixture.putBooleanResource(
                com.android.internal.R.bool.config_ringtoneVibrationSettingsSupported, true);
        ArgumentCaptor<Boolean> muteHapticChannelCaptor = ArgumentCaptor.forClass(Boolean.class);
        try {
            RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE,
                    FAKE_RINGTONE_VIBRATION_URI);
            createRingerUnderTest(); // Needed after mock the config.
            mRingerUnderTest.startCallWaiting(mockCall1);
            ensureRingerIsAudible();
            enableRampingRinger();
            enableVibrationWhenRinging();
            assertTrue(startRingingAndWaitForAsync(mockCall2, false));
            verify(mockRingtoneFactory, atLeastOnce()).getRingtone(any(Call.class),
                    nullable(VolumeShaper.Configuration.class), muteHapticChannelCaptor.capture());
            assertFalse(muteHapticChannelCaptor.getValue());
        } finally {
            // Restore the default ringtone Uri
            RingtoneManager.setActualDefaultRingtoneUri(context, RingtoneManager.TYPE_RINGTONE,
                    defaultRingtoneUri);
        }
    }

    /**
     * Call startRinging and wait for its effects to have played out, to allow reliable assertions
     * after it. The effects are generally "start playing ringtone" and "start vibration" - not