java.lang.Object
android.content.Context
android.content.ContextWrapper
android.app.Service
protected static final int ROUTER_SERVICE_VERSION_NUMBER
public static final java.lang.String REGISTER_NEWER_SERVER_INSTANCE_ACTION
public static final java.lang.String SDL_NOTIFICATION_FAQS_PAGE
public static final java.lang.String REGISTER_WITH_ROUTER_ACTION
public static final int MESSAGE_STATE_CHANGE
public static final int MESSAGE_READ
public static final int MESSAGE_WRITE
public static final int MESSAGE_DEVICE_NAME
public static final int MESSAGE_LOG
protected static final java.lang.String SDL_DEVICE_STATUS_SHARED_PREFS
protected static final java.lang.String SDL_ROUTER_SERVICE_PREFS
protected static final java.lang.String KEY_AVOID_NOTIFICATION_CHANNEL_DELETE
public static java.util.HashMap registeredApps
From Class | Fields |
---|---|
android.app.Service | START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY |
android.content.Context | ACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APPWIDGET_SERVICE, APP_OPS_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_WAIVE_PRIORITY, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, FINGERPRINT_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, JOB_SCHEDULER_SERVICE, KEYGUARD_SERVICE, LAUNCHER_APPS_SERVICE, LAYOUT_INFLATER_SERVICE, LOCATION_SERVICE, MEDIA_PROJECTION_SERVICE, MEDIA_ROUTER_SERVICE, MEDIA_SESSION_SERVICE, MIDI_SERVICE, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RESTRICTIONS_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, STORAGE_SERVICE, TELECOM_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, WALLPAPER_SERVICE, WIFI_P2P_SERVICE, WIFI_SERVICE, WINDOW_SERVICE |
public SdlRouterService()
public android.os.IBinder onBind(Intent intent)
public boolean onUnbind(Intent intent)
Formats the message for the app that is to receive it
protected boolean formatMessage(SdlRouterService.RegisteredApp app,Message message)
public void onCreate()
The method will attempt to start up the next router service in line based on the sorting criteria of best router service. If a ParcelFileDescriptor is not null, we pass it along to the next RouterService to give it a chane to connected via AOA. This only happens on Android 14 and above when the app selected to host the RouterService does not satisfy the requirements for permission FOREGROUND_SERVICE_CONNECTED_DEVICE. By passing along the usbPfd, it will give the next RouterService selected a chance to connect.
protected void deployNextRouterService(ParcelFileDescriptor usbPfd)
public void startUpSequence()
This method will set a new UncaughtExceptionHandler for the current thread. The only purpose of the custom UncaughtExceptionHandler is to catch the rare occurrence that the a specific mobile device/OS can't properly handle the deletion and creation of the foreground notification channel that is necessary for foreground services after Android Oreo. The new UncaughtExceptionHandler will catch that specific exception and tell the main looper to continue forward. This still leaves the SdlRouterService killed, but prevents an ANR to the app that makes the startForegroundService call. It will set a flag that will prevent the channel from being deleted in the future and therefore avoiding this exception.
protected void setRouterServiceExceptionHandler()
public int onStartCommand(Intent intent,int flags,int startId)
public void onDestroy()
public void resetForegroundTimeOut(long delay)
public void cancelForegroundTimeOut()
1. If the app has SDL shut off, shut down 2. if The app has an Alt Transport address or was started by one, stay open 3. If Bluetooth is off/NA shut down 4. Anything else
public boolean shouldServiceRemainOpen(Intent intent)
This method is needed so that apps that choose not to implement this as a service as defined by Android, but rather just a simple class we have to know how to shut down.
public void closeSelf()
public void onTransportConnected(TransportRecord record)
public void onTransportDisconnected(TransportRecord record)
public void onTransportError(TransportRecord transport,Bundle errorBundle)
public void onPacketRead(SdlPacket packet)
public boolean writeBytesToTransport(Bundle bundle)
This will send the received packet to the registered service. It will default to the single registered "foreground" app. This can be overridden to provide more specific functionality.
public boolean sendPacketToRegisteredApp(SdlPacket packet)
This function looks through the phones currently paired bluetooth devices If one of the devices' names contain "sync", or livio it will attempt to connect the RFCOMM And start SDL
public synchronized boolean bluetoothQuerryAndConnect()
Set the connection establishment status of the particular device
protected void setSDLConnectedStatus(String address,boolean hasSDLConnected)
Checks to see if a device address has connected to SDL before.
protected boolean isFirstStatusCheck(String address)
Checks to see if a device address has connected to SDL before.
protected boolean hasSDLConnected(String address)
Set specific settings through key/value to the SDL_ROUTER_SERVICE_PREFS
protected void setSdlRouterServicePrefs(String key,boolean value)
Retrieves a boolean value for the given key in the SDL_ROUTER_SERVICE_PREFS
protected boolean getBooleanPref(String key,boolean defaultValue)
Deprecated
protected static com.smartdevicelink.transport.SdlRouterService.LocalRouterService getLocalRouterService(Intent launchIntent,ComponentName name)
Method for finding the next, highest priority write task from all connected apps.
protected com.smartdevicelink.transport.SdlRouterService.PacketWriteTask getNextTask(TransportType transportType)
From Class | Methods |
---|---|
android.app.Service | getApplication, onCreate, onStart, onStartCommand, onDestroy, onConfigurationChanged, onLowMemory, onTrimMemory, onBind, onUnbind, onRebind, onTaskRemoved, stopSelf, stopSelf, stopSelfResult, startForeground, stopForeground, dump |
android.content.ContextWrapper | attachBaseContext, getBaseContext, getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, setTheme, getTheme, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, fileList, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted |
android.content.Context | getAssets, getResources, getPackageManager, getContentResolver, getMainLooper, getApplicationContext, registerComponentCallbacks, unregisterComponentCallbacks, getText, getString, getString, getColor, getDrawable, getColorStateList, setTheme, getTheme, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, getClassLoader, getPackageName, getApplicationInfo, getPackageResourcePath, getPackageCodePath, getSharedPreferences, openFileInput, openFileOutput, deleteFile, getFileStreamPath, getFilesDir, getNoBackupFilesDir, getExternalFilesDir, getExternalFilesDirs, getObbDir, getObbDirs, getCacheDir, getCodeCacheDir, getExternalCacheDir, getExternalCacheDirs, getExternalMediaDirs, fileList, getDir, openOrCreateDatabase, openOrCreateDatabase, deleteDatabase, getDatabasePath, databaseList, getWallpaper, peekWallpaper, getWallpaperDesiredMinimumWidth, getWallpaperDesiredMinimumHeight, setWallpaper, setWallpaper, clearWallpaper, startActivity, startActivity, startActivities, startActivities, startIntentSender, startIntentSender, sendBroadcast, sendBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyOrderedBroadcast, removeStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcastAsUser, removeStickyBroadcastAsUser, registerReceiver, registerReceiver, unregisterReceiver, startService, stopService, bindService, unbindService, startInstrumentation, getSystemService, getSystemService, getSystemServiceName, checkPermission, checkCallingPermission, checkCallingOrSelfPermission, checkSelfPermission, enforcePermission, enforceCallingPermission, enforceCallingOrSelfPermission, grantUriPermission, revokeUriPermission, checkUriPermission, checkCallingUriPermission, checkCallingOrSelfUriPermission, checkUriPermission, enforceUriPermission, enforceCallingUriPermission, enforceCallingOrSelfUriPermission, enforceUriPermission, createPackageContext, createConfigurationContext, createDisplayContext, isRestricted |
java.lang.Object | getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize |