Loading src/com/android/server/telecom/BluetoothPhoneServiceImpl.java +12 −7 Original line number Diff line number Diff line Loading @@ -78,12 +78,15 @@ public class BluetoothPhoneServiceImpl { // Add all held calls to a conference private static final int CHLD_TYPE_ADDHELDTOCONF = 3; // Indicates that no call is ringing private static final int DEFAULT_RINGING_ADDRESS_TYPE = 128; private int mNumActiveCalls = 0; private int mNumHeldCalls = 0; private int mNumChildrenOfActiveCall = 0; private int mBluetoothCallState = CALL_STATE_IDLE; private String mRingingAddress = null; private int mRingingAddressType = 0; private String mRingingAddress = ""; private int mRingingAddressType = DEFAULT_RINGING_ADDRESS_TYPE; private Call mOldHeldCall = null; private boolean mIsDisconnectedTonePlaying = false; Loading @@ -101,7 +104,7 @@ public class BluetoothPhoneServiceImpl { long token = Binder.clearCallingIdentity(); try { Log.i(TAG, "BT - answering call"); Call call = mCallsManager.getRingingCall(); Call call = mCallsManager.getRingingOrSimulatedRingingCall(); if (call != null) { mCallsManager.answerCall(call, VideoProfile.STATE_AUDIO_ONLY); return true; Loading Loading @@ -493,7 +496,7 @@ public class BluetoothPhoneServiceImpl { private boolean processChld(int chld) { Call activeCall = mCallsManager.getActiveCall(); Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call heldCall = mCallsManager.getHeldCall(); // TODO: Keeping as Log.i for now. Move to Log.d after L release if BT proves stable. Loading Loading @@ -699,13 +702,13 @@ public class BluetoothPhoneServiceImpl { */ private void updateHeadsetWithCallState(boolean force) { Call activeCall = mCallsManager.getActiveCall(); Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call heldCall = mCallsManager.getHeldCall(); int bluetoothCallState = getBluetoothCallStateForUpdate(); String ringingAddress = null; int ringingAddressType = 128; int ringingAddressType = DEFAULT_RINGING_ADDRESS_TYPE; String ringingName = null; if (ringingCall != null && ringingCall.getHandle() != null && !ringingCall.isSilentRingingRequested()) { Loading Loading @@ -832,7 +835,7 @@ public class BluetoothPhoneServiceImpl { } private int getBluetoothCallStateForUpdate() { Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call dialingCall = mCallsManager.getOutgoingCall(); boolean hasOnlyDisconnectedCalls = mCallsManager.hasOnlyDisconnectedCalls(); Loading Loading @@ -862,6 +865,7 @@ public class BluetoothPhoneServiceImpl { case CallState.NEW: case CallState.ABORTED: case CallState.DISCONNECTED: case CallState.AUDIO_PROCESSING: return CALL_STATE_IDLE; case CallState.ACTIVE: Loading @@ -885,6 +889,7 @@ public class BluetoothPhoneServiceImpl { case CallState.RINGING: case CallState.ANSWERED: case CallState.SIMULATED_RINGING: if (call.isSilentRingingRequested()) { return CALL_STATE_IDLE; } else if (isForeground) { Loading src/com/android/server/telecom/CallAudioManager.java +9 −6 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class CallAudioManager extends CallsManagerListenerBase { if (newBinForCall != null) { newBinForCall.add(call); } sendCallStatusToBluetoothStateReceiver(); updateForegroundCall(); if (shouldPlayDisconnectTone(oldState, newState)) { Loading Loading @@ -158,9 +159,7 @@ public class CallAudioManager extends CallsManagerListenerBase { } updateForegroundCall(); mCalls.add(call); if (mCalls.size() == 1) { mBluetoothStateReceiver.setIsInCall(true); } sendCallStatusToBluetoothStateReceiver(); onCallEnteringState(call, call.getState()); } Loading @@ -177,13 +176,17 @@ public class CallAudioManager extends CallsManagerListenerBase { updateForegroundCall(); mCalls.remove(call); if (mCalls.size() == 0) { mBluetoothStateReceiver.setIsInCall(false); } sendCallStatusToBluetoothStateReceiver(); onCallLeavingState(call, call.getState()); } private void sendCallStatusToBluetoothStateReceiver() { // We're in a call if there are calls in mCalls that are not in mAudioProcessingCalls. boolean isInCall = !mAudioProcessingCalls.containsAll(mCalls); mBluetoothStateReceiver.setIsInCall(isInCall); } /** * Handles changes to the external state of a call. External calls which become regular calls * should be tracked, and regular calls which become external should no longer be tracked. Loading src/com/android/server/telecom/CallAudioModeStateMachine.java +2 −4 Original line number Diff line number Diff line Loading @@ -329,8 +329,7 @@ public class CallAudioModeStateMachine extends StateMachine { transitionTo(mOtherFocusState); return HANDLED; case NEW_AUDIO_PROCESSING_CALL: Log.w(LOG_TAG, "Unexpected behavior! New audio processing call appeared while" + " in audio processing state."); // Can happen as a duplicate message return HANDLED; case TONE_STARTED_PLAYING: // This shouldn't happen either, but perform the action anyway. Loading Loading @@ -404,8 +403,7 @@ public class CallAudioModeStateMachine extends StateMachine { + "ringing"); } case NEW_RINGING_CALL: Log.w(LOG_TAG, "Unexpected behavior! New ringing call appeared while in " + "ringing state."); // Can happen as a duplicate message return HANDLED; case NEW_HOLDING_CALL: // This really shouldn't happen, but transition to the focused state anyway. Loading src/com/android/server/telecom/CallsManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -2741,6 +2741,11 @@ public class CallsManager extends Call.ListenerBase return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED) != null; } boolean hasRingingOrSimulatedRingingCall() { return getFirstCallWithState( CallState.SIMULATED_RINGING, CallState.RINGING, CallState.ANSWERED) != null; } @VisibleForTesting public boolean onMediaButton(int type) { if (hasAnyCalls()) { Loading Loading @@ -2843,8 +2848,9 @@ public class CallsManager extends Call.ListenerBase } @VisibleForTesting public Call getRingingCall() { return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED); public Call getRingingOrSimulatedRingingCall() { return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED, CallState.SIMULATED_RINGING); } public Call getActiveCall() { Loading src/com/android/server/telecom/InCallWakeLockController.java +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class InCallWakeLockController extends CallsManagerListenerBase { private void handleWakeLock() { // We grab a full lock as long as there exists a ringing call. Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); if (ringingCall != null) { mTelecomWakeLock.acquire(); Log.i(this, "Acquiring full wake lock"); Loading Loading
src/com/android/server/telecom/BluetoothPhoneServiceImpl.java +12 −7 Original line number Diff line number Diff line Loading @@ -78,12 +78,15 @@ public class BluetoothPhoneServiceImpl { // Add all held calls to a conference private static final int CHLD_TYPE_ADDHELDTOCONF = 3; // Indicates that no call is ringing private static final int DEFAULT_RINGING_ADDRESS_TYPE = 128; private int mNumActiveCalls = 0; private int mNumHeldCalls = 0; private int mNumChildrenOfActiveCall = 0; private int mBluetoothCallState = CALL_STATE_IDLE; private String mRingingAddress = null; private int mRingingAddressType = 0; private String mRingingAddress = ""; private int mRingingAddressType = DEFAULT_RINGING_ADDRESS_TYPE; private Call mOldHeldCall = null; private boolean mIsDisconnectedTonePlaying = false; Loading @@ -101,7 +104,7 @@ public class BluetoothPhoneServiceImpl { long token = Binder.clearCallingIdentity(); try { Log.i(TAG, "BT - answering call"); Call call = mCallsManager.getRingingCall(); Call call = mCallsManager.getRingingOrSimulatedRingingCall(); if (call != null) { mCallsManager.answerCall(call, VideoProfile.STATE_AUDIO_ONLY); return true; Loading Loading @@ -493,7 +496,7 @@ public class BluetoothPhoneServiceImpl { private boolean processChld(int chld) { Call activeCall = mCallsManager.getActiveCall(); Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call heldCall = mCallsManager.getHeldCall(); // TODO: Keeping as Log.i for now. Move to Log.d after L release if BT proves stable. Loading Loading @@ -699,13 +702,13 @@ public class BluetoothPhoneServiceImpl { */ private void updateHeadsetWithCallState(boolean force) { Call activeCall = mCallsManager.getActiveCall(); Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call heldCall = mCallsManager.getHeldCall(); int bluetoothCallState = getBluetoothCallStateForUpdate(); String ringingAddress = null; int ringingAddressType = 128; int ringingAddressType = DEFAULT_RINGING_ADDRESS_TYPE; String ringingName = null; if (ringingCall != null && ringingCall.getHandle() != null && !ringingCall.isSilentRingingRequested()) { Loading Loading @@ -832,7 +835,7 @@ public class BluetoothPhoneServiceImpl { } private int getBluetoothCallStateForUpdate() { Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); Call dialingCall = mCallsManager.getOutgoingCall(); boolean hasOnlyDisconnectedCalls = mCallsManager.hasOnlyDisconnectedCalls(); Loading Loading @@ -862,6 +865,7 @@ public class BluetoothPhoneServiceImpl { case CallState.NEW: case CallState.ABORTED: case CallState.DISCONNECTED: case CallState.AUDIO_PROCESSING: return CALL_STATE_IDLE; case CallState.ACTIVE: Loading @@ -885,6 +889,7 @@ public class BluetoothPhoneServiceImpl { case CallState.RINGING: case CallState.ANSWERED: case CallState.SIMULATED_RINGING: if (call.isSilentRingingRequested()) { return CALL_STATE_IDLE; } else if (isForeground) { Loading
src/com/android/server/telecom/CallAudioManager.java +9 −6 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ public class CallAudioManager extends CallsManagerListenerBase { if (newBinForCall != null) { newBinForCall.add(call); } sendCallStatusToBluetoothStateReceiver(); updateForegroundCall(); if (shouldPlayDisconnectTone(oldState, newState)) { Loading Loading @@ -158,9 +159,7 @@ public class CallAudioManager extends CallsManagerListenerBase { } updateForegroundCall(); mCalls.add(call); if (mCalls.size() == 1) { mBluetoothStateReceiver.setIsInCall(true); } sendCallStatusToBluetoothStateReceiver(); onCallEnteringState(call, call.getState()); } Loading @@ -177,13 +176,17 @@ public class CallAudioManager extends CallsManagerListenerBase { updateForegroundCall(); mCalls.remove(call); if (mCalls.size() == 0) { mBluetoothStateReceiver.setIsInCall(false); } sendCallStatusToBluetoothStateReceiver(); onCallLeavingState(call, call.getState()); } private void sendCallStatusToBluetoothStateReceiver() { // We're in a call if there are calls in mCalls that are not in mAudioProcessingCalls. boolean isInCall = !mAudioProcessingCalls.containsAll(mCalls); mBluetoothStateReceiver.setIsInCall(isInCall); } /** * Handles changes to the external state of a call. External calls which become regular calls * should be tracked, and regular calls which become external should no longer be tracked. Loading
src/com/android/server/telecom/CallAudioModeStateMachine.java +2 −4 Original line number Diff line number Diff line Loading @@ -329,8 +329,7 @@ public class CallAudioModeStateMachine extends StateMachine { transitionTo(mOtherFocusState); return HANDLED; case NEW_AUDIO_PROCESSING_CALL: Log.w(LOG_TAG, "Unexpected behavior! New audio processing call appeared while" + " in audio processing state."); // Can happen as a duplicate message return HANDLED; case TONE_STARTED_PLAYING: // This shouldn't happen either, but perform the action anyway. Loading Loading @@ -404,8 +403,7 @@ public class CallAudioModeStateMachine extends StateMachine { + "ringing"); } case NEW_RINGING_CALL: Log.w(LOG_TAG, "Unexpected behavior! New ringing call appeared while in " + "ringing state."); // Can happen as a duplicate message return HANDLED; case NEW_HOLDING_CALL: // This really shouldn't happen, but transition to the focused state anyway. Loading
src/com/android/server/telecom/CallsManager.java +8 −2 Original line number Diff line number Diff line Loading @@ -2741,6 +2741,11 @@ public class CallsManager extends Call.ListenerBase return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED) != null; } boolean hasRingingOrSimulatedRingingCall() { return getFirstCallWithState( CallState.SIMULATED_RINGING, CallState.RINGING, CallState.ANSWERED) != null; } @VisibleForTesting public boolean onMediaButton(int type) { if (hasAnyCalls()) { Loading Loading @@ -2843,8 +2848,9 @@ public class CallsManager extends Call.ListenerBase } @VisibleForTesting public Call getRingingCall() { return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED); public Call getRingingOrSimulatedRingingCall() { return getFirstCallWithState(CallState.RINGING, CallState.ANSWERED, CallState.SIMULATED_RINGING); } public Call getActiveCall() { Loading
src/com/android/server/telecom/InCallWakeLockController.java +1 −1 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class InCallWakeLockController extends CallsManagerListenerBase { private void handleWakeLock() { // We grab a full lock as long as there exists a ringing call. Call ringingCall = mCallsManager.getRingingCall(); Call ringingCall = mCallsManager.getRingingOrSimulatedRingingCall(); if (ringingCall != null) { mTelecomWakeLock.acquire(); Log.i(this, "Acquiring full wake lock"); Loading