diff --git a/WatchApp/resources/properties.xml b/WatchApp/resources/properties.xml
index 46b3e06..a47a95b 100644
--- a/WatchApp/resources/properties.xml
+++ b/WatchApp/resources/properties.xml
@@ -21,6 +21,7 @@
v3;p3;v3;p3
<;>;app
false
+ true
@@ -45,6 +46,7 @@
means 'vibrate 3s, pause 1s, vibrate 3s, pause 2s')
Verbose logs
Flush incoming messages on launch
+ Optimistic call handling
@@ -62,6 +64,10 @@
title="@Strings.incomingCallMessageFormat">
+
+
+
diff --git a/WatchApp/source/BusinessLogic/CallActionTask.mc b/WatchApp/source/BusinessLogic/CallActionTask.mc
index 3cd9747..a9244d1 100644
--- a/WatchApp/source/BusinessLogic/CallActionTask.mc
+++ b/WatchApp/source/BusinessLogic/CallActionTask.mc
@@ -54,8 +54,13 @@ class CallActionTask extends Communications.ConnectionListener {
_3(L_CALL_ACTION, "onComplete.callStateInvalidated", oldState);
return;
}
- var newState = oldState.clone();
- newState.commStatus = SUCCEEDED;
+ var newState;
+ if (AppSettings.isOptimisticCallHandlingEnabled) {
+ newState = oldState.wouldBeNextState();
+ } else {
+ newState = oldState.clone();
+ newState.commStatus = SUCCEEDED;
+ }
setCallState(newState);
}
diff --git a/WatchApp/source/BusinessLogic/ScheduleCallTask.mc b/WatchApp/source/BusinessLogic/ScheduleCallTask.mc
index 0b51ff9..32e6afa 100644
--- a/WatchApp/source/BusinessLogic/ScheduleCallTask.mc
+++ b/WatchApp/source/BusinessLogic/ScheduleCallTask.mc
@@ -30,8 +30,7 @@ class ScheduleCallTask extends Communications.ConnectionListener {
_3(L_SCHEDULE_CALL, "onComplete.callStateInvalidated", oldState);
return;
}
- var newState = oldState.clone();
- newState.commStatus = SUCCEEDED;
+ var newState = oldState.wouldBeNextState();
setCallState(newState);
}
diff --git a/WatchApp/source/CallStates/CallActing.mc b/WatchApp/source/CallStates/CallActing.mc
index 2182374..1fa1b04 100644
--- a/WatchApp/source/CallStates/CallActing.mc
+++ b/WatchApp/source/CallStates/CallActing.mc
@@ -11,6 +11,10 @@ class HangingUp extends CallActing {
return new HangingUp(phone, commStatus);
}
+ function wouldBeNextState() as CallState {
+ return new Idle();
+ }
+
function stateId() as Lang.String {
return "hangingUp";
}
@@ -26,6 +30,10 @@ class Declining extends CallActing {
return new Declining(phone, commStatus);
}
+ function wouldBeNextState() as CallState {
+ return new Idle();
+ }
+
function stateId() as Lang.String {
return "declining";
}
@@ -41,6 +49,10 @@ class Accepting extends CallActing {
return new Accepting(phone, commStatus);
}
+ function wouldBeNextState() as CallState {
+ return new CallInProgress(phone);
+ }
+
function stateId() as Lang.String {
return "accepting";
}
@@ -58,7 +70,11 @@ class CallActing extends CallStateImp {
}
function clone() as CallActing {
- return new CallActing(phone, commStatus);
+ System.error("CallActing.clone() must be overridden");
+ }
+
+ function wouldBeNextState() as CallState {
+ System.error("CallActing.wouldBeNextState() must be overridden");
}
function stateId() as Lang.String {
diff --git a/WatchApp/source/CallStates/SchedulingCall.mc b/WatchApp/source/CallStates/SchedulingCall.mc
index 8918ea4..48577c4 100644
--- a/WatchApp/source/CallStates/SchedulingCall.mc
+++ b/WatchApp/source/CallStates/SchedulingCall.mc
@@ -15,6 +15,10 @@ class SchedulingCall extends CallStateImp {
return new SchedulingCall(phone, commStatus);
}
+ function wouldBeNextState() as CallInProgress {
+ return new CallInProgress(phone);
+ }
+
function toString() as Lang.String {
return "SchedulingCall(" + phone + ", " + commStatus + ")";
}
diff --git a/WatchApp/source/Utilities/Settings.mc b/WatchApp/source/Utilities/Settings.mc
index 5b6479e..7aba306 100644
--- a/WatchApp/source/Utilities/Settings.mc
+++ b/WatchApp/source/Utilities/Settings.mc
@@ -17,6 +17,7 @@ module AppSettings {
const initialAttemptsToCheckin as Lang.Number = Application.Properties.getValue("syncAttempts") as Lang.Number;
const initialSecondsToCheckin as Lang.Number = Application.Properties.getValue("secondsToCheckIn") as Lang.Number;
const isSyncingCallStateOnCheckinEnabled as Lang.Boolean = Application.Properties.getValue("syncCallStateOnLaunch") as Lang.Boolean;
+ const isOptimisticCallHandlingEnabled as Lang.Boolean = Application.Properties.getValue("optimisticCallHandling") as Lang.Boolean;
const isExitToSystemAfterCallCompletionEnabled as Lang.Boolean = Application.Properties.getValue("popOutOfAppInsteadOfPhones") as Lang.Boolean;
const isBeepOnCommuncationEnabled as Lang.Boolean = Application.Properties.getValue("beepOnComm") as Lang.Boolean;