Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public void onReceive(Context context, Intent intent) {

if (action.equalsIgnoreCase(TransportConstants.ACTION_USB_ACCESSORY_ATTACHED)) {
DebugTool.logInfo(TAG, "Usb connected");
setForegroundExceptionHandler();
intent.setAction(null);
onSdlEnabled(context, intent);
return;
Expand Down Expand Up @@ -189,6 +190,7 @@ public void onListObtained(boolean successful) {
finalIntent.putExtra(UsbManager.EXTRA_ACCESSORY, (Parcelable) null);
}
}
setForegroundExceptionHandler();
onSdlEnabled(finalContext, finalIntent);
}

Expand Down Expand Up @@ -421,7 +423,7 @@ static protected void setForegroundExceptionHandler() {
public void uncaughtException(Thread t, Throwable e) {
if (e != null
&& e instanceof AndroidRuntimeException
&& ("android.app.RemoteServiceException".equals(e.getClass().getName()) || "android.app.ForegroundServiceDidNotStartInTimeException".equals(e.getClass().getName())) //android.app.RemoteServiceException is a private class
&& ("android.app.RemoteServiceException".equals(e.getClass().getName()) || e.getClass().getName().contains("ForegroundService")) //android.app.RemoteServiceException is a private class
&& e.getMessage() != null
&& (e.getMessage().contains("SdlRouterService") || e.getMessage().contains(serviceName))) {
DebugTool.logInfo(TAG, "Handling failed startForegroundService call");
Expand Down