2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Display an alert in Android GUI if possible
9 #include <aros/atomic.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
16 #include "kernel_base.h"
17 #include "kernel_debug.h"
18 #include "kernel_intern.h"
19 #include "kernel_unix.h"
20 #include "kernel_android.h"
24 AROS_LH2(void, KrnDisplayAlert
,
25 AROS_LHA(uint32_t, code
, D0
),
26 AROS_LHA(const char *, text
, A0
),
27 struct KernelBase
*, KernelBase
, 35, Kernel
)
31 struct KernelInterface
*KernelIFace
= KernelBase
->kb_PlatformData
->iface
;
36 * These two are inlined in Android.
37 * Enable also SIGTERM - what if AROS will want to kill us...
40 sigaddset(&sigs
, SIGUSR2
);
41 sigaddset(&sigs
, SIGTERM
);
44 /* Halt the system in order not to interfere with our I/O */
47 /* Send alert message to the display server */
48 if (!SendAlert(code
, text
))
50 /* Standard pipe break reaction, see display driver code */
51 ShutdownA(SD_ACTION_POWEROFF
);
54 D(bug("[KrnDisplayAlert] Request sent, halting...\n"));
58 /* This is early alert, KernelBase is incomplete, and the condition is not recoverable. */
59 ShutdownA(SD_ACTION_POWEROFF
);
63 * Wait for SIGUSR2. Java side will deliver it to us after the alert was closed.
64 * Normally it's used for KrnCause(), and in order not to execute scheduler and
65 * SoftInts, we artificially raise our virtual privilege level.
67 AROS_ATOMIC_INC(UKB(KernelBase
)->SupervisorCount
);
68 KernelIFace
->sigwait(&sigs
, &res
);
69 AROS_ATOMIC_DEC(UKB(KernelBase
)->SupervisorCount
);
71 D(bug("[KrnDisplayAlert] Resume execution\n"));