My Nexus 6 turns itself off randomly; How can I fix this? TL;DR: Nexus 6 shuts itself off randomly, seems to be connected to the camera, wifi, and cellular. Internet is full of placebo solutions and "me-too" posts. Logcat output below.



I've been having this problem for months now, but it wasn't there when the phone was new. Here's what happens.


I will be on a phone call, using a headset, and when I open the camera app, WhatsApp, or - sometimes - when I'm doing nothing at all, the phone will just shut itself off instantly.
Sometimes it'll shut itself off when I leave the house and look for a Car on DriveNow. My house has Edge coverage, my street has LTE.
A few times the phone would shut off again after I've switched it back on. This can happen a few times in a row. Waiting before I do anything after switching it back on seems to help. 


Note:


I am nearly always on a phone call when this happens.
I think the display is always on when it turns itself off.


Searching the internet, I have found tons and tons of complains of the same or similar problems, and I've been reading the Google product forums, with hundreds of me-too type posts and placebo solutions.

People will claim that uninstalling an app I and the other posters have never heard of fixed the problem for them. Some claim what wiping the phone will help, others say that that doesn't work.

The problem occurs very sporadically. It's very hard to find out whether doing anything has fixed it or not.

This is what I've tried so far:


I've uninstalled all apps I can live without. Making sure I only use apps that I have been using when the thing was working properly.
I've deleted the cache partition (one of these placebo solutions)


I would try a factory reset, but the data inside of WhatsApp is extremely important to me and I don't have a spare phone to load my WhatsApp backup before wiping the Nexus 6 (you need your SIM for WhatsApp to work, so the emulator doesn't help me). I don't want to bring the phone back to the store or send it to Motorola for the same reason. If I can help it at all.

For the last two days, I've been keeping my phone connected to my computer with a shell open and watching the output of logcat, and a few minutes ago it did indeed shut itself of with the shell connected. Here's the logcat output from shortly before the crash

I wouldn't be posting this Question, I'd just live with it until I get a spare phone and send the Nexus 6 in for repair, except for the fact that I now have the output from logcat, and that might make sense to someone here.


The phone is running Android 5.1.1 (LMY47Z LMY48I)
I have a german T-Mobile SIM
Here's a list of apps I have installed


Update

I did a factory reset. It went fine. :) Of course I have no idea whether that fixed it or not.

Update the second

It didn't :-(

The problem also happens (just happened) in safe mode.

Update the third

It also happens on the Android M developer preview. I've since bought a Moto E (lovely) and I will send the Nexus 6 in for repair. Hoping I won't get it back with a message saying there's no fault.
This is a partial answer based on the output of logs provided.

Okay, after looking at the logcat, my guess would be a buffer overrun error originating/stemming from mm-camera and connected services/processes and ion memory allocation.

Snippets, 

08-11 17:51:19.504 E/libaprpmem( 1539):  Ion allocation success virtaddr : ret=2996989952 fd=48 heapid=33554432
08-11 17:51:19.507 E/libaprpmem( 1539):

08-11 17:51:19.332 E/mm-camera( 1539): mct_stream_destroy_buffers: Exit

08-11 17:51:19.337 E/mm-camera-isp2( 1539): isp_port_check_caps_unreserve:807 ide 3000f port 0xb6749d60
08-11 17:51:19.337 E/mm-camera-isp2( 1539): isp_handler_destroy_stream_param:1616 num_streams 0


Okay so don't be ready to quote me on that but dig this article discussing buffer underrun/overrun http://www.articlesfactory.com/articles/computers/buffer-underrun-and-overrun-scenarios.html

I can't pin it to a specific specific cause but try setting your camera resolution to as low a setting that you can get it, and if you can, disable your proximity sensor. Either when the camera crashes it takes your phone with it or even though it crashes , seemingly repeatedly, it keeps gobbling up your ram till your phone tanks and shuts off. Hit some development sites and see what devs have to say or are doing with respect to this subject if it's common. It could be "fixed" by a decent/corrected kernel build. Unless you are under contract or tied down by the knox/enterprise-ability thing.

You may need to go pirate/commando and break your contract to save your data though. Meaning rooting and ripping all your data off the device.

OH! and i forgot this,

08-11 17:49:33.932 W/ResourcesManager(29010): Asset path '/system/framework/com.google.android.media.effects.jar' does not exist or contains no resources.


That one is a genuine WTF.run ls -al /system/framework/ and look for zero length *.jar files.

More- missing lib

08-11 17:51:10.373 E/mm-camera( 1539): Tuning lib open failed: dlopen failed: library "libmmcamera_tuning.so" not found


Edit- Rerun your logcat "live" as logcat |grep F/ as before with phone connected till crash.