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

Commit 8603f6fa authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge "Add logs to debug MapClientTest failure" into tm-qpr-dev

parents 389e64f5 ccca06ba
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -166,6 +166,9 @@ public class MapClientService extends ProfileService {
    }

    private synchronized void addDeviceToMapAndConnect(BluetoothDevice device) {
        if (Utils.isInstrumentationTestMode()) {
            Log.d(TAG, "addDeviceToMapAndConnect: device=" + device, new Exception());
        }
        // When creating a new statemachine, its state is set to CONNECTING - which will trigger
        // connect.
        MceStateMachine mapStateMachine = new MceStateMachine(this, device);
@@ -365,6 +368,9 @@ public class MapClientService extends ProfileService {
        }
        removeUncleanAccounts();
        mMapInstanceMap.clear();
        if (Utils.isInstrumentationTestMode()) {
            Log.d(TAG, "cleanup() called.", new Exception());
        }
        // TODO(b/72948646): should be moved to stop()
        setMapClientService(null);
    }
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.bluetooth.BluetoothProfile;
import android.bluetooth.IBluetoothMapClient;
import android.content.Context;
import android.os.UserHandle;
import android.util.Log;

import androidx.test.InstrumentationRegistry;
import androidx.test.filters.MediumTest;
@@ -122,6 +123,8 @@ public class MapClientTest {

        // is the statemachine created
        Map<BluetoothDevice, MceStateMachine> map = mService.getInstanceMap();
        Log.d("MapClientTest", "map=" + map);

        Assert.assertEquals(1, map.size());
        Assert.assertNotNull(map.get(device));
        TestUtils.waitForLooperToFinishScheduledTask(mService.getMainLooper());