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

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

Merge changes I306e8c61,I271da857 into tm-qpr-dev

* changes:
  More logs in HeadsetClient
  Fix logging in HeadsetClientStateMachine.
parents 53ec7ab7 6d24fc41
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -902,6 +902,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);
@@ -918,6 +920,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
@@ -200,11 +200,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);
@@ -984,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;
        }
@@ -1086,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);
            }
        }
@@ -1241,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();
        }
@@ -1666,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