diff options
Diffstat (limited to 'SmartDeviceLink/SDLProxy.m')
-rw-r--r-- | SmartDeviceLink/SDLProxy.m | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/SmartDeviceLink/SDLProxy.m b/SmartDeviceLink/SDLProxy.m index 6ab2006c8..f32b3de94 100644 --- a/SmartDeviceLink/SDLProxy.m +++ b/SmartDeviceLink/SDLProxy.m @@ -50,7 +50,7 @@ typedef NSString SDLVehicleMake; typedef void (^URLSessionTaskCompletionHandler)(NSData *data, NSURLResponse *response, NSError *error); typedef void (^URLSessionDownloadTaskCompletionHandler)(NSURL *location, NSURLResponse *response, NSError *error); -NSString *const SDLProxyVersion = @"6.3.0"; +NSString *const SDLProxyVersion = @"6.3.1"; const float StartSessionTime = 10.0; const float NotifyProxyClosedDelay = (float)0.1; const int PoliciesCorrelationId = 65535; @@ -65,7 +65,6 @@ static float DefaultConnectionTimeout = 45.0; @property (nullable, nonatomic, strong) SDLDisplayCapabilities *displayCapabilities; @property (nonatomic, strong) NSMutableDictionary<SDLVehicleMake *, Class> *securityManagers; @property (nonatomic, strong) NSURLSession* urlSession; -@property (strong, nonatomic) dispatch_queue_t rpcProcessingQueue; @end @@ -77,7 +76,6 @@ static float DefaultConnectionTimeout = 45.0; if (self = [super init]) { SDLLogD(@"Framework Version: %@", self.proxyVersion); _lsm = [[SDLLockScreenStatusManager alloc] init]; - _rpcProcessingQueue = dispatch_queue_create("com.sdl.rpcProcessingQueue", DISPATCH_QUEUE_SERIAL); _mutableProxyListeners = [NSMutableSet setWithObject:delegate]; _securityManagers = [NSMutableDictionary dictionary]; @@ -150,13 +148,15 @@ static float DefaultConnectionTimeout = 45.0; #pragma mark - Application Lifecycle - (void)sendMobileHMIState { - dispatch_async(dispatch_get_main_queue(), ^{ - [self sdl_sendMobileHMIState]; - }); -} + __block UIApplicationState appState = UIApplicationStateInactive; + if ([NSThread isMainThread]) { + appState = [UIApplication sharedApplication].applicationState; + } else { + dispatch_sync(dispatch_get_main_queue(), ^{ + appState = [UIApplication sharedApplication].applicationState; + }); + } -- (void)sdl_sendMobileHMIState { - UIApplicationState appState = [UIApplication sharedApplication].applicationState; SDLOnHMIStatus *HMIStatusRPC = [[SDLOnHMIStatus alloc] init]; HMIStatusRPC.audioStreamingState = SDLAudioStreamingStateNotAudible; @@ -898,15 +898,13 @@ static float DefaultConnectionTimeout = 45.0; } - (void)invokeMethodOnDelegates:(SEL)aSelector withObject:(nullable id)object { - // Occurs on the protocol receive serial queue - dispatch_async(_rpcProcessingQueue, ^{ - for (id<SDLProxyListener> listener in self.proxyListeners) { - if ([listener respondsToSelector:aSelector]) { - // HAX: http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown - ((void (*)(id, SEL, id))[(NSObject *)listener methodForSelector:aSelector])(listener, aSelector, object); - } + // Occurs on the processing serial queue + for (id<SDLProxyListener> listener in self.proxyListeners) { + if ([listener respondsToSelector:aSelector]) { + // HAX: http://stackoverflow.com/questions/7017281/performselector-may-cause-a-leak-because-its-selector-is-unknown + ((void (*)(id, SEL, id))[(NSObject *)listener methodForSelector:aSelector])(listener, aSelector, object); } - }); + } } |