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

Commit d017c14a authored by Garvit Narang's avatar Garvit Narang
Browse files

Remove theater mode references from telecom package

This code is obsolete and no longer required.

Bug: 353926180
Test: unit test, manual flash and check
Flag: EXEMPT trivial bug fix
Change-Id: I872632f22ba4281c7833cead7a78e9f4cc5cfd17
parent c00fa9f1
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -52,9 +52,9 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.server.telecom.LogUtils.EventTimer;
import com.android.server.telecom.flags.FeatureFlags;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
@@ -579,10 +579,6 @@ public class Ringer {
    }

    public void startCallWaiting(Call call, String reason) {
        if (mSystemSettingsUtil.isTheaterModeOn(mContext)) {
            return;
        }

        if (mInCallController.doesConnectedDialerSupportRinging(
                call.getAssociatedUser())) {
            Log.addEvent(call, LogUtils.Events.SKIP_RINGING, "Dialer handles");
@@ -734,8 +730,6 @@ public class Ringer {
        boolean hasExternalRinger = hasExternalRinger(call);
        timer.record("hasExternalRinger");
        // Don't do call waiting operations or vibration unless these are false.
        boolean isTheaterModeOn = mSystemSettingsUtil.isTheaterModeOn(mContext);
        timer.record("isTheaterModeOn");
        boolean letDialerHandleRinging = mInCallController.doesConnectedDialerSupportRinging(
                call.getAssociatedUser());
        timer.record("letDialerHandleRinging");
@@ -744,15 +738,24 @@ public class Ringer {
        timer.record("isWorkProfileInQuietMode");

        Log.i(this, "startRinging timings: " + timer);
        boolean endEarly = isTheaterModeOn || letDialerHandleRinging || isSelfManaged ||
                hasExternalRinger || isSilentRingingRequested || isWorkProfileInQuietMode;
        boolean endEarly =
                letDialerHandleRinging
                        || isSelfManaged
                        || hasExternalRinger
                        || isSilentRingingRequested
                        || isWorkProfileInQuietMode;

        if (endEarly) {
            Log.i(this, "Ending early -- isTheaterModeOn=%s, letDialerHandleRinging=%s, " +
                            "isSelfManaged=%s, hasExternalRinger=%s, silentRingingRequested=%s, " +
                            "isWorkProfileInQuietMode=%s",
                    isTheaterModeOn, letDialerHandleRinging, isSelfManaged, hasExternalRinger,
                    isSilentRingingRequested, isWorkProfileInQuietMode);
            Log.i(
                    this,
                    "Ending early -- letDialerHandleRinging=%s, isSelfManaged=%s, "
                            + "hasExternalRinger=%s, silentRingingRequested=%s, "
                            + "isWorkProfileInQuietMode=%s",
                    letDialerHandleRinging,
                    isSelfManaged,
                    hasExternalRinger,
                    isSilentRingingRequested,
                    isWorkProfileInQuietMode);
        }

        // Acquire audio focus under any of the following conditions:
+0 −5
Original line number Diff line number Diff line
@@ -35,11 +35,6 @@ public class SystemSettingsUtil {
    private static final String RAMPING_RINGER_AUDIO_COUPLED_VIBRATION_ENABLED =
            "ramping_ringer_audio_coupled_vibration_enabled";

    public boolean isTheaterModeOn(Context context) {
        return Settings.Global.getInt(context.getContentResolver(), Settings.Global.THEATER_MODE_ON,
                0) == 1;
    }

    public boolean isRingVibrationEnabled(Context context) {
        // VIBRATE_WHEN_RINGING setting was deprecated, only RING_VIBRATION_INTENSITY controls the
        // ringtone vibrations on/off state now. Ramping ringer should only be applied when ring
+0 −13
Original line number Diff line number Diff line
@@ -324,19 +324,6 @@ public class RingerTest extends TelecomTestCase {
        assertEquals(EXPECTED_SIMPLE_VIBRATION_PATTERN, mRingerUnderTest.mDefaultVibrationEffect);
    }

    @SmallTest
    @Test
    public void testNoActionInTheaterMode() throws Exception {
        // Start call waiting to make sure that it doesn't stop when we start ringing
        mRingerUnderTest.startCallWaiting(mockCall1);
        when(mockSystemSettingsUtil.isTheaterModeOn(any(Context.class))).thenReturn(true);
        assertFalse(startRingingAndWaitForAsync(mockCall2, false));
        verifyZeroInteractions(mockRingtoneFactory);
        verify(mockTonePlayer, never()).stopTone();
        verify(mockVibrator, never())
                .vibrate(any(VibrationEffect.class), any(VibrationAttributes.class));
    }

    @SmallTest
    @Test
    public void testNoActionWithExternalRinger() throws Exception {