summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2019-08-27 15:15:51 -0400
committerJoel Fischer <joeljfischer@gmail.com>2019-08-27 15:15:51 -0400
commit1f6eabec191369e68603f3d06a207898be4f7704 (patch)
treefe7048cc0c9489f61130cd87a8a754df95105af3
parentab6e0fcaa80a1398e1c853a9e884e9e25492d1fa (diff)
parentce4ef80cffcc9b508f523b710cef54e81d306cf1 (diff)
downloadsdl_ios-feature/issue_1367_always_lock_screen.tar.gz
-rw-r--r--Example Apps/Example ObjC/MenuManager.m16
-rw-r--r--Example Apps/Example Swift/MenuManager.swift16
-rw-r--r--Example Apps/Shared/AppConstants.h2
-rw-r--r--Example Apps/Shared/AppConstants.m2
-rw-r--r--SmartDeviceLink/SDLDisplayCapabilities.h6
-rw-r--r--SmartDeviceLink/SDLLifecycleConfiguration.h14
-rw-r--r--SmartDeviceLink/SDLLifecycleConfiguration.m2
-rw-r--r--SmartDeviceLink/SDLLifecycleManager.m13
-rw-r--r--SmartDeviceLink/SDLLockScreenConfiguration.h5
-rw-r--r--SmartDeviceLink/SDLLockScreenConfiguration.m13
-rw-r--r--SmartDeviceLink/SDLLockScreenManager.m2
-rw-r--r--SmartDeviceLink/SDLSoftButtonObject.h15
-rw-r--r--SmartDeviceLink/SDLSoftButtonObject.m10
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.h5
-rw-r--r--SmartDeviceLink/SDLStreamingMediaManager.m9
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.h6
-rw-r--r--SmartDeviceLink/SDLStreamingVideoLifecycleManager.m5
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m22
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenConfigurationSpec.m4
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m26
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m1
-rw-r--r--SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m31
22 files changed, 205 insertions, 20 deletions
diff --git a/Example Apps/Example ObjC/MenuManager.m b/Example Apps/Example ObjC/MenuManager.m
index 41458da3b..44adcc223 100644
--- a/Example Apps/Example ObjC/MenuManager.m
+++ b/Example Apps/Example ObjC/MenuManager.m
@@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
return @[[self sdlex_menuCellSpeakNameWithManager:manager],
[self sdlex_menuCellGetAllVehicleDataWithManager:manager],
[self sdlex_menuCellShowPerformInteractionWithManager:manager performManager:performManager],
+ [self sdlex_sliderMenuCellWithManager:manager],
+ [self sdlex_scrollableMessageMenuCellWithManager:manager],
[self sdlex_menuCellRecordInCarMicrophoneAudioWithManager:manager],
[self sdlex_menuCellDialNumberWithManager:manager],
[self sdlex_menuCellChangeTemplateWithManager:manager],
@@ -130,6 +132,20 @@ NS_ASSUME_NONNULL_BEGIN
return [[SDLMenuCell alloc] initWithTitle:ACSubmenuMenuName icon:[SDLArtwork artworkWithImage:[[UIImage imageNamed:MenuBWIconImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate] asImageFormat:SDLArtworkImageFormatPNG] subCells:[submenuItems copy]];
}
++ (SDLMenuCell *)sdlex_sliderMenuCellWithManager:(SDLManager *)manager {
+ return [[SDLMenuCell alloc] initWithTitle:ACSliderMenuName icon:nil voiceCommands:@[ACSliderMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
+ SDLSlider *sliderRPC = [[SDLSlider alloc] initWithNumTicks:3 position:1 sliderHeader:@"Select a letter" sliderFooters:@[@"A", @"B", @"C"] timeout:10000];
+ [manager sendRequest:sliderRPC];
+ }];
+}
+
++ (SDLMenuCell *)sdlex_scrollableMessageMenuCellWithManager:(SDLManager *)manager {
+ return [[SDLMenuCell alloc] initWithTitle:ACScrollableMessageMenuName icon:nil voiceCommands:@[ACScrollableMessageMenuName] handler:^(SDLTriggerSource _Nonnull triggerSource) {
+ SDLScrollableMessage *messageRPC = [[SDLScrollableMessage alloc] initWithMessage:@"This is a scrollable message\nIt can contain many lines" timeout:10000 softButtons:nil];
+ [manager sendRequest:messageRPC];
+ }];
+}
+
#pragma mark - Voice Commands
+ (SDLVoiceCommand *)sdlex_voiceCommandStartWithManager:(SDLManager *)manager {
diff --git a/Example Apps/Example Swift/MenuManager.swift b/Example Apps/Example Swift/MenuManager.swift
index c5171510d..7cd5dd9de 100644
--- a/Example Apps/Example Swift/MenuManager.swift
+++ b/Example Apps/Example Swift/MenuManager.swift
@@ -19,6 +19,8 @@ class MenuManager: NSObject {
return [menuCellSpeakName(with: manager),
menuCellGetAllVehicleData(with: manager),
menuCellShowPerformInteraction(with: manager, choiceSetManager: choiceSetManager),
+ sliderMenuCell(with: manager),
+ scrollableMessageMenuCell(with: manager),
menuCellRecordInCarMicrophoneAudio(with: manager),
menuCellDialNumber(with: manager),
menuCellChangeTemplate(with: manager),
@@ -174,6 +176,20 @@ private extension MenuManager {
return SDLMenuCell(title: ACSubmenuMenuName, icon: SDLArtwork(image: #imageLiteral(resourceName: "choice_set").withRenderingMode(.alwaysTemplate), persistent: true, as: .PNG), subCells: submenuItems)
}
+
+ private class func sliderMenuCell(with manager: SDLManager) -> SDLMenuCell {
+ return SDLMenuCell(title: ACSliderMenuName, icon: nil, voiceCommands: [ACSliderMenuName], handler: { _ in
+ let slider = SDLSlider(numTicks: 3, position: 1, sliderHeader: "Select a letter", sliderFooters: ["A", "B", "C"], timeout: 10000)
+ manager.send(slider)
+ })
+ }
+
+ private class func scrollableMessageMenuCell(with manager: SDLManager) -> SDLMenuCell {
+ return SDLMenuCell(title: ACScrollableMessageMenuName, icon: nil, voiceCommands: [ACScrollableMessageMenuName], handler: { _ in
+ let scrollableMessage = SDLScrollableMessage(message: "This is a scrollable message\nIt can contain many lines", timeout: 10000, softButtons: nil)
+ manager.send(scrollableMessage)
+ })
+ }
}
// MARK: - Menu Voice Commands
diff --git a/Example Apps/Shared/AppConstants.h b/Example Apps/Shared/AppConstants.h
index 5c7b373e0..9e7ec3d28 100644
--- a/Example Apps/Shared/AppConstants.h
+++ b/Example Apps/Shared/AppConstants.h
@@ -79,6 +79,8 @@ extern NSString * const ACDialPhoneNumberMenuName;
extern NSString * const ACSubmenuMenuName;
extern NSString * const ACSubmenuItemMenuName;
extern NSString * const ACSubmenuTemplateMenuName;
+extern NSString * const ACSliderMenuName;
+extern NSString * const ACScrollableMessageMenuName;
extern NSString * const ACAccelerationPedalPositionMenuName;
extern NSString * const ACAirbagStatusMenuName;
diff --git a/Example Apps/Shared/AppConstants.m b/Example Apps/Shared/AppConstants.m
index d6edd60c1..1760ecb42 100644
--- a/Example Apps/Shared/AppConstants.m
+++ b/Example Apps/Shared/AppConstants.m
@@ -76,6 +76,8 @@ NSString * const ACDialPhoneNumberMenuName = @"Dial Phone Number";
NSString * const ACSubmenuMenuName = @"Submenu";
NSString * const ACSubmenuItemMenuName = @"Item";
NSString * const ACSubmenuTemplateMenuName = @"Change Template";
+NSString * const ACSliderMenuName = @"Show Slider";
+NSString * const ACScrollableMessageMenuName = @"Show Scrollable Message";
NSString * const ACAccelerationPedalPositionMenuName = @"Acceleration Pedal Position";
NSString * const ACAirbagStatusMenuName = @"Airbag Status";
diff --git a/SmartDeviceLink/SDLDisplayCapabilities.h b/SmartDeviceLink/SDLDisplayCapabilities.h
index b278ef3a2..b5644379f 100644
--- a/SmartDeviceLink/SDLDisplayCapabilities.h
+++ b/SmartDeviceLink/SDLDisplayCapabilities.h
@@ -75,11 +75,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) NSNumber<SDLBool> *graphicSupported;
/**
- * Number of presets the screen supports
+ * An array of all predefined persistent display templates available on the head unit.
*
- * @discussion The number of on-screen custom presets available (if any)
+ * Optional, Array of String, max string size 100, 0 - 100 objects, since SDL 3.0
*
- * Optional, Array of String, max string size 100, 0 - 100 objects
+ * See SDLPredefinedLayout
*/
@property (nullable, strong, nonatomic) NSArray<NSString *> *templatesAvailable;
diff --git a/SmartDeviceLink/SDLLifecycleConfiguration.h b/SmartDeviceLink/SDLLifecycleConfiguration.h
index 878895416..36ad3565e 100644
--- a/SmartDeviceLink/SDLLifecycleConfiguration.h
+++ b/SmartDeviceLink/SDLLifecycleConfiguration.h
@@ -19,6 +19,11 @@
NS_ASSUME_NONNULL_BEGIN
+typedef NS_OPTIONS(NSUInteger, SDLSecondaryTransports) {
+ SDLSecondaryTransportsNone = 0,
+ SDLSecondaryTransportsTCP = 1 << 0
+};
+
/**
* Configuration options for SDLManager
*/
@@ -178,6 +183,15 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (strong, nonatomic) SDLVersion *minimumRPCVersion;
+/**
+ Which transports are permitted to be used as secondary transports. A secondary transport is a transport that is connected as an alternate, higher bandwidth transport for situations when a low-bandwidth primary transport (such as Bluetooth) will restrict certain features (such as video streaming navigation).
+
+ The only currently available secondary transport is TCP over WiFi. This is set to permit TCP by default, but it can be disabled by using SDLSecondaryTransportsNone instead.
+
+ This will only affect apps that have high-bandwidth requirements; currently that is only video streaming navigation apps.
+ */
+@property (assign, nonatomic) SDLSecondaryTransports allowedSecondaryTransports;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLLifecycleConfiguration.m b/SmartDeviceLink/SDLLifecycleConfiguration.m
index 5f163d8e6..09847120d 100644
--- a/SmartDeviceLink/SDLLifecycleConfiguration.m
+++ b/SmartDeviceLink/SDLLifecycleConfiguration.m
@@ -69,6 +69,7 @@ static NSUInteger const AppIdCharacterCount = 10;
_voiceRecognitionCommandNames = nil;
_minimumProtocolVersion = [SDLVersion versionWithString:@"1.0.0"];
_minimumRPCVersion = [SDLVersion versionWithString:@"1.0.0"];
+ _allowedSecondaryTransports = SDLSecondaryTransportsTCP;
_fullAppId = fullAppId;
_appId = fullAppId != nil ? [self.class sdlex_shortAppIdFromFullAppId:fullAppId] : appId;
@@ -156,6 +157,7 @@ static NSUInteger const AppIdCharacterCount = 10;
newConfig->_voiceRecognitionCommandNames = _voiceRecognitionCommandNames;
newConfig->_dayColorScheme = _dayColorScheme;
newConfig->_nightColorScheme = _nightColorScheme;
+ newConfig->_allowedSecondaryTransports = _allowedSecondaryTransports;
return newConfig;
}
diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m
index d59b1e4eb..c0bc8fbb6 100644
--- a/SmartDeviceLink/SDLLifecycleManager.m
+++ b/SmartDeviceLink/SDLLifecycleManager.m
@@ -224,19 +224,18 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
// Start up the internal proxy object
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ self.secondaryTransportManager = nil;
if (self.configuration.lifecycleConfig.tcpDebugMode) {
- // secondary transport manager is not used
- self.secondaryTransportManager = nil;
self.proxy = [SDLProxy tcpProxyWithListener:self.notificationDispatcher
tcpIPAddress:self.configuration.lifecycleConfig.tcpDebugIPAddress
tcpPort:@(self.configuration.lifecycleConfig.tcpDebugPort).stringValue
secondaryTransportManager:self.secondaryTransportManager];
+ } else if (self.configuration.lifecycleConfig.allowedSecondaryTransports == SDLSecondaryTransportsNone) {
+ self.proxy = [SDLProxy iapProxyWithListener:self.notificationDispatcher secondaryTransportManager:nil];
} else {
- // we reuse our queue to run secondary transport manager's state machine
- self.secondaryTransportManager = [[SDLSecondaryTransportManager alloc] initWithStreamingProtocolDelegate:self
- serialQueue:self.lifecycleQueue];
- self.proxy = [SDLProxy iapProxyWithListener:self.notificationDispatcher
- secondaryTransportManager:self.secondaryTransportManager];
+ // We reuse our queue to run secondary transport manager's state machine
+ self.secondaryTransportManager = [[SDLSecondaryTransportManager alloc] initWithStreamingProtocolDelegate:self serialQueue:self.lifecycleQueue];
+ self.proxy = [SDLProxy iapProxyWithListener:self.notificationDispatcher secondaryTransportManager:self.secondaryTransportManager];
}
#pragma clang diagnostic pop
}
diff --git a/SmartDeviceLink/SDLLockScreenConfiguration.h b/SmartDeviceLink/SDLLockScreenConfiguration.h
index ee8ac6bfc..317beabe4 100644
--- a/SmartDeviceLink/SDLLockScreenConfiguration.h
+++ b/SmartDeviceLink/SDLLockScreenConfiguration.h
@@ -55,6 +55,11 @@ typedef NS_ENUM(NSUInteger, SDLLockScreenConfigurationDisplayMode) {
@property (assign, nonatomic) BOOL enableDismissGesture;
/**
+ If YES, then the lockscreen will show the vehicle's logo if the vehicle has made it available. If NO, then the lockscreen will not show the vehicle logo. Defaults to YES.
+*/
+@property (assign, nonatomic) BOOL showDeviceLogo;
+
+/**
If YES, the lock screen should be managed by SDL and automatically engage when necessary. If NO, then the lock screen will never be engaged. Defaults to YES.
Since this has been deprecated, setting this to false will set `displayMode` to `Never`. Setting it back to true will set it to `RequiredOnly` if `showInOptionalState` is false, or `OptionalOrRequired` if it is true.
diff --git a/SmartDeviceLink/SDLLockScreenConfiguration.m b/SmartDeviceLink/SDLLockScreenConfiguration.m
index 5ee76e3fe..47e4980de 100644
--- a/SmartDeviceLink/SDLLockScreenConfiguration.m
+++ b/SmartDeviceLink/SDLLockScreenConfiguration.m
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - Lifecycle
-- (instancetype)initWithDisplayMode:(SDLLockScreenConfigurationDisplayMode)mode enableDismissGesture:(BOOL)enableDismissGesture backgroundColor:(UIColor *)backgroundColor appIcon:(nullable UIImage *)appIcon viewController:(nullable UIViewController *)customViewController {
+- (instancetype)initWithDisplayMode:(SDLLockScreenConfigurationDisplayMode)mode enableDismissGesture:(BOOL)enableDismissGesture showDeviceLogo:(BOOL)showDeviceLogo backgroundColor:(UIColor *)backgroundColor appIcon:(nullable UIImage *)appIcon viewController:(nullable UIViewController *)customViewController {
self = [super init];
if (!self) {
return nil;
@@ -29,16 +29,17 @@ NS_ASSUME_NONNULL_BEGIN
_backgroundColor = backgroundColor;
_appIcon = appIcon;
_customViewController = customViewController;
+ _showDeviceLogo = showDeviceLogo;
return self;
}
+ (instancetype)disabledConfiguration {
- return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeNever enableDismissGesture:NO backgroundColor:[self sdl_defaultBackgroundColor] appIcon:nil viewController:nil];
+ return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeNever enableDismissGesture:NO showDeviceLogo:YES backgroundColor:[self sdl_defaultBackgroundColor] appIcon:nil viewController:nil];
}
+ (instancetype)enabledConfiguration {
- return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES backgroundColor:[self sdl_defaultBackgroundColor] appIcon:nil viewController:nil];
+ return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES showDeviceLogo:YES backgroundColor:[self sdl_defaultBackgroundColor] appIcon:nil viewController:nil];
}
+ (instancetype)enabledConfigurationWithAppIcon:(UIImage *)lockScreenAppIcon backgroundColor:(nullable UIColor *)lockScreenBackgroundColor {
@@ -46,11 +47,11 @@ NS_ASSUME_NONNULL_BEGIN
lockScreenBackgroundColor = [self.class sdl_defaultBackgroundColor];
}
- return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES backgroundColor:lockScreenBackgroundColor appIcon:lockScreenAppIcon viewController:nil];
+ return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES showDeviceLogo:YES backgroundColor:lockScreenBackgroundColor appIcon:lockScreenAppIcon viewController:nil];
}
+ (instancetype)enabledConfigurationWithViewController:(UIViewController *)viewController {
- return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES backgroundColor:[self.class sdl_defaultBackgroundColor] appIcon:nil viewController:viewController];
+ return [[self alloc] initWithDisplayMode:SDLLockScreenConfigurationDisplayModeRequiredOnly enableDismissGesture:YES showDeviceLogo:YES backgroundColor:[self.class sdl_defaultBackgroundColor] appIcon:nil viewController:viewController];
}
@@ -90,7 +91,7 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - NSCopying
- (id)copyWithZone:(nullable NSZone *)zone {
- SDLLockScreenConfiguration *new = [[SDLLockScreenConfiguration allocWithZone:zone] initWithDisplayMode:_displayMode enableDismissGesture:_enableDismissGesture backgroundColor:_backgroundColor appIcon:_appIcon viewController:_customViewController];
+ SDLLockScreenConfiguration *new = [[SDLLockScreenConfiguration allocWithZone:zone] initWithDisplayMode:_displayMode enableDismissGesture:_enableDismissGesture showDeviceLogo:_showDeviceLogo backgroundColor:_backgroundColor appIcon:_appIcon viewController:_customViewController];
return new;
}
diff --git a/SmartDeviceLink/SDLLockScreenManager.m b/SmartDeviceLink/SDLLockScreenManager.m
index aa83a9805..85b601ce0 100644
--- a/SmartDeviceLink/SDLLockScreenManager.m
+++ b/SmartDeviceLink/SDLLockScreenManager.m
@@ -126,7 +126,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *icon = notification.userInfo[SDLNotificationUserInfoObject];
// If the VC is our special type, then add the vehicle icon. If they passed in a custom VC, there's no current way to show the vehicle icon. If they're managing it themselves, they can grab the notification themselves.
- if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]]) {
+ if ([self.lockScreenViewController isKindOfClass:[SDLLockScreenViewController class]] && self.config.showDeviceLogo) {
((SDLLockScreenViewController *)self.lockScreenViewController).vehicleIcon = icon;
}
}
diff --git a/SmartDeviceLink/SDLSoftButtonObject.h b/SmartDeviceLink/SDLSoftButtonObject.h
index fe641a56e..eb2512fca 100644
--- a/SmartDeviceLink/SDLSoftButtonObject.h
+++ b/SmartDeviceLink/SDLSoftButtonObject.h
@@ -10,6 +10,7 @@
#import "SDLNotificationConstants.h"
+@class SDLArtwork;
@class SDLSoftButton;
@class SDLSoftButtonObject;
@class SDLSoftButtonState;
@@ -58,12 +59,24 @@ NS_ASSUME_NONNULL_BEGIN
Create a single-state soft button. For example, a button that brings up a Perform Interaction menu.
@param name The name of the button
- @param eventHandler The handler to be called when the button is in the current state and is pressed
@param state The single state of the button
+ @param eventHandler The handler to be called when the button is pressed
+ @return The button object
*/
- (instancetype)initWithName:(NSString *)name state:(SDLSoftButtonState *)state handler:(nullable SDLRPCButtonNotificationHandler)eventHandler;
/**
+ Create a single-state soft button. For example, a button that brings up a Perform Interaction menu.
+
+ @param name The name of the button
+ @param text The text to be displayed on the button
+ @param artwork The artwork to be displayed on the button
+ @param eventHandler The handler to be called when the button is pressed
+ @return The button object
+ */
+- (instancetype)initWithName:(NSString *)name text:(nullable NSString *)text artwork:(nullable SDLArtwork *)artwork handler:(nullable SDLRPCButtonNotificationHandler)eventHandler;
+
+/**
Transition the soft button to another state in the `states` property. The wrapper considers all transitions valid (assuming a state with that name exists).
@warning This method will throw an exception and crash your app (on purpose) if you attempt an invalid transition. So...don't do that.
diff --git a/SmartDeviceLink/SDLSoftButtonObject.m b/SmartDeviceLink/SDLSoftButtonObject.m
index 427421590..adb153e1a 100644
--- a/SmartDeviceLink/SDLSoftButtonObject.m
+++ b/SmartDeviceLink/SDLSoftButtonObject.m
@@ -53,12 +53,22 @@ NS_ASSUME_NONNULL_BEGIN
return [self initWithName:name states:@[state] initialStateName:state.name handler:eventHandler];
}
+- (instancetype)initWithName:(NSString *)name text:(nullable NSString *)text artwork:(nullable SDLArtwork *)artwork handler:(nullable SDLRPCButtonNotificationHandler)eventHandler {
+ SDLSoftButtonState *implicitState = [[SDLSoftButtonState alloc] initWithStateName:name text:text artwork:artwork];
+ return [self initWithName:name state:implicitState handler:eventHandler];
+}
+
- (BOOL)transitionToStateNamed:(NSString *)stateName {
if ([self stateWithName:stateName] == nil) {
SDLLogE(@"Attempted to transition to state: %@ on soft button: %@ but no state with that name was found", stateName, self.name);
return NO;
}
+ if (self.states.count == 1) {
+ SDLLogW(@"There's only one state, so no transitioning is possible!");
+ return NO;
+ }
+
SDLLogD(@"Transitioning button %@ to state %@", self.name, stateName);
self.currentStateName = stateName;
[self.manager sdl_transitionSoftButton:self];
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.h b/SmartDeviceLink/SDLStreamingMediaManager.h
index 8e96e7ebb..989611e80 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.h
+++ b/SmartDeviceLink/SDLStreamingMediaManager.h
@@ -109,6 +109,11 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (assign, nonatomic) SDLStreamingEncryptionFlag requestedEncryptionType;
+/**
+ When YES, the StreamingMediaManager will send a black screen with "Video Backgrounded String". Defaults to YES.
+ */
+@property (assign, nonatomic) BOOL showVideoBackgroundDisplay;
+
- (instancetype)init NS_UNAVAILABLE;
/**
diff --git a/SmartDeviceLink/SDLStreamingMediaManager.m b/SmartDeviceLink/SDLStreamingMediaManager.m
index d666a6254..f6eef1c32 100644
--- a/SmartDeviceLink/SDLStreamingMediaManager.m
+++ b/SmartDeviceLink/SDLStreamingMediaManager.m
@@ -163,6 +163,11 @@ NS_ASSUME_NONNULL_BEGIN
return self.videoLifecycleManager.requestedEncryptionType;
}
+- (BOOL)showVideoBackgroundDisplay {
+ // both audio and video managers should have same type
+ return self.videoLifecycleManager.showVideoBackgroundDisplay;
+}
+
#pragma mark - Setters
- (void)setRootViewController:(nullable UIViewController *)rootViewController {
self.videoLifecycleManager.rootViewController = rootViewController;
@@ -173,6 +178,10 @@ NS_ASSUME_NONNULL_BEGIN
self.audioLifecycleManager.requestedEncryptionType = requestedEncryptionType;
}
+- (void)setShowVideoBackgroundDisplay:(BOOL)showVideoBackgroundDisplay {
+ self.videoLifecycleManager.showVideoBackgroundDisplay = showVideoBackgroundDisplay;
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
index 1d1350469..ca6188904 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.h
@@ -130,6 +130,12 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (assign, nonatomic) SDLStreamingEncryptionFlag requestedEncryptionType;
+/**
+ When YES, the StreamingMediaManager will send a black screen with "Video Backgrounded String". Defaults to YES.
+ */
+@property (assign, nonatomic) BOOL showVideoBackgroundDisplay;
+
+
- (instancetype)init NS_UNAVAILABLE;
/**
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
index f483866ec..c0d92c30d 100644
--- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
+++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m
@@ -122,6 +122,7 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
_useDisplayLink = configuration.streamingMediaConfig.enableForcedFramerateSync;
_screenSize = SDLDefaultScreenSize;
_backgroundingPixelBuffer = NULL;
+ _showVideoBackgroundDisplay = YES;
_preferredFormatIndex = 0;
_preferredResolutionIndex = 0;
@@ -272,7 +273,9 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N
SDLLogD(@"App became inactive");
if (!self.protocol) { return; }
- [self sdl_sendBackgroundFrames];
+ if (_showVideoBackgroundDisplay) {
+ [self sdl_sendBackgroundFrames];
+ }
[self.touchManager cancelPendingTouches];
if (self.isVideoConnected) {
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index 6d2fd0c79..8e0d85c5b 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -668,6 +668,28 @@ describe(@"a lifecycle manager", ^{
});
});
+describe(@"configuring the lifecycle manager", ^{
+ __block SDLLifecycleConfiguration *lifecycleConfig = nil;
+ __block SDLLifecycleManager *testManager = nil;
+
+ beforeEach(^{
+ lifecycleConfig = [SDLLifecycleConfiguration defaultConfigurationWithAppName:@"Test app" fullAppId:@"Test ID"];
+ });
+
+ context(@"if no secondary transport is allowed", ^{
+ beforeEach(^{
+ lifecycleConfig.allowedSecondaryTransports = SDLSecondaryTransportsNone;
+
+ SDLConfiguration *config = [[SDLConfiguration alloc] initWithLifecycle:lifecycleConfig lockScreen:nil logging:nil fileManager:nil];
+ testManager = [[SDLLifecycleManager alloc] initWithConfiguration:config delegate:nil];
+ });
+
+ it(@"should not create a secondary transport manager", ^{
+ expect(testManager.secondaryTransportManager).to(beNil());
+ });
+ });
+});
+
QuickSpecEnd
#pragma clang diagnostic pop
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenConfigurationSpec.m
index f0a9bff24..d35717658 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenConfigurationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenConfigurationSpec.m
@@ -17,6 +17,7 @@ describe(@"a lock screen configuration", ^{
expect(testConfig.enableAutomaticLockScreen).to(beFalse());
expect(testConfig.showInOptionalState).to(beFalse());
expect(testConfig.enableDismissGesture).to(beFalse());
+ expect(testConfig.showDeviceLogo).to(beFalse());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(beNil());
@@ -32,6 +33,7 @@ describe(@"a lock screen configuration", ^{
expect(testConfig.enableAutomaticLockScreen).to(beTrue());
expect(testConfig.showInOptionalState).to(beFalse());
expect(testConfig.enableDismissGesture).to(beTrue());
+ expect(testConfig.showDeviceLogo).to(beTrue());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(beNil());
@@ -53,6 +55,7 @@ describe(@"a lock screen configuration", ^{
expect(testConfig.enableAutomaticLockScreen).to(beTrue());
expect(testConfig.showInOptionalState).to(beFalse());
expect(testConfig.enableDismissGesture).to(beTrue());
+ expect(testConfig.showDeviceLogo).to(beTrue());
expect(testConfig.backgroundColor).to(equal([UIColor blueColor]));
expect(testConfig.appIcon).to(equal(testImage));
expect(testConfig.customViewController).to(beNil());
@@ -72,6 +75,7 @@ describe(@"a lock screen configuration", ^{
expect(testConfig.enableAutomaticLockScreen).to(beTrue());
expect(testConfig.showInOptionalState).to(beFalse());
expect(testConfig.enableDismissGesture).to(beTrue());
+ expect(testConfig.showDeviceLogo).to(beTrue());
expect(testConfig.backgroundColor).to(equal([UIColor colorWithRed:(57.0/255.0) green:(78.0/255.0) blue:(96.0/255.0) alpha:1.0]));
expect(testConfig.appIcon).to(beNil());
expect(testConfig.customViewController).to(equal(testVC));
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m
index 694084e27..86215488a 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLockScreenManagerSpec.m
@@ -233,7 +233,31 @@ describe(@"a lock screen manager", ^{
});
});
});
-
+
+ context(@"with showDeviceLogo as NO", ^{
+ beforeEach(^{
+ SDLLockScreenConfiguration *config = [SDLLockScreenConfiguration enabledConfiguration];
+ config.showDeviceLogo = NO;
+
+ testManager = [[SDLLockScreenManager alloc] initWithConfiguration:config notificationDispatcher:nil presenter:fakePresenter];
+ [testManager start];
+ });
+
+ describe(@"when a vehicle icon is received", ^{
+ __block UIImage *testIcon = nil;
+
+ beforeEach(^{
+ testIcon = [UIImage imageNamed:@"testImagePNG" inBundle:[NSBundle bundleForClass:self.class] compatibleWithTraitCollection:nil];
+ [[NSNotificationCenter defaultCenter] postNotificationName:SDLDidReceiveLockScreenIcon object:nil userInfo:@{ SDLNotificationUserInfoObject: testIcon }];
+ });
+
+ it(@"should not have a vehicle icon if showDeviceLogo is set to NO", ^{
+ expect(((SDLLockScreenViewController *)testManager.lockScreenViewController).vehicleIcon).to(beNil());
+ });
+ });
+
+ });
+
context(@"with a custom color configuration", ^{
__block UIColor *testColor = nil;
__block UIImage *testImage = nil;
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
index 872f5eb72..31737c214 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
@@ -90,6 +90,7 @@ describe(@"the streaming video manager", ^{
expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeZero))).to(equal(@YES));
expect(@(streamingLifecycleManager.pixelBufferPool == NULL)).to(equal(@YES));
expect(@(streamingLifecycleManager.requestedEncryptionType)).to(equal(@(SDLStreamingEncryptionFlagNone)));
+ expect(@(streamingLifecycleManager.showVideoBackgroundDisplay)).to(equal(@YES));
expect(streamingLifecycleManager.currentAppState).to(equal(SDLAppStateActive));
expect(streamingLifecycleManager.currentVideoStreamState).to(equal(SDLVideoStreamManagerStateStopped));
expect(streamingLifecycleManager.videoFormat).to(beNil());
diff --git a/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m b/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
index 6122c6a8b..201b08dd3 100644
--- a/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
+++ b/SmartDeviceLinkTests/SDLSoftButtonObjectSpec.m
@@ -2,6 +2,7 @@
#import <Nimble/Nimble.h>
#import <OCMock/OCMock.h>
+#import "SDLArtwork.h"
#import "SDLSoftButton.h"
#import "SDLSoftButtonObject.h"
#import "SDLSoftButtonState.h"
@@ -45,6 +46,36 @@ describe(@"a soft button object", ^{
});
});
+ context(@"with a single state implicitly created", ^{
+ NSString *testText = @"Hello";
+ SDLArtwork *testArt = [[SDLArtwork alloc] initWithStaticIcon:SDLStaticIconNameKey];
+
+ beforeEach(^{
+ testObject = [[SDLSoftButtonObject alloc] initWithName:testObjectName text:testText artwork:testArt handler:nil];
+ });
+
+ it(@"should create correctly", ^{
+ expect(testObject.name).to(equal(testObjectName));
+ expect(testObject.currentState.name).to(equal(testObjectName));
+ expect(testObject.currentState.text).to(equal(testText));
+ expect(testObject.currentState.artwork).to(equal(testArt));
+ expect(testObject.states).to(haveCount(1));
+ });
+
+ it(@"should not allow transitioning to another state", ^{
+ BOOL performedTransition = [testObject transitionToStateNamed:@"Some other state"];
+ expect(performedTransition).to(beFalse());
+ });
+
+ it(@"should return a state when asked and not when incorrect", ^{
+ SDLSoftButtonState *returnedState = [testObject stateWithName:testObjectName];
+ expect(returnedState).toNot(beNil());
+
+ returnedState = [testObject stateWithName:@"Some other state"];
+ expect(returnedState).to(beNil());
+ });
+ });
+
context(@"with multiple states", ^{
__block SDLSoftButtonState *testFirstState = OCMClassMock([SDLSoftButtonState class]);
__block NSString *testFirstStateName = @"Test First Name";