summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpr.jung <pr.jung@samsung.com>2016-10-25 11:30:01 +0900
committerJung <pr.jung@samsung.com>2016-10-26 23:36:48 -0700
commit54590386c6feb9d939bbd12a1548dcc9f33fb35d (patch)
tree0d6d7eb36c7de10c6ac74533b14ef14a692549c1
parentd21d271d29ce617c9a7326d3f5e8e51f2073bc8e (diff)
downloadlibsvi-54590386c6feb9d939bbd12a1548dcc9f33fb35d.tar.gz
libsvi-54590386c6feb9d939bbd12a1548dcc9f33fb35d.tar.bz2
libsvi-54590386c6feb9d939bbd12a1548dcc9f33fb35d.zip
Modify and reorganize feedback scenario for wearable
- is_notification_type - get_always_alert_case - get_always_off_case - get_strength_type Change-Id: I21dfa693769d06de62e3e00b683b44e55571b0b5 Signed-off-by: pr.jung <pr.jung@samsung.com>
-rw-r--r--wearable/src/check.c195
1 files changed, 124 insertions, 71 deletions
diff --git a/wearable/src/check.c b/wearable/src/check.c
index 141d686..e7901c6 100644
--- a/wearable/src/check.c
+++ b/wearable/src/check.c
@@ -243,51 +243,87 @@ static bool wearable_get_switched_pattern(int pattern, int *switched)
return true;
}
-static bool wearable_get_always_alert_case(int type, int pattern)
+static bool wearable_is_notification_type(int pattern)
{
- switch (pattern) {
- case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
- case FEEDBACK_PATTERN_HOLD:
- if (CHECK_VIBRATION(type) && feedbackstatus)
- return true;
- break;
- case FEEDBACK_PATTERN_SIP:
- if (CHECK_VIBRATION(type))
- return true;
- break;
- case FEEDBACK_PATTERN_MESSAGE:
- case FEEDBACK_PATTERN_EMAIL:
- if (CHECK_VIBRATION(type) && noti_vibstatus)
- return true;
- break;
- case FEEDBACK_PATTERN_TIMER:
- case FEEDBACK_PATTERN_TIMER_ON_CALL:
- if (CHECK_VIBRATION(type))
- return true;
- break;
+ switch(pattern) {
case FEEDBACK_PATTERN_WAKEUP:
case FEEDBACK_PATTERN_WAKEUP_ON_CALL:
+ case FEEDBACK_PATTERN_TIMER:
+ case FEEDBACK_PATTERN_TIMER_ON_CALL:
+ return false;
+ case FEEDBACK_PATTERN_MESSAGE ... FEEDBACK_PATTERN_EMAIL_ON_CALL:
+ case FEEDBACK_PATTERN_SCHEDULE:
+ case FEEDBACK_PATTERN_SCHEDULE_ON_CALL:
+ case FEEDBACK_PATTERN_GENERAL ... FEEDBACK_PATTERN_LOWBATT_ON_CALL:
return true;
- case FEEDBACK_PATTERN_MESSAGE_ON_CALL:
- case FEEDBACK_PATTERN_EMAIL_ON_CALL:
- case FEEDBACK_PATTERN_GENERAL_ON_CALL:
- break;
- case FEEDBACK_PATTERN_CHARGERCONN_ON_CALL:
- case FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL:
- case FEEDBACK_PATTERN_LOWBATT_ON_CALL:
- /* no matter sound profile */
- if (CHECK_VIBRATION(type))
- return true;
- break;
- case FEEDBACK_PATTERN_SEND_SOS_MESSAGE:
- case FEEDBACK_PATTERN_OUTGOING_CALL:
+ }
+ return false;
+}
+
+static bool wearable_is_system_type(int pattern)
+{
+ switch(pattern) {
+ case FEEDBACK_PATTERN_POWERON ... FEEDBACK_PATTERN_VOLUME_KEY:
return true;
- case FEEDBACK_PATTERN_SCREEN_CAPTURE:
- if (CHECK_SOUND(type) && camerastatus && shutter_sndstatus)
+ }
+ return false;
+}
+
+static bool wearable_get_always_alert_case(int type, int pattern)
+{
+ if (CHECK_SOUND(type)) {
+ switch (pattern) {
+ case FEEDBACK_PATTERN_WAKEUP:
+ case FEEDBACK_PATTERN_WAKEUP_ON_CALL:
+ return true;
+ case FEEDBACK_PATTERN_MESSAGE_ON_CALL:
+ case FEEDBACK_PATTERN_EMAIL_ON_CALL:
+ case FEEDBACK_PATTERN_GENERAL_ON_CALL:
+ break;
+ case FEEDBACK_PATTERN_SEND_SOS_MESSAGE:
+ return true;
+ case FEEDBACK_PATTERN_SCREEN_CAPTURE:
+ if (camerastatus && shutter_sndstatus)
+ return true;
+ break;
+ case FEEDBACK_PATTERN_OUTGOING_CALL:
+ return true;
+ default:
+ break;
+ }
+ } else if (CHECK_VIBRATION(type)) {
+ switch (pattern) {
+ case FEEDBACK_PATTERN_TAP:
+ case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+ case FEEDBACK_PATTERN_HOLD:
+ if (feedbackstatus)
+ return true;
+ break;
+ case FEEDBACK_PATTERN_MESSAGE:
+ case FEEDBACK_PATTERN_EMAIL:
+ case FEEDBACK_PATTERN_GENERAL:
+ case FEEDBACK_PATTERN_SCHEDULE:
+ if (noti_vibstatus)
+ return true;
+ break;
+ case FEEDBACK_PATTERN_SIP:
+ case FEEDBACK_PATTERN_TIMER:
+ case FEEDBACK_PATTERN_TIMER_ON_CALL:
+ case FEEDBACK_PATTERN_WAKEUP:
+ case FEEDBACK_PATTERN_WAKEUP_ON_CALL:
+ case FEEDBACK_PATTERN_MESSAGE_ON_CALL:
+ case FEEDBACK_PATTERN_EMAIL_ON_CALL:
+ case FEEDBACK_PATTERN_GENERAL_ON_CALL:
+ case FEEDBACK_PATTERN_CHARGERCONN_ON_CALL:
+ case FEEDBACK_PATTERN_CHARGING_ERROR_ON_CALL:
+ case FEEDBACK_PATTERN_LOWBATT_ON_CALL:
+ case FEEDBACK_PATTERN_BT_DISCONNECTED:
+ case FEEDBACK_PATTERN_SEND_SOS_MESSAGE:
+ case FEEDBACK_PATTERN_OUTGOING_CALL:
return true;
- break;
- default:
- break;
+ default:
+ break;
+ }
}
return false;
}
@@ -296,31 +332,43 @@ static bool wearable_get_always_off_case(int type, int pattern)
{
int ret;
- /* check if the state of voice recorder is recording */
- if (vconf_get_int(VCONFKEY_RECORDER_STATE, &ret) < 0) {
- _W("fail to get media sound status, status will be zero");
- ret = 0;
- }
-
- if (CHECK_SOUND(type) && ret == VCONFKEY_RECORDER_STATE_RECORDING) {
- _D("voice recording status is RECORDING");
- return true;
- }
-
- switch (pattern) {
- case FEEDBACK_PATTERN_TAP ... FEEDBACK_PATTERN_SIP:
- case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD:
- if (CHECK_SOUND(type) && !is_touch_sndstatus())
- return true;
- break;
- case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
- if (CHECK_SOUND(type) && !is_keytone_sndstatus())
+ if (CHECK_SOUND(type)) {
+ if ((wearable_is_notification_type(pattern) || wearable_is_system_type(pattern)) &&
+ callstatus) {
+ _W("skip %s sound during call", wearable_str_pattern[pattern]);
return true;
- else if (CHECK_VIBRATION(type) && !feedbackstatus)
+ }
+ /* check if the state of voice recorder is recording */
+ if (vconf_get_int(VCONFKEY_RECORDER_STATE, &ret) == 0 &&
+ ret == VCONFKEY_RECORDER_STATE_RECORDING) {
+ _D("voice recording status is RECORDING");
return true;
- break;
- default:
- break;
+ }
+
+ switch (pattern) {
+ case FEEDBACK_PATTERN_TAP:
+ case FEEDBACK_PATTERN_HOLD ... FEEDBACK_PATTERN_HW_HOLD:
+ if (!is_touch_sndstatus())
+ return true;
+ break;
+ case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+ if (!is_keytone_sndstatus())
+ return true;
+ break;
+ default:
+ break;
+ }
+ } else if (CHECK_VIBRATION(type)) {
+ switch (pattern) {
+ case FEEDBACK_PATTERN_TAP:
+ case FEEDBACK_PATTERN_KEY0 ... FEEDBACK_PATTERN_KEY_BACK:
+ case FEEDBACK_PATTERN_HOLD:
+ if (!feedbackstatus)
+ return true;
+ break;
+ default:
+ break;
+ }
}
return false;
}
@@ -332,20 +380,24 @@ static int wearable_get_strength_type(int type, int pattern)
return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_TOUCH;
else if (pattern >= FEEDBACK_PATTERN_KEY0 && pattern <= FEEDBACK_PATTERN_KEY_BACK)
return VOLUME_TYPE_SYSTEM|VOLUME_GAIN_DIALER;
- else if (pattern == FEEDBACK_PATTERN_VOLUME_KEY)
+ else if (pattern == FEEDBACK_PATTERN_VOLUME_KEY || pattern == FEEDBACK_PATTERN_SILENT_OFF)
return VOLUME_TYPE_RINGTONE;
else if (camerastatus && shutter_sndstatus && pattern == FEEDBACK_PATTERN_SCREEN_CAPTURE)
return VOLUME_TYPE_FIXED;
- else
- return VOLUME_TYPE_SYSTEM;
+ return VOLUME_TYPE_SYSTEM;
} else if (CHECK_VIBRATION(type)) {
- if (pattern >= FEEDBACK_PATTERN_MESSAGE &&
- pattern <= FEEDBACK_PATTERN_GENERAL)
- return noti_level * HAPTIC_FEEDBACK_STEP;
- else
- return vib_level * HAPTIC_FEEDBACK_STEP;
+ if (pattern >= FEEDBACK_PATTERN_TAP && pattern <= FEEDBACK_PATTERN_HW_HOLD) {
+ _D("use default level");
+ return DEFAULT_VIB_LEVEL * HAPTIC_FEEDBACK_STEP;
+ }
+ /* if call status is ON, vibration magnitude is 20% */
+ if (pattern != FEEDBACK_PATTERN_RINGER &&
+ (callstatus == VCONFKEY_CALL_VOICE_ACTIVE || callstatus == VCONFKEY_CALL_VIDEO_ACTIVE)) {
+ _W("force change weak level");
+ return HAPTIC_FEEDBACK_STEP;
+ }
+ return noti_level * HAPTIC_FEEDBACK_STEP;
}
-
return -EINVAL;
}
@@ -357,6 +409,7 @@ static const struct profile_ops wearable_profile_ops = {
.get_always_alert_case = wearable_get_always_alert_case,
.get_always_off_case = wearable_get_always_off_case,
.get_strength_type = wearable_get_strength_type,
+ .is_notification_type = wearable_is_notification_type,
.max_type = FEEDBACK_TYPE_END,
.max_pattern = FEEDBACK_PATTERN_INTERNAL_END,
.str_type = wearable_str_type,