rosalina: autoclose menu on sleep mode/shell closed to prevent lockup

This commit is contained in:
TuxSH 2020-07-11 22:04:13 +01:00
parent 4c01bb453c
commit e3bb1c1b63
2 changed files with 16 additions and 7 deletions

View File

@ -140,6 +140,7 @@ static void handleSleepNotification(u32 notificationId)
switch (notificationId)
{
case PTMNOTIFID_SLEEP_REQUESTED:
menuShouldExit = true;
PTMSYSM_ReplyToSleepQuery(ROSALINA_PREVENT_DISCONNECT); // deny sleep request if we have network stuff running
break;
case PTMNOTIFID_GOING_TO_SLEEP:
@ -150,18 +151,26 @@ static void handleSleepNotification(u32 notificationId)
break;
case PTMNOTIFID_SLEEP_DENIED:
case PTMNOTIFID_FULLY_AWAKE:
menuShouldExit = false;
break;
default:
break;
}
ptmSysmExit();
}
static void handleShellOpenedNotification(u32 notificationId)
static void handleShellNotification(u32 notificationId)
{
(void)notificationId;
if (notificationId == 0x213) {
// Shell opened
// Note that this notification is fired on system init
ScreenFiltersMenu_RestoreCct();
menuShouldExit = false;
} else {
// Shell closed
menuShouldExit = true;
}
// Note that this is called on system init
ScreenFiltersMenu_RestoreCct();
}
static void handlePreTermNotification(u32 notificationId)
@ -221,7 +230,8 @@ static const ServiceManagerNotificationEntry notifications[] = {
{ PTMNOTIFID_FULLY_WAKING_UP, handleSleepNotification },
{ PTMNOTIFID_FULLY_AWAKE, handleSleepNotification },
{ PTMNOTIFID_HALF_AWAKE, handleSleepNotification },
{ 0x213, handleShellOpenedNotification },
{ 0x213, handleShellNotification },
{ 0x214, handleShellNotification },
{ 0x1000, handleNextApplicationDebuggedByForce },
{ 0x2000, handlePreTermNotification },
{ 0x3000, handleRestartHbAppNotification },

View File

@ -188,6 +188,7 @@ void menuThreadMain(void)
while(!preTerminationRequested)
{
svcSleepThread(50 * 1000 * 1000LL);
if (menuShouldExit)
continue;
@ -200,8 +201,6 @@ void menuThreadMain(void)
menuShow(&rosalinaMenu);
menuLeave();
}
svcSleepThread(50 * 1000 * 1000LL);
}
}