Built android(7.1.2) for Jetson TK1, android boots to safe mode and displays the lock screen(at times only a black screen with safe mode at the left corner appears), input devices (Mouse and Keyboard) aren't working. It also keeps rebooting on its own. Have read about the strictly enforced verified boot in nougat, but have no idea how to go about debugging the cause for safe mode.
The Log information that shows SAFE MODE 01-01 00:05:40.481: I/WindowManager(592): SAFE MODE ENABLED (menu=0 s=0 dpad=-1 trackball=-1)
It comes from the WindowManager, I tried reading the sources in frameworks directory, but didn't quite understand how things work.
How should one figure out the cause for safe mode, is it due to security issues in kernel or the android part (Sepolicy etc)? There are couple of errors in the log, should I correct all the errors, does it solve the safeboot problem?
Logs SERIAL LOG: https://pastebin.com/LxgUsegh
Here is serial log for it
LOGCAT : https://pastebin.com/rJP4Z2nD
Here is the LOGCAT for the same
After removing few telephone related packages, consistently android boots to lock screen with wallpaper( no black screen) and interestingly the mouse worked but within few seconds the system hangs. Now only I realise it boots and hangs in lock screen, then continues to reboot, still only in safe mode.
When does android freeze ? Android specific reasons for hang?
Finally solved the safe mode problem, it was enabled as android has sensed the volume down state as high, this state is one of conditions which determines if safemode is set, though there is no volume buttons in the board somehow the code reads it as high. Anyways the system hangs in lock-screen and keeps rebooting.
SOURCE CODE
WindowMangerService.java
mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0 || volumeDownState > 0;
Just removed the volume down condition.
Any ideas on why android freezes in lock-screen everytime it boots ?
System Hang solution:
Solved the system hang, the issue was related to SDHCI controller, had to make some changes in the kernel. Simply followed the instructions in this link
Now have a working android Nougat in jetson-tk1. :)