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

Commit bdabe356 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I306e8c61,I271da857

* changes:
  More logs in HeadsetClient
  Fix logging in HeadsetClientStateMachine.
parents 2b7709fb b8b7dae8
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);
+13 −10
Original line number Diff line number Diff line
@@ -211,11 +211,12 @@ public class HeadsetClientStateMachine extends StateMachine {
    }

    public void dump(StringBuilder sb) {
        if (mCurrentDevice == null) return;
        if (mCurrentDevice != null) {
            ProfileService.println(sb,
                    "==== StateMachine for " + mCurrentDevice + " ====");
            ProfileService.println(sb, "  mCurrentDevice: " + mCurrentDevice.getAddress() + "("
                    + Utils.getName(mCurrentDevice) + ") " + this.toString());
        }
        ProfileService.println(sb, "  mAudioState: " + mAudioState);
        ProfileService.println(sb, "  mAudioWbs: " + mAudioWbs);
        ProfileService.println(sb, "  mIndicatorNetworkState: " + mIndicatorNetworkState);
@@ -1000,8 +1001,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;
        }
@@ -1102,7 +1103,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);
            }
        }
@@ -1257,7 +1258,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();
        }
@@ -1682,8 +1683,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