summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-02-20 11:31:29 -0500
committerJoel Fischer <joeljfischer@gmail.com>2017-02-20 11:31:29 -0500
commit74f9a4316da627d6cea6b843250e1870214dc43a (patch)
treea50ab912d2665e9a4ac11a905d783e030802f92e
parent8fda95124154dcb6fe17af5d527f0a630d7ad9c4 (diff)
downloadsdl_ios-74f9a4316da627d6cea6b843250e1870214dc43a.tar.gz
* Update `SDLLockScreenStatusManager` to use OPTIONAL status in the background when appropriate.
-rw-r--r--SmartDeviceLink/SDLLockScreenStatusManager.m11
-rw-r--r--SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m28
2 files changed, 34 insertions, 5 deletions
diff --git a/SmartDeviceLink/SDLLockScreenStatusManager.m b/SmartDeviceLink/SDLLockScreenStatusManager.m
index 86350b0d0..956da2dcf 100644
--- a/SmartDeviceLink/SDLLockScreenStatusManager.m
+++ b/SmartDeviceLink/SDLLockScreenStatusManager.m
@@ -71,10 +71,17 @@
return [SDLLockScreenStatus OFF];
} else if ([self.hmiLevel isEqualToEnum:[SDLHMILevel BACKGROUND]]) {
// App is in the background on the car
- // The lockscreen depends entirely on if the user selected the app
if (self.userSelected) {
- return [SDLLockScreenStatus REQUIRED];
+ // It was user selected
+ if (self.haveDriverDistractionStatus && !self.driverDistracted) {
+ // We have the distraction status, and the driver is not distracted
+ return [SDLLockScreenStatus OPTIONAL];
+ } else {
+ // We don't have the distraction status, and/or the driver is distracted
+ return [SDLLockScreenStatus REQUIRED];
+ }
} else {
+ // It wasn't user selected
return [SDLLockScreenStatus OFF];
}
} else if ([self.hmiLevel isEqualToEnum:[SDLHMILevel FULL]] || [self.hmiLevel isEqualToEnum:[SDLHMILevel LIMITED]]) {
diff --git a/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m b/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m
index 546380367..8a61980fe 100644
--- a/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m
+++ b/SmartDeviceLinkTests/ProxySpecs/SDLLockScreenStatusManagerSpec.m
@@ -122,9 +122,31 @@ describe(@"the lockscreen status manager", ^{
beforeEach(^{
lockScreenManager.userSelected = YES;
});
-
- it(@"should return lock screen required", ^{
- expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED]));
+
+ context(@"if we do not set the driver distraction state", ^{
+ it(@"should return lock screen required", ^{
+ expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED]));
+ });
+ });
+
+ context(@"if we set the driver distraction state to false", ^{
+ beforeEach(^{
+ lockScreenManager.driverDistracted = NO;
+ });
+
+ it(@"should return lock screen optional", ^{
+ expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus OPTIONAL]));
+ });
+ });
+
+ context(@"if we set the driver distraction state to true", ^{
+ beforeEach(^{
+ lockScreenManager.driverDistracted = YES;
+ });
+
+ it(@"should return lock screen required", ^{
+ expect(lockScreenManager.lockScreenStatus).to(equal([SDLLockScreenStatus REQUIRED]));
+ });
});
});