How to capture/log Android phone reboot cause

20,052 views
Skip to first unread message

Jitesh dedhiya

unread,
Jun 10, 2014, 2:19:18 AM6/10/14
to android-...@googlegroups.com, android-d...@googlegroups.com
Hi All,

While developing my android custom ROM, I need to know that - is there
a way to log or capture the cause of android reboot, whether user
manually powered off / rebooted the devices or wether system_server
got restarted by adb kill or it was watchdog who restarted the device.



Help Appreciated !
Thanks


--
--Jitesh .V. Dedhiya---

Don't Learn To Hack but Hack To Learn

shridutt kothari

unread,
Jun 10, 2014, 6:11:40 AM6/10/14
to android-...@googlegroups.com, android-d...@googlegroups.com
Hi Jitesh,

For any Reboot or Shutdown or restart of system_server ShutdownThread is invoked, which contains reason for shutdown or reboot so you can get the reason from there and do anything with it, i.e. log it or write it to file etc.

see rebootReason and methods of ShutdownThread, for each reboot or shutdown run() method of ShutdownThread is internally invoked which internally calls rebootOrShutDown() method (which should not be called from anywhere else also).

Thanks,
Shridutt Kothari
Impetus Infotech India Ltd.

Ron Munitz

unread,
Jun 10, 2014, 10:05:05 AM6/10/14
to android-platform

Logcat should get you through.
So do the trace file and the tombstone file.

adb kill-server has nothing to do with it.
If you kill something from the shell,  it depends on the signal type.

You will find all "watchdog" related events in the log,  and if you customize your own ROM, and want to ease the finding of those events, you can add a single line to the zygotte block of your init.rc

-Ron Munitz

> --
> You received this message because you are subscribed to the Google Groups "android-platform" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
> To post to this group, send email to android-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/android-platform.
> For more options, visit https://groups.google.com/d/optout.

Abdul Haseeb

unread,
Jun 11, 2014, 1:44:05 PM6/11/14
to android-...@googlegroups.com

adb shell cat /proc/last_kmsg  should give you the messages that gets missed from adb .
You can monitor the serial console logs too.

From logcat you can look in Shutdown Thread for reboot reason, if its soft/hard reboot.

If reboot is due to crash you can rely on pstore/last_kmsg/serial logs.

Hope that helps.

Hieu Dinh Van

unread,
Jul 1, 2014, 11:42:39 AM7/1/14
to android-...@googlegroups.com, android-d...@googlegroups.com


Vào 13:19:18 UTC+7 Thứ ba, ngày 10 tháng sáu năm 2014, Dev Droid đã viết:
Hi
You need read comment from Christopher Tage.
I think you can found cause of auto reboot.
Good luck.

Balaji BABU T.R.

unread,
Mar 26, 2015, 10:29:10 AM3/26/15
to android-...@googlegroups.com, android-d...@googlegroups.com
Hi Jitesh,

Below procedure

1) cat /proc/kmsg
2) dmesg
3) data /dontpanic
4) In windows PC using Teraterm or Linux pc using Minicom --> for checking the kernel log..

Regards

Balaji Babu
Reply all
Reply to author
Forward
0 new messages