Loading android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +17 −6 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ public class BluetoothInCallService extends InCallService { protected boolean mOnCreateCalled = false; private int mMaxNumberOfCalls = 0; /** * Listens to connections and disconnections of bluetooth headsets. We need to save the current * bluetooth headset so that we know where to send BluetoothCall updates. Loading Loading @@ -558,6 +560,9 @@ public class BluetoothInCallService extends InCallService { call.registerCallback(callback); mBluetoothCallHashMap.put(call.getId(), call); if (!call.isConference()) { mMaxNumberOfCalls = Integer.max(mMaxNumberOfCalls, mBluetoothCallHashMap.size()); } updateHeadsetWithCallState(false /* force */); BluetoothLeCall tbsCall = createTbsCall(call); Loading Loading @@ -688,6 +693,7 @@ public class BluetoothInCallService extends InCallService { mCallbacks.clear(); mBluetoothCallHashMap.clear(); mClccIndexMap.clear(); mMaxNumberOfCalls = 0; } private static boolean isConferenceWithNoChildren(BluetoothCall call) { Loading Loading @@ -845,15 +851,20 @@ public class BluetoothInCallService extends InCallService { if (mClccIndexMap.containsKey(key)) { return mClccIndexMap.get(key); } int i = 1; // Indexes for bluetooth clcc are 1-based. while (mClccIndexMap.containsValue(i)) { i++; int index = 1; // Indexes for bluetooth clcc are 1-based. if (call.isConference()) { index = mMaxNumberOfCalls + 1; // The conference call should have a higher index Log.i(TAG, "getIndexForCall for conference call starting from " + mMaxNumberOfCalls); } while (mClccIndexMap.containsValue(index)) { index++; } // NOTE: Indexes are removed in {@link #onCallRemoved}. mClccIndexMap.put(key, i); return i; mClccIndexMap.put(key, index); return index; } private boolean _processChld(int chld) { Loading android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -679,8 +679,6 @@ public class BluetoothInCallServiceTest { public void testListCurrentCallsImsConference() throws Exception { ArrayList<BluetoothCall> calls = new ArrayList<>(); BluetoothCall parentCall = createActiveCall(); calls.add(parentCall); mBluetoothInCallService.onCallAdded(parentCall); addCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN); when(parentCall.isConference()).thenReturn(true); Loading @@ -689,6 +687,9 @@ public class BluetoothInCallServiceTest { when(parentCall.getHandle()).thenReturn(Uri.parse("tel:555-0000")); when(mMockCallInfo.getBluetoothCalls()).thenReturn(calls); calls.add(parentCall); mBluetoothInCallService.onCallAdded(parentCall); clearInvocations(mMockBluetoothHeadset); mBluetoothInCallService.listCurrentCalls(); Loading Loading @@ -745,9 +746,7 @@ public class BluetoothInCallServiceTest { ArrayList<BluetoothCall> calls = new ArrayList<>(); BluetoothCall conferenceCall = createActiveCall(); when(conferenceCall.getHandle()).thenReturn(Uri.parse("tel:555-1234")); calls.add(conferenceCall); mBluetoothInCallService.onCallAdded(conferenceCall); addCallCapability(conferenceCall, Connection.CAPABILITY_MANAGE_CONFERENCE); when(conferenceCall.isConference()).thenReturn(true); when(conferenceCall.getState()).thenReturn(Call.STATE_ACTIVE); Loading @@ -757,6 +756,9 @@ public class BluetoothInCallServiceTest { when(conferenceCall.isIncoming()).thenReturn(true); when(mMockCallInfo.getBluetoothCalls()).thenReturn(calls); calls.add(conferenceCall); mBluetoothInCallService.onCallAdded(conferenceCall); clearInvocations(mMockBluetoothHeadset); mBluetoothInCallService.listCurrentCalls(); verify(mMockBluetoothHeadset).clccResponse( Loading Loading
android/app/src/com/android/bluetooth/telephony/BluetoothInCallService.java +17 −6 Original line number Diff line number Diff line Loading @@ -138,6 +138,8 @@ public class BluetoothInCallService extends InCallService { protected boolean mOnCreateCalled = false; private int mMaxNumberOfCalls = 0; /** * Listens to connections and disconnections of bluetooth headsets. We need to save the current * bluetooth headset so that we know where to send BluetoothCall updates. Loading Loading @@ -558,6 +560,9 @@ public class BluetoothInCallService extends InCallService { call.registerCallback(callback); mBluetoothCallHashMap.put(call.getId(), call); if (!call.isConference()) { mMaxNumberOfCalls = Integer.max(mMaxNumberOfCalls, mBluetoothCallHashMap.size()); } updateHeadsetWithCallState(false /* force */); BluetoothLeCall tbsCall = createTbsCall(call); Loading Loading @@ -688,6 +693,7 @@ public class BluetoothInCallService extends InCallService { mCallbacks.clear(); mBluetoothCallHashMap.clear(); mClccIndexMap.clear(); mMaxNumberOfCalls = 0; } private static boolean isConferenceWithNoChildren(BluetoothCall call) { Loading Loading @@ -845,15 +851,20 @@ public class BluetoothInCallService extends InCallService { if (mClccIndexMap.containsKey(key)) { return mClccIndexMap.get(key); } int i = 1; // Indexes for bluetooth clcc are 1-based. while (mClccIndexMap.containsValue(i)) { i++; int index = 1; // Indexes for bluetooth clcc are 1-based. if (call.isConference()) { index = mMaxNumberOfCalls + 1; // The conference call should have a higher index Log.i(TAG, "getIndexForCall for conference call starting from " + mMaxNumberOfCalls); } while (mClccIndexMap.containsValue(index)) { index++; } // NOTE: Indexes are removed in {@link #onCallRemoved}. mClccIndexMap.put(key, i); return i; mClccIndexMap.put(key, index); return index; } private boolean _processChld(int chld) { Loading
android/app/tests/unit/src/com/android/bluetooth/telephony/BluetoothInCallServiceTest.java +6 −4 Original line number Diff line number Diff line Loading @@ -679,8 +679,6 @@ public class BluetoothInCallServiceTest { public void testListCurrentCallsImsConference() throws Exception { ArrayList<BluetoothCall> calls = new ArrayList<>(); BluetoothCall parentCall = createActiveCall(); calls.add(parentCall); mBluetoothInCallService.onCallAdded(parentCall); addCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN); when(parentCall.isConference()).thenReturn(true); Loading @@ -689,6 +687,9 @@ public class BluetoothInCallServiceTest { when(parentCall.getHandle()).thenReturn(Uri.parse("tel:555-0000")); when(mMockCallInfo.getBluetoothCalls()).thenReturn(calls); calls.add(parentCall); mBluetoothInCallService.onCallAdded(parentCall); clearInvocations(mMockBluetoothHeadset); mBluetoothInCallService.listCurrentCalls(); Loading Loading @@ -745,9 +746,7 @@ public class BluetoothInCallServiceTest { ArrayList<BluetoothCall> calls = new ArrayList<>(); BluetoothCall conferenceCall = createActiveCall(); when(conferenceCall.getHandle()).thenReturn(Uri.parse("tel:555-1234")); calls.add(conferenceCall); mBluetoothInCallService.onCallAdded(conferenceCall); addCallCapability(conferenceCall, Connection.CAPABILITY_MANAGE_CONFERENCE); when(conferenceCall.isConference()).thenReturn(true); when(conferenceCall.getState()).thenReturn(Call.STATE_ACTIVE); Loading @@ -757,6 +756,9 @@ public class BluetoothInCallServiceTest { when(conferenceCall.isIncoming()).thenReturn(true); when(mMockCallInfo.getBluetoothCalls()).thenReturn(calls); calls.add(conferenceCall); mBluetoothInCallService.onCallAdded(conferenceCall); clearInvocations(mMockBluetoothHeadset); mBluetoothInCallService.listCurrentCalls(); verify(mMockBluetoothHeadset).clccResponse( Loading