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

Commit e81bd659 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun Committed by Gerrit Code Review
Browse files

Merge "[LeAudio] Stop initialzing if stopped"

parents 9a46f208 5cd20c3c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -283,6 +283,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());
    }
@@ -295,6 +296,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
@@ -304,6 +304,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
     */