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

Commit 12523f60 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun Committed by Android (Google) Code Review
Browse files

Merge "[LeAudio] Stop initialzing if stopped" into tm-qpr-dev

parents ed5ef7b9 9e8fb125
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -293,6 +293,7 @@ public class LeAudioService extends ProfileService {
        LeAudioNativeInterface nativeInterface = mLeAudioNativeInterface;
        if (nativeInterface == null) {
            Log.w(TAG, "the service is stopped. ignore init()");
            return;
        }
        nativeInterface.init(mLeAudioCodecConfig.getCodecConfigOffloading());
    }
@@ -305,6 +306,7 @@ public class LeAudioService extends ProfileService {
            return true;
        }

        mHandler.removeCallbacks(this::init);
        setActiveDevice(null);

        if (mTmapGattServer == null) {
+15 −0
Original line number Diff line number Diff line
@@ -310,6 +310,21 @@ public class LeAudioServiceTest {
        });
    }

    /**
     * Test if stop during init is ok.
     */
    @Test
    public void testStopStartStopService() throws Exception {
        InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable() {
            public void run() {
                assertThat(mService.stop()).isTrue();
                assertThat(mService.start()).isTrue();
                assertThat(mService.stop()).isTrue();
                assertThat(mService.start()).isTrue();
            }
        });
    }

    /**
     * Test get/set priority for BluetoothDevice
     */