/* Doubletap2wake main function */
static void detect_doubletap2wake(int x, int y, bool st)
{
        bool single_touch = st;
#if DT2W_DEBUG
        pr_info(LOGTAG"x,y(%4d,%4d) single:%s\n",
                x, y, (single_touch) ? "true" : "false");
#endif
	if ((single_touch) && (dt2w_switch > 0) && (exec_count) && (touch_cnt)) {
		touch_cnt = false;
		if (touch_nr == 0) {
			new_touch(x, y);
		} else if (touch_nr == 1) {
			if ((calc_feather(x, x_pre) < DT2W_FEATHER) &&
			    (calc_feather(y, y_pre) < DT2W_FEATHER) &&
			    ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2W_TIME))
				touch_nr++;
			else {
				doubletap2wake_reset();
				new_touch(x, y);
			}
		} else {
			doubletap2wake_reset();
			new_touch(x, y);
		}
		if ((touch_nr > 1)) {
			pr_info(LOGTAG"ON\n");
			exec_count = false;
			doubletap2wake_pwrtrigger();
			doubletap2wake_reset();
		}
	}
}
Beispiel #2
0
/* Doubletap2wake main function */
static void detect_doubletap2wake(int x, int y, bool st)
{
	if (flg_power_suspended) {
		// the screen is off.
		
		if ((!flg_tw_expired && sttg_tw_timeout > 0 && do_timesince(time_power_suspended) < sttg_tw_timeout) || sttg_tw_timeout == 0) {
			
        bool single_touch = st;
#if WG_DEBUG
        pr_debug(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n",
                x, y, tap_time_pre);
#endif
			if (x < SWEEP_EDGE || x > SWEEP_X_LIMIT)
		       		return;
			if (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT)
		       		return;

			if ((single_touch) && (dt2w_switch == 1) && (exec_count) && (touch_cnt)) {
				touch_cnt = false;
				if (touch_nr == 0) {
					new_touch(x, y);
				} else if (touch_nr == 1) {
					if ((calc_feather(x, x_pre) < DT2W_FEATHER) &&
					    (calc_feather(y, y_pre) < DT2W_FEATHER) &&
					    ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2W_TIME))
						touch_nr++;
					else {
						doubletap2wake_reset();
						new_touch(x, y);
					}
				} else {
					doubletap2wake_reset();
					new_touch(x, y);
				}
				if ((touch_nr > 1)) {
					pr_debug(LOGTAG"double tap\n");
					exec_count = false;
		#if (WAKE_GESTURES_ENABLED)
					if (gestures_switch) {
						report_gesture(5);
					} else {
		#endif
						wake_pwrtrigger();
		#if (WAKE_GESTURES_ENABLED)
					}
		#endif
					doubletap2wake_reset();
				}
			}
		}
	}
}
Beispiel #3
0
static void detect_doubletap2sleep(int x, int y, bool st)
{
        bool single_touch = st;
#if WG_DEBUG
        pr_debug(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n",
                x, y, tap_time_pre);
#endif
	
	if (!flg_power_suspended && x > dt2s_x)
   		return;	
	if (!flg_power_suspended && y > dt2s_y)
   		return;	

   	if (single_touch && dt2s_switch == 1 && !flg_power_suspended && exec_count && touch_cnt) {
		touch_cnt = false;
		if (touch_nr == 0) {
			new_touch(x, y);
		} else if (touch_nr == 1) {
			if ((calc_feather(x, x_pre) < DT2S_FEATHER) &&
			    (calc_feather(y, y_pre) < DT2S_FEATHER) &&
			    ((ktime_to_ms(ktime_get())-tap_time_pre) < DT2S_TIME))
				touch_nr++;
			else {
				doubletap2wake_reset();
				new_touch(x, y);
			}
		} else {
			doubletap2wake_reset();
			new_touch(x, y);
		}
		if ((touch_nr > 1)) {
			pr_debug(LOGTAG"double tap\n");
			exec_count = false;
#if (WAKE_GESTURES_ENABLED)
			if (gestures_switch) {
				report_gesture(6);
			} else {
#endif
				wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
			}
#endif
			doubletap2wake_reset();
		}
	}
}
/* Doubletap2wake main function */
static void detect_doubletap2wake(int x, int y, bool st)
{
        bool single_touch = st;
#if WG_DEBUG
        pr_info(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n",
                x, y, tap_time_pre);
#endif
	if (x < SWEEP_EDGE || x > SWEEP_X_LIMIT)
       		return;
	if (y < SWEEP_EDGE || y > SWEEP_Y_LIMIT)
       		return;

	if ((single_touch) && (dt2w_switch) && (exec_count) && (touch_cnt)) {
		touch_cnt = false;
		if (touch_nr == 0) {
			new_touch(x, y);
		} else if (touch_nr == 1) {
			if ((calc_feather(x, x_pre) < DT2W_FEATHER) &&
			    (calc_feather(y, y_pre) < DT2W_FEATHER) &&
			    ((jiffies-tap_time_pre) < DT2W_TIME))
				touch_nr++;
			else {
				doubletap2wake_reset();
				new_touch(x, y);
			}
		} else {
			doubletap2wake_reset();
			new_touch(x, y);
		}
		if ((touch_nr > 1)) {
			pr_info(LOGTAG"double tap\n");
			exec_count = false;
#if (WAKE_GESTURES_ENABLED)
			if (gestures_switch) {
				report_gesture(5);
			} else {
#endif
				wake_pwrtrigger();
#if (WAKE_GESTURES_ENABLED)
			}
#endif
			doubletap2wake_reset();
		}
	}
}
/* Doubletap2wake main function */
static void detect_doubletap2wake(int x, int y, bool st)
{
        bool single_touch = st;
#if DT2W_DEBUG
        pr_info(LOGTAG"x,y(%4d,%4d) tap_time_pre:%llu\n",
                x, y, tap_time_pre);
#endif
	if (x < 100 || x > 980)
        	return;

	if (dt2w_switch < 2 && y < 1000)
        	return;

	if ((single_touch) && (dt2w_switch > 0) && (exec_count) && (touch_cnt)) {
		touch_cnt = false;
		if (touch_nr == 0) {
			new_touch(x, y);
		} else if (touch_nr == 1) {
			if ((calc_feather(x, x_pre) < DT2W_FEATHER) &&
			    (calc_feather(y, y_pre) < DT2W_FEATHER) &&
			    ((jiffies-tap_time_pre) < DT2W_TIME))
				touch_nr++;
			else {
				doubletap2wake_reset();
				new_touch(x, y);
			}
		} else {
			doubletap2wake_reset();
			new_touch(x, y);
		}
		if ((touch_nr > 1)) {
			pr_info(LOGTAG"double tap\n");
			exec_count = false;
			set_vibrate(vib_strength);
			if (gestures_switch) {
				report_gesture(5);
			} else {
				doubletap2wake_pwrtrigger();
			}
			doubletap2wake_reset();
		}
	}
}
/* Doubletap2wake main function */
static void detect_doubletap2wake(int x, int y)
{
#if DT2W_DEBUG
        pr_info(LOGTAG"x,y(%4d,%4d)\n", x, y);
#endif

	if (!scr_suspended)
		return;

	if ((!is_touching) && (!is_screen_on)) {
		is_touching = true;

		// Make enable to set touch counts (Max : 10) - by jollaman999
		if (touch_nr == 0) {
			new_touch(x, y);
			// dt2w: 'touch_nr++' when 'msm_pm_enter' called - by jollaman999
			if (dt2w_msm_pm_enter)
				touch_nr++;
		// Make enable to set touch counts (Max : 10) - by jollaman999
		} else if (touch_nr >= 1 && touch_nr <= dt2w_switch) {
			if (((calc_feather(x, x_pre) < DT2W_FEATHER) || (calc_feather(y, y_pre) < DT2W_FEATHER))
			    // Make enable to set touch counts (Max : 10) - by jollaman999
			    && ((ktime_to_ms(ktime_get()) - tap_time_pre) < (DT2W_TIME/2*(dt2w_switch+1)))) {
				touch_nr++;
			} else {
				doubletap2wake_reset();
				new_touch(x, y);
			}
		} else {
			doubletap2wake_reset();
			new_touch(x, y);
		}
		// Make enable to set touch counts (Max : 10) - by jollaman999
		if ((touch_nr > dt2w_switch)) {
			pr_info(LOGTAG"ON\n");
			is_screen_on = true;
			doubletap2wake_pwrtrigger();
			doubletap2wake_reset();
		}
	}
}