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

Commit b9e20734 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8451755 from 026d702d to tm-release

Change-Id: I4bfe87e4a59b3aa01674474da5da77840e65846e
parents 1be35df6 026d702d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -45,6 +45,16 @@ public class CallAudioRoutePeripheralAdapter implements WiredHeadsetManager.List
        return mBluetoothRouteManager.isBluetoothAudioConnectedOrPending();
    }

    public boolean isHearingAidDeviceOn() {
        return mBluetoothRouteManager.isCachedHearingAidDevice(
                mBluetoothRouteManager.getBluetoothAudioConnectedDevice());
    }

    public boolean isLeAudioDeviceOn() {
        return mBluetoothRouteManager.isCachedLeAudioDevice(
                mBluetoothRouteManager.getBluetoothAudioConnectedDevice());
    }

    @Override
    public void onBluetoothDeviceListChanged() {
        mCallAudioRouteStateMachine.sendMessageWithSessionInfo(
+12 −0
Original line number Diff line number Diff line
@@ -5596,4 +5596,16 @@ public class CallsManager extends Call.ListenerBase
            UserHandle userHandle, ConnectionServiceWrapper service) {
        mConnectionServiceRepository.setService(componentName, userHandle, service);
    }

    /**
     * Generates a log "marking".  This is a unique call event which contains a specified message.
     * A log mark is triggered by the command: adb shell telecom log-mark MESSAGE
     * A tester can use this when executing tests to make it very clear when a particular test step
     * was reached.
     * @param message the message to mark in the logs.
     */
    public void requestLogMark(String message) {
        mCalls.forEach(c -> Log.addEvent(c, LogUtils.Events.USER_LOG_MARK, message));
        Log.addEvent(null /* global */, LogUtils.Events.USER_LOG_MARK, message);
    }
}
+16 −3
Original line number Diff line number Diff line
@@ -182,6 +182,9 @@ public class InCallTonePlayer extends Thread {
    private static final int STATE_ON = 1;
    private static final int STATE_STOPPED = 2;

    // Invalid audio stream
    private static final int STREAM_INVALID = -1;

    /**
     * Keeps count of the number of actively playing tones so that we can notify CallAudioManager
     * when we need focus and when it can be release. This should only be manipulated from the main
@@ -260,6 +263,7 @@ public class InCallTonePlayer extends Thread {
            final int mediaResourceId; // The resourceId of the tone to play.  Used for media-based
                                      // tones.

            int stream = STREAM_INVALID;
            switch (mToneId) {
                case TONE_BUSY:
                    // TODO: CDMA-specific tones
@@ -327,6 +331,12 @@ public class InCallTonePlayer extends Thread {
                    toneVolume = RELATIVE_VOLUME_HIPRI;
                    toneLengthMillis = Integer.MAX_VALUE - TIMEOUT_BUFFER_MILLIS;
                    mediaResourceId = TONE_RESOURCE_ID_UNDEFINED;
                    // When a hearing aid device or a LE audio device is used, ring back tone should
                    // use STREAM_VOICE_CALL
                    if (mCallAudioRoutePeripheralAdapter.isLeAudioDeviceOn()
                            || mCallAudioRoutePeripheralAdapter.isHearingAidDeviceOn()) {
                        stream = AudioManager.STREAM_VOICE_CALL;
                    }
                    break;
                case TONE_UNOBTAINABLE_NUMBER:
                    toneType = ToneGenerator.TONE_SUP_ERROR;
@@ -358,10 +368,13 @@ public class InCallTonePlayer extends Thread {
                    throw new IllegalStateException("Bad toneId: " + mToneId);
            }

            int stream = AudioManager.STREAM_VOICE_CALL;
            // Don't override already valid stream values
            if (stream == STREAM_INVALID) {
                stream = AudioManager.STREAM_VOICE_CALL;
                if (mCallAudioRoutePeripheralAdapter.isBluetoothAudioOn()) {
                    stream = AudioManager.STREAM_BLUETOOTH_SCO;
                }
            }

            if (toneType != ToneGenerator.TONE_UNKNOWN) {
                playToneGeneratorTone(stream, toneVolume, toneType, toneLengthMillis);
+18 −0
Original line number Diff line number Diff line
@@ -2025,6 +2025,24 @@ public class TelecomServiceImpl {
            }
        }

        @Override
        public void requestLogMark(String message) {
            try {
                Log.startSession("TSI.rLM");
                enforceShellOnly(Binder.getCallingUid(), "requestLogMark is for shell only");
                synchronized (mLock) {
                    long token = Binder.clearCallingIdentity();
                    try {
                        mCallsManager.requestLogMark(message);
                    } finally {
                        Binder.restoreCallingIdentity(token);
                    }
                }
            } finally {
                Log.endSession();
            }
        }

        @Override
        public void setTestPhoneAcctSuggestionComponent(String flattenedComponentName) {
            try {
+8 −0
Original line number Diff line number Diff line
@@ -644,6 +644,14 @@ public class BluetoothRouteManager extends StateMachine {
                mHfpActiveDeviceCache != null;
    }

    public boolean isCachedLeAudioDevice(BluetoothDevice device) {
        return mLeAudioActiveDeviceCache != null && mLeAudioActiveDeviceCache.equals(device);
    }

    public boolean isCachedHearingAidDevice(BluetoothDevice device) {
        return mHearingAidActiveDeviceCache != null && mHearingAidActiveDeviceCache.equals(device);
    }

    public Collection<BluetoothDevice> getConnectedDevices() {
        return mDeviceManager.getUniqueConnectedDevices();
    }
Loading