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

Commit b8b7dae8 authored by Ugo Yu's avatar Ugo Yu Committed by William Escande
Browse files

More logs in HeadsetClient

- More log for SCO connection
- Corrects some logs in the HFPC state machine

Bug: 205601100
Test: Manual
Change-Id: I306e8c61969d9228186bd5d3e0e341a4c584e916
(cherry picked from commit e3225277ca91077c84047712bd7b5036ef5fd353)
parent 3120f97c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -904,6 +904,8 @@ public class HeadsetClientService extends ProfileService {

    public void setAudioRouteAllowed(BluetoothDevice device, boolean allowed) {
        enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
        Log.i(TAG, "setAudioRouteAllowed: device=" + device + ", allowed=" + allowed + ", "
                + Utils.getUidPidString());
        HeadsetClientStateMachine sm = mStateMachineMap.get(device);
        if (sm != null) {
            sm.setAudioRouteAllowed(allowed);
@@ -920,6 +922,7 @@ public class HeadsetClientService extends ProfileService {
    }

    public boolean connectAudio(BluetoothDevice device) {
        Log.i(TAG, "connectAudio: device=" + device + ", " + Utils.getUidPidString());
        HeadsetClientStateMachine sm = getStateMachine(device);
        if (sm == null) {
            Log.e(TAG, "SM does not exist for device " + device);
+7 −5
Original line number Diff line number Diff line
@@ -985,8 +985,8 @@ public class HeadsetClientStateMachine extends StateMachine {
                broadcastConnectionState(mCurrentDevice, BluetoothProfile.STATE_DISCONNECTED,
                        BluetoothProfile.STATE_CONNECTED);
            } else if (mPrevState != null) { // null is the default state before Disconnected
                Log.e(TAG, "Connected: Illegal state transition from " + mPrevState.getName()
                        + " to Connecting, mCurrentDevice=" + mCurrentDevice);
                Log.e(TAG, "Disconnected: Illegal state transition from " + mPrevState.getName()
                        + " to Disconnected, mCurrentDevice=" + mCurrentDevice);
            }
            mCurrentDevice = null;
        }
@@ -1087,7 +1087,7 @@ public class HeadsetClientStateMachine extends StateMachine {
                        BluetoothProfile.STATE_DISCONNECTED);
            } else {
                String prevStateName = mPrevState == null ? "null" : mPrevState.getName();
                Log.e(TAG, "Connected: Illegal state transition from " + prevStateName
                Log.e(TAG, "Connecting: Illegal state transition from " + prevStateName
                        + " to Connecting, mCurrentDevice=" + mCurrentDevice);
            }
        }
@@ -1242,7 +1242,7 @@ public class HeadsetClientStateMachine extends StateMachine {
            } else if (mPrevState != mAudioOn) {
                String prevStateName = mPrevState == null ? "null" : mPrevState.getName();
                Log.e(TAG, "Connected: Illegal state transition from " + prevStateName
                        + " to Connecting, mCurrentDevice=" + mCurrentDevice);
                        + " to Connected, mCurrentDevice=" + mCurrentDevice);
            }
            mService.updateBatteryLevel();
        }
@@ -1667,8 +1667,10 @@ public class HeadsetClientStateMachine extends StateMachine {
                        Log.d(TAG, "mAudioRouteAllowed=" + mAudioRouteAllowed);
                    }
                    if (!mAudioRouteAllowed) {
                        Log.i(TAG, "Audio is not allowed! Disconnect SCO.");
                        sendMessage(HeadsetClientStateMachine.DISCONNECT_AUDIO);
                        break;
                        // Don't continue connecting!
                        return;
                    }

                    // Audio state is split in two parts, the audio focus is maintained by the