public class SdlRouterService extends Service
| Modifier and Type | Class and Description |
|---|---|
class |
SdlRouterService.PacketWriteTask
A runnable task for writing out packets.
|
| Modifier and Type | Field and Description |
|---|---|
protected static String |
KEY_AVOID_NOTIFICATION_CHANNEL_DELETE |
static int |
MESSAGE_DEVICE_NAME |
static int |
MESSAGE_LOG |
static int |
MESSAGE_READ |
static int |
MESSAGE_STATE_CHANGE
Message types sent from the BluetoothReadService Handler
|
static int |
MESSAGE_WRITE |
static String |
REGISTER_NEWER_SERVER_INSTANCE_ACTION |
static String |
REGISTER_WITH_ROUTER_ACTION |
static HashMap<String,com.smartdevicelink.transport.SdlRouterService.RegisteredApp> |
registeredApps |
protected static int |
ROUTER_SERVICE_VERSION_NUMBER
NOTE: DO NOT MODIFY THIS UNLESS YOU KNOW WHAT YOU'RE DOING.
|
protected static String |
SDL_DEVICE_STATUS_SHARED_PREFS
Preference location where the service stores known SDL status based on device address
|
static String |
SDL_NOTIFICATION_FAQS_PAGE |
protected static String |
SDL_ROUTER_SERVICE_PREFS
Preference location where generic key/values can be stored
|
START_CONTINUATION_MASK, START_FLAG_REDELIVERY, START_FLAG_RETRY, START_NOT_STICKY, START_REDELIVER_INTENT, START_STICKY, START_STICKY_COMPATIBILITY, STOP_FOREGROUND_DETACH, STOP_FOREGROUND_REMOVEACCESSIBILITY_SERVICE, ACCOUNT_SERVICE, ACTIVITY_SERVICE, ALARM_SERVICE, APP_OPS_SERVICE, APPWIDGET_SERVICE, AUDIO_SERVICE, BATTERY_SERVICE, BIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_EXTERNAL_SERVICE, BIND_IMPORTANT, BIND_INCLUDE_CAPABILITIES, BIND_NOT_FOREGROUND, BIND_NOT_PERCEPTIBLE, BIND_WAIVE_PRIORITY, BIOMETRIC_SERVICE, BLOB_STORE_SERVICE, BLUETOOTH_SERVICE, CAMERA_SERVICE, CAPTIONING_SERVICE, CARRIER_CONFIG_SERVICE, CLIPBOARD_SERVICE, COMPANION_DEVICE_SERVICE, CONNECTIVITY_DIAGNOSTICS_SERVICE, CONNECTIVITY_SERVICE, CONSUMER_IR_SERVICE, CONTEXT_IGNORE_SECURITY, CONTEXT_INCLUDE_CODE, CONTEXT_RESTRICTED, CROSS_PROFILE_APPS_SERVICE, DEVICE_POLICY_SERVICE, DISPLAY_SERVICE, DOWNLOAD_SERVICE, DROPBOX_SERVICE, EUICC_SERVICE, FILE_INTEGRITY_SERVICE, FINGERPRINT_SERVICE, HARDWARE_PROPERTIES_SERVICE, INPUT_METHOD_SERVICE, INPUT_SERVICE, IPSEC_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_NO_LOCALIZED_COLLATORS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE, NETWORK_STATS_SERVICE, NFC_SERVICE, NOTIFICATION_SERVICE, NSD_SERVICE, POWER_SERVICE, PRINT_SERVICE, RECEIVER_VISIBLE_TO_INSTANT_APPS, RESTRICTIONS_SERVICE, ROLE_SERVICE, SEARCH_SERVICE, SENSOR_SERVICE, SHORTCUT_SERVICE, STORAGE_SERVICE, STORAGE_STATS_SERVICE, SYSTEM_HEALTH_SERVICE, TELECOM_SERVICE, TELEPHONY_IMS_SERVICE, TELEPHONY_SERVICE, TELEPHONY_SUBSCRIPTION_SERVICE, TEXT_CLASSIFICATION_SERVICE, TEXT_SERVICES_MANAGER_SERVICE, TV_INPUT_SERVICE, UI_MODE_SERVICE, USAGE_STATS_SERVICE, USB_SERVICE, USER_SERVICE, VIBRATOR_SERVICE, VPN_MANAGEMENT_SERVICE, WALLPAPER_SERVICE, WIFI_AWARE_SERVICE, WIFI_P2P_SERVICE, WIFI_RTT_RANGING_SERVICE, WIFI_SERVICE, WINDOW_SERVICETRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN| Constructor and Description |
|---|
SdlRouterService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
bluetoothQuerryAndConnect()
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
|
void |
cancelForegroundTimeOut() |
void |
closeSelf()
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.
|
protected void |
deployNextRouterService()
The method will attempt to start up the next router service in line based on the sorting criteria of best router service.
|
protected boolean |
formatMessage(com.smartdevicelink.transport.SdlRouterService.RegisteredApp app,
Message message)
Formats the message for the app that is to receive it
|
protected boolean |
getBooleanPref(String key,
boolean defaultValue)
Retrieves a boolean value for the given key in the SDL_ROUTER_SERVICE_PREFS
|
protected static com.smartdevicelink.transport.SdlRouterService.LocalRouterService |
getLocalRouterService(Intent launchIntent,
ComponentName name)
Deprecated.
|
protected SdlRouterService.PacketWriteTask |
getNextTask(TransportType transportType)
Method for finding the next, highest priority write task from all connected apps.
|
protected boolean |
hasSDLConnected(String address)
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.
|
IBinder |
onBind(Intent intent) |
void |
onCreate() |
void |
onDestroy() |
void |
onPacketRead(SdlPacket packet) |
int |
onStartCommand(Intent intent,
int flags,
int startId) |
void |
onTransportConnected(TransportRecord record) |
void |
onTransportDisconnected(TransportRecord record) |
void |
onTransportError(TransportRecord transport,
Bundle errorBundle) |
boolean |
onUnbind(Intent intent) |
void |
resetForegroundTimeOut(long delay) |
boolean |
sendPacketToRegisteredApp(SdlPacket packet)
This will send the received packet to the registered service.
|
protected void |
setRouterServiceExceptionHandler()
This method will set a new UncaughtExceptionHandler for the current thread.
|
protected void |
setSDLConnectedStatus(String address,
boolean hasSDLConnected)
Set the connection establishment status of the particular device
|
protected void |
setSdlRouterServicePrefs(String key,
boolean value)
Set specific settings through key/value to the SDL_ROUTER_SERVICE_PREFS
|
boolean |
shouldServiceRemainOpen(Intent intent)
1.
|
void |
startUpSequence() |
boolean |
writeBytesToTransport(Bundle bundle) |
attachBaseContext, dump, getApplication, getForegroundServiceType, onConfigurationChanged, onLowMemory, onRebind, onStart, onTaskRemoved, onTrimMemory, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResultbindIsolatedService, bindService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingPermission, checkCallingUriPermission, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, clearWallpaper, createAttributionContext, createConfigurationContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDatabasePath, getDataDir, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFilesDir, getFileStreamPath, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterReceiver, updateServiceGroupgetColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, registerComponentCallbacks, sendBroadcastWithMultiplePermissions, unregisterComponentCallbacksprotected static final int ROUTER_SERVICE_VERSION_NUMBER
public static final String REGISTER_NEWER_SERVER_INSTANCE_ACTION
public static final String SDL_NOTIFICATION_FAQS_PAGE
public static final 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 String SDL_DEVICE_STATUS_SHARED_PREFS
protected static final String SDL_ROUTER_SERVICE_PREFS
protected static final String KEY_AVOID_NOTIFICATION_CHANNEL_DELETE
protected boolean formatMessage(com.smartdevicelink.transport.SdlRouterService.RegisteredApp app,
Message message)
app - message - protected void deployNextRouterService()
public void startUpSequence()
protected void setRouterServiceExceptionHandler()
public int onStartCommand(Intent intent, int flags, int startId)
onStartCommand in class Servicepublic void resetForegroundTimeOut(long delay)
public void cancelForegroundTimeOut()
public boolean shouldServiceRemainOpen(Intent intent)
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)
public boolean sendPacketToRegisteredApp(SdlPacket packet)
packet - the packet that is receivedpublic boolean bluetoothQuerryAndConnect()
protected void setSDLConnectedStatus(String address, boolean hasSDLConnected)
address - address of the device in questionhasSDLConnected - true if a connection has been established, false if notprotected boolean isFirstStatusCheck(String address)
address - the mac address of the device in quesitonprotected boolean hasSDLConnected(String address)
address - the mac address of the device in quesitonprotected void setSdlRouterServicePrefs(String key, boolean value)
key - the key of the pair to set in the preferencesvalue - boolean to attach to key in the preferencesprotected boolean getBooleanPref(String key, boolean defaultValue)
key - the string key that will be used to retrieve the boolean valuedefaultValue - if they key does not exist or there is no value to be found, this is the
value that will be returned@Deprecated protected static com.smartdevicelink.transport.SdlRouterService.LocalRouterService getLocalRouterService(Intent launchIntent, ComponentName name)
protected SdlRouterService.PacketWriteTask getNextTask(TransportType transportType)