diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2017-10-26 12:54:56 +0300 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2017-10-26 12:54:56 +0300 |
commit | 0c592f43693c1a740e30748bb4224ef000039e7b (patch) | |
tree | 45d5b4f69cffca7b02ebd15defbfdf5559b2f3cf | |
parent | b5871b2dc65601d534a758ed1fd4d1da024e00bd (diff) | |
download | sdl_ios-0c592f43693c1a740e30748bb4224ef000039e7b.tar.gz |
Check the makes when deciding if secure or insecure should start
-rw-r--r-- | SmartDeviceLink/SDLStreamingMediaLifecycleManager.m | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m index 9e37dd472..6265abb2c 100644 --- a/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingMediaLifecycleManager.m @@ -20,6 +20,7 @@ #import "SDLGetSystemCapabilityResponse.h" #import "SDLGlobals.h" #import "SDLFocusableItemLocator.h" +#import "SDLH264VideoEncoder.h" #import "SDLHMICapabilities.h" #import "SDLImageResolution.h" #import "SDLLogMacros.h" @@ -35,7 +36,7 @@ #import "SDLStreamingMediaManagerDataSource.h" #import "SDLSystemCapability.h" #import "SDLTouchManager.h" -#import "SDLH264VideoEncoder.h" +#import "SDLVehicleType.h" #import "SDLVideoStreamingCapability.h" #import "SDLVideoStreamingCodec.h" #import "SDLVideoStreamingFormat.h" @@ -78,6 +79,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N @property (strong, nonatomic, nullable) SDLH264VideoEncoder *videoEncoder; @property (copy, nonatomic) NSDictionary<NSString *, id> *videoEncoderSettings; +@property (copy, nonatomic) NSArray<NSString *> *secureMakes; +@property (copy, nonatomic) NSString *connectedVehicleMake; @property (strong, nonatomic, readwrite) SDLStateMachine *appStateMachine; @property (strong, nonatomic, readwrite) SDLStateMachine *videoStreamStateMachine; @@ -117,6 +120,12 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N _preferredFormatIndex = 0; _preferredResolutionIndex = 0; + NSMutableArray<NSString *> *tempMakeArray = [NSMutableArray array]; + for (Class securityManagerClass in configuration.securityManagers) { + [tempMakeArray addObjectsFromArray:[securityManagerClass availableMakes].allObjects]; + } + _secureMakes = [tempMakeArray copy]; + SDLAppState *initialState = SDLAppStateInactive; switch ([[UIApplication sharedApplication] applicationState]) { case UIApplicationStateActive: { @@ -402,7 +411,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N - (void)didEnterStateAudioStreamStarting { SDLLogD(@"Audio stream starting"); - if (self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) { + if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:self.connectedVehicleMake])) { [self.protocol startSecureServiceWithType:SDLServiceTypeAudio payload:nil completionHandler:^(BOOL success, NSError * _Nonnull error) { if (error) { SDLLogE(@"TLS setup error: %@", error); @@ -576,6 +585,8 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N _screenSize = SDLDefaultScreenSize; } + self.connectedVehicleMake = registerResponse.vehicleType.make; + SDLLogD(@"Determined base screen size on display capabilities: %@", NSStringFromCGSize(_screenSize)); } @@ -745,7 +756,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N SDLControlFramePayloadVideoStartService *startVideoPayload = [[SDLControlFramePayloadVideoStartService alloc] initWithVideoHeight:preferredResolution.resolutionHeight.intValue width:preferredResolution.resolutionWidth.intValue protocol:preferredFormat.protocol codec:preferredFormat.codec]; // Decide if we need to start a secure service or not - if (self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) { + if ((self.requestedEncryptionType != SDLStreamingEncryptionFlagNone) && ([self.secureMakes containsObject:self.connectedVehicleMake])) { SDLLogD(@"Sending secure video start service with payload: %@", startVideoPayload); [self.protocol startSecureServiceWithType:SDLServiceTypeVideo payload:startVideoPayload.data completionHandler:^(BOOL success, NSError *error) { if (error) { |