cm-12.1: SystemServer continuosly crashing

Search This thread
Hello, I'm trying to port CyanogenMod 12.1 to my SM-G361F. I have noticed that after the "Android is starting..." screen, when the device is supposed to show the "Welcome" screen, it instead crashes and goes back to the boot animation, while spamming these fatal error logs into logcat:

Code:
--------- beginning of system
F/SystemServer( 2972): BOOT FAILURE making Power Manager Service ready
F/SystemServer( 2972): java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
F/SystemServer( 2972):     at com.android.server.display.DisplayPowerController.createAutoBrightnessSpline(DisplayPowerController.java:1155)
F/SystemServer( 2972):     at com.android.server.display.DisplayPowerController.<init>(DisplayPowerController.java:332)
F/SystemServer( 2972):     at com.android.server.display.DisplayManagerService$LocalService.initPowerManagement(DisplayManagerService.java:1494)
F/SystemServer( 2972):     at com.android.server.power.PowerManagerService.systemReady(PowerManagerService.java:586)
F/SystemServer( 2972):     at com.android.server.SystemServer.startOtherServices(SystemServer.java:1168)
F/SystemServer( 2972):     at com.android.server.SystemServer.run(SystemServer.java:285)
F/SystemServer( 2972):     at com.android.server.SystemServer.main(SystemServer.java:186)
F/SystemServer( 2972):     at java.lang.reflect.Method.invoke(Native Method)
F/SystemServer( 2972):     at java.lang.reflect.Method.invoke(Method.java:372)
F/SystemServer( 2972):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
F/SystemServer( 2972):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)
F/SystemServer( 2972): BOOT FAILURE making Display Manager Service ready
F/SystemServer( 2972): java.lang.NullPointerException: Attempt to invoke virtual method 'void com.android.server.display.DisplayPowerController.systemReady()' on a null object reference
F/SystemServer( 2972):     at com.android.server.display.DisplayManagerService.systemReady(DisplayManagerService.java:282)
F/SystemServer( 2972):     at com.android.server.SystemServer.startOtherServices(SystemServer.java:1181)
F/SystemServer( 2972):     at com.android.server.SystemServer.run(SystemServer.java:285)
F/SystemServer( 2972):     at com.android.server.SystemServer.main(SystemServer.java:186)
F/SystemServer( 2972):     at java.lang.reflect.Method.invoke(Native Method)
F/SystemServer( 2972):     at java.lang.reflect.Method.invoke(Method.java:372)
F/SystemServer( 2972):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:904)
F/SystemServer( 2972):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)

Some of these happened before the "Starting Android" screen, but after said screen the errors constantly repeat and the device goes back to the boot animation. After a bit it will show the "Android is starting..." screen again, after which it crashes and goes to the boot animation screen again, except this time the following gets printed to logcat:

Code:
F/ContextImpl(13866): Failed to get power manager service.

This cycle repeats until the phone is shut down.

Thanks in advance for all help.
 
Hi, I know it's quite late but I have been able to fix it, the error happens because of some hardware backlight related setting in some device overlay XML, specifically some array missing there. Unfortunately I can't seem to find the commit I made which fixed that, but you should be able to figure out the exact name of the property easily by reading the corresponding AOSP source (see log for exact file and line).