summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2016-11-01 16:18:04 -0400
committerJoey Grover <joeygrover@gmail.com>2016-11-01 16:18:04 -0400
commit0c6d17c76d712b2225d905d9615181cf43f99644 (patch)
treeb1849f10833b219016d4963c83ea12956619cae9
parent8ec3916288f1526abe390432b7698dc69a256fc8 (diff)
downloadsdl_android-0c6d17c76d712b2225d905d9615181cf43f99644.tar.gz
Added check for trusted router list during SDL enabled broadcast receivedhotfix/issue_357
-rw-r--r--sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java31
1 files changed, 20 insertions, 11 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 2aa214997..ba86f44ae 100644
--- a/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/sdl_android_lib/src/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -72,18 +72,27 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver{
if(intent.hasExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA)){
if(intent.getBooleanExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_EXTRA, false)){
String packageName = intent.getStringExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_APP_PACKAGE);
- ComponentName componentName = intent.getParcelableExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME);
+ final ComponentName componentName = intent.getParcelableExtra(TransportConstants.START_ROUTER_SERVICE_SDL_ENABLED_CMP_NAME);
if(componentName!=null){
- //Log.v(TAG, "SDL enabled by router service from " + packageName + " compnent package " + componentName.getPackageName() + " - " + componentName.getClassName());
- RouterServiceValidator vlad = new RouterServiceValidator(context,componentName);
- if(vlad.validate()){
- //Log.d(TAG, "Router service trusted!");
- queuedService = componentName;
- intent.setAction("com.sdl.noaction"); //Replace what's there so we do go into some unintended loop
- onSdlEnabled(context, intent);
- }else{
- Log.w(TAG, "RouterService was not trusted. Ignoring intent from : "+ componentName.getClassName());
- }
+ final Intent finalIntent = intent;
+ final Context finalContext = context;
+ RouterServiceValidator.createTrustedListRequest(context, false, new TrustedListCallback(){
+ @Override
+ public void onListObtained(boolean successful) {
+ //Log.v(TAG, "SDL enabled by router service from " + packageName + " compnent package " + componentName.getPackageName() + " - " + componentName.getClassName());
+ RouterServiceValidator vlad = new RouterServiceValidator(finalContext,componentName);
+ if(vlad.validate()){
+ //Log.d(TAG, "Router service trusted!");
+ queuedService = componentName;
+ finalIntent.setAction("com.sdl.noaction"); //Replace what's there so we do go into some unintended loop
+ onSdlEnabled(finalContext, finalIntent);
+ }else{
+ Log.w(TAG, "RouterService was not trusted. Ignoring intent from : "+ componentName.getClassName());
+ }
+ }
+
+ });
+
}