@@ -257,12 +257,16 @@ void SystemTask::Work() {
257
257
settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) ||
258
258
(gesture == Pinetime::Applications::TouchEvents::Tap &&
259
259
settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::SingleTap)))) {
260
+ ignoreNextTouchEvent = true ;
261
+ wokenBy = WokenBy::WakeUpAction;
260
262
GoToRunning ();
261
263
}
262
264
}
263
265
break ;
264
266
}
265
267
case Messages::GoToSleep:
268
+ ignoreTouchPopupHidden = true ;
269
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
266
270
if (doNotGoToSleep) {
267
271
break ;
268
272
}
@@ -341,18 +345,40 @@ void SystemTask::Work() {
341
345
// TODO add intent of fs access icon or something
342
346
break ;
343
347
case Messages::OnTouchEvent:
344
- if (touchHandler.GetNewTouchInfo ()) {
345
- touchHandler.UpdateLvglTouchPoint ();
348
+ // if the watch was just woken by touch and button must be used to unlock, ignore the first touch event which
349
+ // is the touch event that woke the watch. Otherwise the lock-popup will be displayed
350
+ if (settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks) && ignoreNextTouchEvent) {
351
+ ignoreNextTouchEvent = false ;
352
+
353
+ // Ignore touchevents if ButtonUnlocks setting is active and the watch was woken with wakeup actions (touch etc)
354
+ } else if (!settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::ButtonUnlocks) ||
355
+ wokenBy != WokenBy::WakeUpAction) {
356
+ if (touchHandler.GetNewTouchInfo ()) {
357
+ touchHandler.UpdateLvglTouchPoint ();
358
+ }
359
+ ReloadIdleTimer ();
360
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
361
+ // if we get to here TouchEvents is allowed and the "ButtonUnlocks" requirement can be overridden
362
+ wokenBy = WokenBy::Other;
363
+ } else {
364
+ ignoreTouchPopupHidden = false ;
365
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::ShowIgnoreTouchPopup);
346
366
}
347
- ReloadIdleTimer ();
348
- displayApp.PushMessage (Pinetime::Applications::Display::Messages::TouchEvent);
349
367
break ;
350
368
case Messages::HandleButtonEvent: {
369
+ // if the IgnoreTouchPopup is active the first button event unlocks the device
370
+ if (!ignoreTouchPopupHidden) {
371
+ wokenBy = WokenBy::Button ;
372
+ ignoreTouchPopupHidden = true ;
373
+ displayApp.PushMessage (Pinetime::Applications::Display::Messages::HideIgnoreTouchPopup);
374
+ break ;
375
+ }
351
376
Controllers::ButtonActions action;
352
377
if (nrf_gpio_pin_read (Pinetime::PinMap::Button ) == 0 ) {
353
378
action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Release);
354
379
} else {
355
380
action = buttonHandler.HandleEvent (Controllers::ButtonHandler::Events::Press);
381
+ wokenBy = WokenBy::Button ;
356
382
// This is for faster wakeup, sacrificing special longpress and doubleclick handling while sleeping
357
383
if (IsSleeping ()) {
358
384
fastWakeUpDone = true ;
@@ -381,6 +407,7 @@ void SystemTask::Work() {
381
407
}
382
408
383
409
state = SystemTaskState::Sleeping;
410
+ wokenBy = WokenBy::Other;
384
411
break ;
385
412
case Messages::OnNewDay:
386
413
// We might be sleeping (with TWI device disabled.
@@ -491,6 +518,7 @@ void SystemTask::UpdateMotion() {
491
518
motionController.Should_RaiseWake (state == SystemTaskState::Sleeping)) ||
492
519
(settingsController.isWakeUpModeOn (Pinetime::Controllers::Settings::WakeUpMode::Shake) &&
493
520
motionController.Should_ShakeWake (settingsController.GetShakeThreshold ()))) {
521
+ wokenBy = WokenBy::WakeUpAction;
494
522
GoToRunning ();
495
523
}
496
524
}
0 commit comments