Loading src/com/android/server/telecom/CallAudioRouteStateMachine.java +15 −7 Original line number Diff line number Diff line Loading @@ -413,6 +413,8 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case SWITCH_SPEAKER: case USER_SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -534,6 +536,7 @@ public class CallAudioRouteStateMachine extends StateMachine { // This may be sent as a confirmation by the BT stack after switch off BT. return HANDLED; case CONNECT_DOCK: setSpeakerphoneOn(true); sendInternalMessage(SWITCH_SPEAKER); return HANDLED; case DISCONNECT_DOCK: Loading Loading @@ -612,6 +615,8 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case SWITCH_SPEAKER: case USER_SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -727,6 +732,7 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case DISCONNECT_WIRED_HEADSET: if (mWasOnSpeaker) { setSpeakerphoneOn(true); sendInternalMessage(SWITCH_SPEAKER); } else { sendInternalMessage(SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE); Loading Loading @@ -798,6 +804,7 @@ public class CallAudioRouteStateMachine extends StateMachine { transitionTo(mActiveHeadsetRoute); break; case SWITCH_SPEAKER: setSpeakerphoneOn(true); transitionTo(mActiveSpeakerRoute); break; default: Loading Loading @@ -854,6 +861,8 @@ public class CallAudioRouteStateMachine extends StateMachine { mHasUserExplicitlyLeftBluetooth = true; // fall through case SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: setBluetoothOff(); transitionTo(mActiveSpeakerRoute); Loading Loading @@ -949,6 +958,8 @@ public class CallAudioRouteStateMachine extends StateMachine { mHasUserExplicitlyLeftBluetooth = true; // fall through case SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -1108,8 +1119,9 @@ public class CallAudioRouteStateMachine extends StateMachine { @Override public void enter() { super.enter(); // Don't set speakerphone on here -- we might end up in this state by following // the speaker state that some other app commanded. mWasOnSpeaker = true; setSpeakerphoneOn(true); CallAudioState newState = new CallAudioState(mIsMuted, ROUTE_SPEAKER, mAvailableRoutes, null, mBluetoothRouteManager.getConnectedDevices()); setSystemAudioState(newState, true); Loading Loading @@ -1596,12 +1608,8 @@ public class CallAudioRouteStateMachine extends StateMachine { } private void setSpeakerphoneOn(boolean on) { if (mAudioManager.isSpeakerphoneOn() != on) { Log.i(this, "turning speaker phone %s", on); mAudioManager.setSpeakerphoneOn(on); } else { Log.i(this, "Ignoring speakerphone request -- already %s", on); } mStatusBarNotifier.notifySpeakerphone(on); } Loading tests/src/com/android/server/telecom/tests/CallAudioRouteTransitionTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -815,7 +815,7 @@ public class CallAudioRouteTransitionTests extends TelecomTestCase { "Speakerphone turned off externally during speaker", // name CallAudioState.ROUTE_SPEAKER, // initialRoute CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH, // availableRoutes NONE, // speakerInteraction OFF, // speakerInteraction ON, // bluetoothInteraction CallAudioRouteStateMachine.SPEAKER_OFF, // action CallAudioState.ROUTE_BLUETOOTH, // expectedRoute Loading Loading
src/com/android/server/telecom/CallAudioRouteStateMachine.java +15 −7 Original line number Diff line number Diff line Loading @@ -413,6 +413,8 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case SWITCH_SPEAKER: case USER_SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -534,6 +536,7 @@ public class CallAudioRouteStateMachine extends StateMachine { // This may be sent as a confirmation by the BT stack after switch off BT. return HANDLED; case CONNECT_DOCK: setSpeakerphoneOn(true); sendInternalMessage(SWITCH_SPEAKER); return HANDLED; case DISCONNECT_DOCK: Loading Loading @@ -612,6 +615,8 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case SWITCH_SPEAKER: case USER_SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -727,6 +732,7 @@ public class CallAudioRouteStateMachine extends StateMachine { return HANDLED; case DISCONNECT_WIRED_HEADSET: if (mWasOnSpeaker) { setSpeakerphoneOn(true); sendInternalMessage(SWITCH_SPEAKER); } else { sendInternalMessage(SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE); Loading Loading @@ -798,6 +804,7 @@ public class CallAudioRouteStateMachine extends StateMachine { transitionTo(mActiveHeadsetRoute); break; case SWITCH_SPEAKER: setSpeakerphoneOn(true); transitionTo(mActiveSpeakerRoute); break; default: Loading Loading @@ -854,6 +861,8 @@ public class CallAudioRouteStateMachine extends StateMachine { mHasUserExplicitlyLeftBluetooth = true; // fall through case SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: setBluetoothOff(); transitionTo(mActiveSpeakerRoute); Loading Loading @@ -949,6 +958,8 @@ public class CallAudioRouteStateMachine extends StateMachine { mHasUserExplicitlyLeftBluetooth = true; // fall through case SWITCH_SPEAKER: setSpeakerphoneOn(true); // fall through case SPEAKER_ON: transitionTo(mActiveSpeakerRoute); return HANDLED; Loading Loading @@ -1108,8 +1119,9 @@ public class CallAudioRouteStateMachine extends StateMachine { @Override public void enter() { super.enter(); // Don't set speakerphone on here -- we might end up in this state by following // the speaker state that some other app commanded. mWasOnSpeaker = true; setSpeakerphoneOn(true); CallAudioState newState = new CallAudioState(mIsMuted, ROUTE_SPEAKER, mAvailableRoutes, null, mBluetoothRouteManager.getConnectedDevices()); setSystemAudioState(newState, true); Loading Loading @@ -1596,12 +1608,8 @@ public class CallAudioRouteStateMachine extends StateMachine { } private void setSpeakerphoneOn(boolean on) { if (mAudioManager.isSpeakerphoneOn() != on) { Log.i(this, "turning speaker phone %s", on); mAudioManager.setSpeakerphoneOn(on); } else { Log.i(this, "Ignoring speakerphone request -- already %s", on); } mStatusBarNotifier.notifySpeakerphone(on); } Loading
tests/src/com/android/server/telecom/tests/CallAudioRouteTransitionTests.java +1 −1 Original line number Diff line number Diff line Loading @@ -815,7 +815,7 @@ public class CallAudioRouteTransitionTests extends TelecomTestCase { "Speakerphone turned off externally during speaker", // name CallAudioState.ROUTE_SPEAKER, // initialRoute CallAudioState.ROUTE_EARPIECE | CallAudioState.ROUTE_BLUETOOTH, // availableRoutes NONE, // speakerInteraction OFF, // speakerInteraction ON, // bluetoothInteraction CallAudioRouteStateMachine.SPEAKER_OFF, // action CallAudioState.ROUTE_BLUETOOTH, // expectedRoute Loading