Skip to content

Commit 820c8a1

Browse files
committed
Update SDL BR to start SDLlistener when BT==null
Will only start the listener if the BT device is not null, or in the case where the SDL app is the only app installed.
1 parent 70eb051 commit 820c8a1

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,16 @@ public void onComplete(Vector<ComponentName> routerServices) {
275275
DebugTool.logInfo(TAG, ": This app's package: " + myPackage);
276276
DebugTool.logInfo(TAG, ": Router service app's package: " + routerServicePackage);
277277
if (myPackage != null && myPackage.equalsIgnoreCase(routerServicePackage)) {
278-
SdlDeviceListener sdlDeviceListener = getSdlDeviceListener(context, device);
279-
if (!sdlDeviceListener.isRunning()) {
280-
sdlDeviceListener.start();
278+
//If the device is not null the listener should start as well as the
279+
//case where this app was installed after BT connected and is the
280+
//only SDL app installed on the device. (Rare corner case)
281+
if(device != null || sdlAppInfoList.size() == 1) {
282+
SdlDeviceListener sdlDeviceListener = getSdlDeviceListener(context, device);
283+
if (!sdlDeviceListener.isRunning()) {
284+
sdlDeviceListener.start();
285+
}
286+
} else {
287+
DebugTool.logInfo(TAG, "Not starting device listener, bluetooth device is null and other SDL apps installed.");
281288
}
282289
} else {
283290
DebugTool.logInfo(TAG, ": Not the app to start the router service nor device listener");

0 commit comments

Comments
 (0)