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

Commit 65a8c78b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Removing Telecom hidden API usage" am: 12c022f2

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/1733893

Change-Id: I9e7ede8ccab17e409973cc5dabda4b650fe0a95f
parents 0372040d 12c022f2
Loading
Loading
Loading
Loading
+17 −27
Original line number Original line Diff line number Diff line
@@ -150,22 +150,6 @@ public class BluetoothCall {
        mCall.stopRtt();
        mCall.stopRtt();
    }
    }


    public void putExtras(Bundle extras) {
        mCall.putExtras(extras);
    }

    public void putExtra(String key, boolean value) {
        mCall.putExtra(key, value);
    }

    public void putExtra(String key, int value) {
        mCall.putExtra(key, value);
    }

    public void putExtra(String key, String value) {
        mCall.putExtra(key, value);
    }

    public void removeExtras(List<String> keys) {
    public void removeExtras(List<String> keys) {
        mCall.removeExtras(keys);
        mCall.removeExtras(keys);
    }
    }
@@ -174,19 +158,22 @@ public class BluetoothCall {
        mCall.removeExtras(keys);
        mCall.removeExtras(keys);
    }
    }


    public String getParentId() {
    /**
     * Returns the parent Call id.
     */
    public Integer getParentId() {
        Call parent = mCall.getParent();
        Call parent = mCall.getParent();
        if (parent != null) {
        if (parent != null) {
            return parent.getDetails().getTelecomCallId();
            return System.identityHashCode(parent);
        }
        }
        return null;
        return null;
    }
    }


    public List<String> getChildrenIds() {
    public List<Integer> getChildrenIds() {
        return getIds(mCall.getChildren());
        return getIds(mCall.getChildren());
    }
    }


    public List<String> getConferenceableCalls() {
    public List<Integer> getConferenceableCalls() {
        return getIds(mCall.getConferenceableCalls());
        return getIds(mCall.getConferenceableCalls());
    }
    }


@@ -239,8 +226,8 @@ public class BluetoothCall {
        mCall.removeListener(listener);
        mCall.removeListener(listener);
    }
    }


    public String getGenericConferenceActiveChildCallId() {
    public int getGenericConferenceActiveChildCallId() {
        return mCall.getGenericConferenceActiveChildCall().getDetails().getTelecomCallId();
        return System.identityHashCode(mCall.getGenericConferenceActiveChildCall());
    }
    }


    public String getContactDisplayName() {
    public String getContactDisplayName() {
@@ -297,8 +284,8 @@ public class BluetoothCall {
        return getDetails().hasProperty(Call.Details.PROPERTY_IS_EXTERNAL_CALL);
        return getDetails().hasProperty(Call.Details.PROPERTY_IS_EXTERNAL_CALL);
    }
    }


    public String getTelecomCallId() {
    public int getId() {
        return getDetails().getTelecomCallId();
        return System.identityHashCode(mCall);
    }
    }


    public boolean wasConferencePreviouslyMerged() {
    public boolean wasConferencePreviouslyMerged() {
@@ -306,11 +293,14 @@ public class BluetoothCall {
                !can(Call.Details.CAPABILITY_MERGE_CONFERENCE);
                !can(Call.Details.CAPABILITY_MERGE_CONFERENCE);
    }
    }


    public static List<String> getIds(List<Call> calls) {
    /**
        List<String> result = new ArrayList<>();
     * Returns the list of ids of corresponding Call List.
     */
    public static List<Integer> getIds(List<Call> calls) {
        List<Integer> result = new ArrayList<>();
        for (Call call : calls) {
        for (Call call : calls) {
            if (call != null) {
            if (call != null) {
                result.add(call.getDetails().getTelecomCallId());
                result.add(System.identityHashCode(call));
            }
            }
        }
        }
        return result;
        return result;
+20 −21
Original line number Original line Diff line number Diff line
@@ -43,11 +43,10 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.Log;
import android.util.Log;


import com.android.bluetooth.hfp.BluetoothHeadsetProxy;
import com.android.bluetooth.hfp.HeadsetService;

import androidx.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;


import com.android.bluetooth.hfp.BluetoothHeadsetProxy;

import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashMap;
@@ -108,10 +107,10 @@ public class BluetoothInCallService extends InCallService {
    public TelecomManager mTelecomManager;
    public TelecomManager mTelecomManager;


    @VisibleForTesting
    @VisibleForTesting
    public final HashMap<String, CallStateCallback> mCallbacks = new HashMap<>();
    public final HashMap<Integer, CallStateCallback> mCallbacks = new HashMap<>();


    @VisibleForTesting
    @VisibleForTesting
    public final HashMap<String, BluetoothCall> mBluetoothCallHashMap = new HashMap<>();
    public final HashMap<Integer, BluetoothCall> mBluetoothCallHashMap = new HashMap<>();


    // A map from Calls to indexes used to identify calls for CLCC (C* List Current Calls).
    // A map from Calls to indexes used to identify calls for CLCC (C* List Current Calls).
    private final Map<BluetoothCall, Integer> mClccIndexMap = new HashMap<>();
    private final Map<BluetoothCall, Integer> mClccIndexMap = new HashMap<>();
@@ -220,7 +219,7 @@ public class BluetoothInCallService extends InCallService {
        @Override
        @Override
        public void onStateChanged(Call call, int state) {
        public void onStateChanged(Call call, int state) {
            super.onStateChanged(call, state);
            super.onStateChanged(call, state);
            onStateChanged(getBluetoothCallById(call.getDetails().getTelecomCallId()), state);
            onStateChanged(getBluetoothCallById(System.identityHashCode(call)), state);
        }
        }


        public void onDetailsChanged(BluetoothCall call, Call.Details details) {
        public void onDetailsChanged(BluetoothCall call, Call.Details details) {
@@ -237,7 +236,7 @@ public class BluetoothInCallService extends InCallService {
        @Override
        @Override
        public void onDetailsChanged(Call call, Call.Details details) {
        public void onDetailsChanged(Call call, Call.Details details) {
            super.onDetailsChanged(call, details);
            super.onDetailsChanged(call, details);
            onDetailsChanged(getBluetoothCallById(call.getDetails().getTelecomCallId()), details);
            onDetailsChanged(getBluetoothCallById(System.identityHashCode(call)), details);
        }
        }


        public void onParentChanged(BluetoothCall call) {
        public void onParentChanged(BluetoothCall call) {
@@ -258,7 +257,7 @@ public class BluetoothInCallService extends InCallService {
        public void onParentChanged(Call call, Call parent) {
        public void onParentChanged(Call call, Call parent) {
            super.onParentChanged(call, parent);
            super.onParentChanged(call, parent);
            onParentChanged(
            onParentChanged(
                    getBluetoothCallById(call.getDetails().getTelecomCallId()));
                    getBluetoothCallById(System.identityHashCode(call)));
        }
        }


        public void onChildrenChanged(BluetoothCall call, List<BluetoothCall> children) {
        public void onChildrenChanged(BluetoothCall call, List<BluetoothCall> children) {
@@ -281,7 +280,7 @@ public class BluetoothInCallService extends InCallService {
        public void onChildrenChanged(Call call, List<Call> children) {
        public void onChildrenChanged(Call call, List<Call> children) {
            super.onChildrenChanged(call, children);
            super.onChildrenChanged(call, children);
            onChildrenChanged(
            onChildrenChanged(
                    getBluetoothCallById(call.getDetails().getTelecomCallId()),
                    getBluetoothCallById(System.identityHashCode(call)),
                    getBluetoothCallsByIds(BluetoothCall.getIds(children)));
                    getBluetoothCallsByIds(BluetoothCall.getIds(children)));
        }
        }
    }
    }
@@ -452,13 +451,13 @@ public class BluetoothInCallService extends InCallService {
        if (call.isExternalCall()) {
        if (call.isExternalCall()) {
            return;
            return;
        }
        }
        if (!mBluetoothCallHashMap.containsKey(call.getTelecomCallId())) {
        if (!mBluetoothCallHashMap.containsKey(call.getId())) {
            Log.d(TAG, "onCallAdded");
            Log.d(TAG, "onCallAdded");
            CallStateCallback callback = new CallStateCallback(call.getState());
            CallStateCallback callback = new CallStateCallback(call.getState());
            mCallbacks.put(call.getTelecomCallId(), callback);
            mCallbacks.put(call.getId(), callback);
            call.registerCallback(callback);
            call.registerCallback(callback);


            mBluetoothCallHashMap.put(call.getTelecomCallId(), call);
            mBluetoothCallHashMap.put(call.getId(), call);
            updateHeadsetWithCallState(false /* force */);
            updateHeadsetWithCallState(false /* force */);
        }
        }
    }
    }
@@ -507,8 +506,8 @@ public class BluetoothInCallService extends InCallService {
            call.unregisterCallback(callback);
            call.unregisterCallback(callback);
        }
        }


        if (mBluetoothCallHashMap.containsKey(call.getTelecomCallId())) {
        if (mBluetoothCallHashMap.containsKey(call.getId())) {
            mBluetoothCallHashMap.remove(call.getTelecomCallId());
            mBluetoothCallHashMap.remove(call.getId());
        }
        }


        mClccIndexMap.remove(call);
        mClccIndexMap.remove(call);
@@ -518,7 +517,7 @@ public class BluetoothInCallService extends InCallService {
    @Override
    @Override
    public void onCallRemoved(Call call) {
    public void onCallRemoved(Call call) {
        super.onCallRemoved(call);
        super.onCallRemoved(call);
        BluetoothCall bluetoothCall = getBluetoothCallById(call.getDetails().getTelecomCallId());
        BluetoothCall bluetoothCall = getBluetoothCallById(System.identityHashCode(call));
        if (bluetoothCall == null) {
        if (bluetoothCall == null) {
            Log.w(TAG, "onCallRemoved, BluetoothCall is removed before registered");
            Log.w(TAG, "onCallRemoved, BluetoothCall is removed before registered");
            return;
            return;
@@ -833,11 +832,11 @@ public class BluetoothInCallService extends InCallService {
                numHeldCalls = 1;  // Merge is available, so expose via numHeldCalls.
                numHeldCalls = 1;  // Merge is available, so expose via numHeldCalls.
            }
            }


            for (String id : activeCall.getChildrenIds()) {
            for (int id : activeCall.getChildrenIds()) {
                // Held BluetoothCall has changed due to it being combined into a CDMA conference.
                // Held BluetoothCall has changed due to it being combined into a CDMA conference.
                // Keep track of this and ignore any future update since it doesn't really count
                // Keep track of this and ignore any future update since it doesn't really count
                // as a BluetoothCall change.
                // as a BluetoothCall change.
                if (mOldHeldCall != null && mOldHeldCall.getTelecomCallId() == id) {
                if (mOldHeldCall != null && mOldHeldCall.getId() == id) {
                    ignoreHeldCallChange = true;
                    ignoreHeldCallChange = true;
                    break;
                    break;
                }
                }
@@ -970,7 +969,7 @@ public class BluetoothInCallService extends InCallService {


    @VisibleForTesting
    @VisibleForTesting
    public CallStateCallback getCallback(BluetoothCall call) {
    public CallStateCallback getCallback(BluetoothCall call) {
        return mCallbacks.get(call.getTelecomCallId());
        return mCallbacks.get(call.getId());
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -979,7 +978,7 @@ public class BluetoothInCallService extends InCallService {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    public BluetoothCall getBluetoothCallById(String id) {
    public BluetoothCall getBluetoothCallById(int id) {
        if (mBluetoothCallHashMap.containsKey(id)) {
        if (mBluetoothCallHashMap.containsKey(id)) {
            return mBluetoothCallHashMap.get(id);
            return mBluetoothCallHashMap.get(id);
        }
        }
@@ -987,9 +986,9 @@ public class BluetoothInCallService extends InCallService {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    public List<BluetoothCall> getBluetoothCallsByIds(List<String> ids) {
    public List<BluetoothCall> getBluetoothCallsByIds(List<Integer> ids) {
        List<BluetoothCall> calls = new ArrayList<>();
        List<BluetoothCall> calls = new ArrayList<>();
        for (String id : ids) {
        for (int id : ids) {
            BluetoothCall call = getBluetoothCallById(id);
            BluetoothCall call = getBluetoothCallById(id);
            if (!mCallInfo.isNullCall(call)) {
            if (!mCallInfo.isNullCall(call)) {
                calls.add(call);
                calls.add(call);
+38 −39
Original line number Original line Diff line number Diff line
@@ -16,21 +16,11 @@


package com.android.bluetooth.telephony;
package com.android.bluetooth.telephony;


import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import static org.mockito.Mockito.*;


import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter;
import android.net.Uri;
import android.net.Uri;
@@ -47,12 +37,21 @@ import android.telephony.TelephonyManager;
import android.util.Log;
import android.util.Log;


import androidx.test.core.app.ApplicationProvider;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.rule.ServiceTestRule;
import androidx.test.filters.MediumTest;
import androidx.test.filters.MediumTest;
import androidx.test.rule.ServiceTestRule;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.runner.AndroidJUnit4;


import com.android.bluetooth.hfp.BluetoothHeadsetProxy;
import com.android.bluetooth.hfp.BluetoothHeadsetProxy;


import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.ArrayList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Arrays;
import java.util.List;
import java.util.List;
@@ -308,15 +307,15 @@ public class BluetoothInCallServiceTest {
        addCallCapability(parentCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_SWAP_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_SWAP_CONFERENCE);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        String confCall1Id = confCall1.getTelecomCallId();
        int confCall1Id = confCall1.getId();
        when(parentCall.getGenericConferenceActiveChildCallId())
        when(parentCall.getGenericConferenceActiveChildCallId())
                .thenReturn(confCall1Id);
                .thenReturn(confCall1Id);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
        List<String> childrenIds = Arrays.asList(confCall1.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(confCall1.getId(),
                confCall2.getTelecomCallId());
                confCall2.getId());
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        //Add links from child calls to parent
        //Add links from child calls to parent
        String parentId = parentCall.getTelecomCallId();
        int parentId = parentCall.getId();
        when(confCall1.getParentId()).thenReturn(parentId);
        when(confCall1.getParentId()).thenReturn(parentId);
        when(confCall2.getParentId()).thenReturn(parentId);
        when(confCall2.getParentId()).thenReturn(parentId);


@@ -370,14 +369,14 @@ public class BluetoothInCallServiceTest {
        addCallCapability(parentCall, Connection.CAPABILITY_SWAP_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_SWAP_CONFERENCE);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);


        String foregroundCallId = foregroundCall.getTelecomCallId();
        int foregroundCallId = foregroundCall.getId();
        when(parentCall.getGenericConferenceActiveChildCallId()).thenReturn(foregroundCallId);
        when(parentCall.getGenericConferenceActiveChildCallId()).thenReturn(foregroundCallId);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
        List<String> childrenIds = Arrays.asList(foregroundCall.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(foregroundCall.getId(),
                heldCall.getTelecomCallId());
                heldCall.getId());
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        //Add links from child calls to parent
        //Add links from child calls to parent
        String parentId = parentCall.getTelecomCallId();
        int parentId = parentCall.getId();
        when(foregroundCall.getParentId()).thenReturn(parentId);
        when(foregroundCall.getParentId()).thenReturn(parentId);
        when(heldCall.getParentId()).thenReturn(parentId);
        when(heldCall.getParentId()).thenReturn(parentId);


@@ -419,11 +418,11 @@ public class BluetoothInCallServiceTest {
        when(parentCall.wasConferencePreviouslyMerged()).thenReturn(true);
        when(parentCall.wasConferencePreviouslyMerged()).thenReturn(true);
        //when(parentCall.getConferenceLevelActiveCall()).thenReturn(confCall1);
        //when(parentCall.getConferenceLevelActiveCall()).thenReturn(confCall1);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
        List<String> childrenIds = Arrays.asList(confCall1.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(confCall1.getId(),
            confCall2.getTelecomCallId());
                confCall2.getId());
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        //Add links from child calls to parent
        //Add links from child calls to parent
        String parentId = parentCall.getTelecomCallId();
        int parentId = parentCall.getId();
        when(confCall1.getParentId()).thenReturn(parentId);
        when(confCall1.getParentId()).thenReturn(parentId);
        when(confCall2.getParentId()).thenReturn(parentId);
        when(confCall2.getParentId()).thenReturn(parentId);


@@ -635,7 +634,7 @@ public class BluetoothInCallServiceTest {
        mBluetoothInCallService.onCallAdded(childCall2);
        mBluetoothInCallService.onCallAdded(childCall2);


        addCallCapability(parentCall, Connection.CAPABILITY_MANAGE_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_MANAGE_CONFERENCE);
        String parentId = parentCall.getTelecomCallId();
        int parentId = parentCall.getId();
        when(childCall1.getParentId()).thenReturn(parentId);
        when(childCall1.getParentId()).thenReturn(parentId);
        when(childCall2.getParentId()).thenReturn(parentId);
        when(childCall2.getParentId()).thenReturn(parentId);


@@ -681,8 +680,8 @@ public class BluetoothInCallServiceTest {
        removeCallCapability(parentConfCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        removeCallCapability(parentConfCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        when(parentConfCall.wasConferencePreviouslyMerged()).thenReturn(true);
        when(parentConfCall.wasConferencePreviouslyMerged()).thenReturn(true);
        when(parentConfCall.isConference()).thenReturn(true);
        when(parentConfCall.isConference()).thenReturn(true);
        List<String> childrenIds = Arrays.asList(confCall1.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(confCall1.getId(),
                confCall2.getTelecomCallId());
                confCall2.getId());
        when(parentConfCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentConfCall.getChildrenIds()).thenReturn(childrenIds);


        clearInvocations(mMockBluetoothHeadset);
        clearInvocations(mMockBluetoothHeadset);
@@ -788,8 +787,8 @@ public class BluetoothInCallServiceTest {
        BluetoothCall activeCall = createActiveCall();
        BluetoothCall activeCall = createActiveCall();
        removeCallCapability(activeCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        removeCallCapability(activeCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        BluetoothCall conferenceableCall = getMockCall();
        BluetoothCall conferenceableCall = getMockCall();
        ArrayList<String> conferenceableCalls = new ArrayList<>();
        ArrayList<Integer> conferenceableCalls = new ArrayList<>();
        conferenceableCalls.add(conferenceableCall.getTelecomCallId());
        conferenceableCalls.add(conferenceableCall.getId());
        mBluetoothInCallService.onCallAdded(conferenceableCall);
        mBluetoothInCallService.onCallAdded(conferenceableCall);


        when(activeCall.getConferenceableCalls()).thenReturn(conferenceableCalls);
        when(activeCall.getConferenceableCalls()).thenReturn(conferenceableCalls);
@@ -811,8 +810,8 @@ public class BluetoothInCallServiceTest {
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.wasConferencePreviouslyMerged()).thenReturn(false);
        when(parentCall.wasConferencePreviouslyMerged()).thenReturn(false);
        List<String> childrenIds = Arrays.asList(foregroundCall.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(foregroundCall.getId(),
                heldCall.getTelecomCallId());
                heldCall.getId());
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);


        clearInvocations(mMockBluetoothHeadset);
        clearInvocations(mMockBluetoothHeadset);
@@ -858,8 +857,8 @@ public class BluetoothInCallServiceTest {
        addCallCapability(parentCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        addCallCapability(parentCall, Connection.CAPABILITY_MERGE_CONFERENCE);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        removeCallCapability(parentCall, Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
        List<String> childrenIds = Arrays.asList(foregroundCall.getTelecomCallId(),
        List<Integer> childrenIds = Arrays.asList(foregroundCall.getId(),
                heldCall.getTelecomCallId());
                heldCall.getId());
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);
        when(parentCall.getChildrenIds()).thenReturn(childrenIds);


        mBluetoothInCallService.onCallAdded(parentCall);
        mBluetoothInCallService.onCallAdded(parentCall);
@@ -960,9 +959,9 @@ public class BluetoothInCallServiceTest {
        BluetoothInCallService.CallStateCallback callback =
        BluetoothInCallService.CallStateCallback callback =
                mBluetoothInCallService.new CallStateCallback(Call.STATE_CONNECTING);
                mBluetoothInCallService.new CallStateCallback(Call.STATE_CONNECTING);
        mBluetoothInCallService.mCallbacks.put(
        mBluetoothInCallService.mCallbacks.put(
                activeCall.getTelecomCallId(), callback);
                activeCall.getId(), callback);


        mBluetoothInCallService.mCallbacks.get(activeCall.getTelecomCallId())
        mBluetoothInCallService.mCallbacks.get(activeCall.getId())
                .onStateChanged(activeCall, Call.STATE_DIALING);
                .onStateChanged(activeCall, Call.STATE_DIALING);


        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
@@ -1039,12 +1038,12 @@ public class BluetoothInCallServiceTest {
        mBluetoothInCallService.onCallAdded(parentCall);
        mBluetoothInCallService.onCallAdded(parentCall);
        mBluetoothInCallService.onCallAdded(activeCall);
        mBluetoothInCallService.onCallAdded(activeCall);
        mBluetoothInCallService.onCallAdded(heldCall);
        mBluetoothInCallService.onCallAdded(heldCall);
        String parentId = parentCall.getTelecomCallId();
        int parentId = parentCall.getId();
        when(activeCall.getParentId()).thenReturn(parentId);
        when(activeCall.getParentId()).thenReturn(parentId);
        when(heldCall.getParentId()).thenReturn(parentId);
        when(heldCall.getParentId()).thenReturn(parentId);


        ArrayList<String> calls = new ArrayList<>();
        ArrayList<Integer> calls = new ArrayList<>();
        calls.add(activeCall.getTelecomCallId());
        calls.add(activeCall.getId());


        when(parentCall.getChildrenIds()).thenReturn(calls);
        when(parentCall.getChildrenIds()).thenReturn(calls);
        when(parentCall.isConference()).thenReturn(true);
        when(parentCall.isConference()).thenReturn(true);
@@ -1071,7 +1070,7 @@ public class BluetoothInCallServiceTest {
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
        verify(mMockBluetoothHeadset, never()).phoneStateChanged(anyInt(), anyInt(), anyInt(),
                anyString(), anyInt(), nullable(String.class));
                anyString(), anyInt(), nullable(String.class));


        calls.add(heldCall.getTelecomCallId());
        calls.add(heldCall.getId());
        mBluetoothInCallService.onCallAdded(heldCall);
        mBluetoothInCallService.onCallAdded(heldCall);
        mBluetoothInCallService.getCallback(parentCall)
        mBluetoothInCallService.getCallback(parentCall)
                .onChildrenChanged(
                .onChildrenChanged(
@@ -1169,8 +1168,8 @@ public class BluetoothInCallServiceTest {


    private BluetoothCall getMockCall() {
    private BluetoothCall getMockCall() {
        BluetoothCall call = mock(com.android.bluetooth.telephony.BluetoothCall.class);
        BluetoothCall call = mock(com.android.bluetooth.telephony.BluetoothCall.class);
        String uuid = UUID.randomUUID().toString();
        int uuid = UUID.randomUUID().hashCode();
        when(call.getTelecomCallId()).thenReturn(uuid);
        when(call.getId()).thenReturn(uuid);
        return call;
        return call;
    }
    }
}
}