[Android Q&A, Help & Troubleshooting] half-a-pony:
Hi,

I was trying to find out why my Pixel2 [stock, unrooted android Pie] battery gets used soo quickly. Reboot didn't resolve anything.

The battery info page in the settings itself doesn't really show any info. However, if I run 'top' in an adb shell, it seems that android.process.media is consuming all of 1 CPU (in kernel space, this is why it might not show up in the battery usage report) :

Tasks: 707 total, 1 running, 704 sleeping, 0 stopped, 0 zombie

Mem: 3744240k total, 3666632k used, 77608k free, 73852k buffers

Swap: 524284k total, 151760k used, 372524k free, 1559284k cached

800%cpu 11%user 1%nice 102%sys 684%idle 1%iow 0%irq 0%sirq 0%host

PID USER PR NI VIRT RES SHR S[%CPU] %MEM TIME+ ARGS

20289 u0_a34 20 0 3.5G 75M 37M S 99.3 2.0 101:16.55 android.process.media

27121 shell 20 0 11M 2.9M 1.6M R 6.3 0.0 0:00.34 top

2203 u0_a12 16 -4 4.3G 266M 175M S 6.3 7.2 10:38.35 com.google.android.gms

19180 u0_i11 20 0 1.0G 56M 43M S 4.3 1.5 5:38.55 com.android.chrome:sandboxed_process0

609 system 12 -8 2.0G 17M 12M S 4.3 0.4 7:42.78 surfaceflinger

25632 root 20 0 0 0 0 S 1.0 0.0 0:03.31 [kworker/u16:5]

Here's the logcat, grepping for relevant info (process name, user name & PID) :

$ grep 'android.process.media\|u0.\?a34\|20289\|Mtp' logcat.txt

11-05 17:55:47.336 1157 1169 I ActivityManager: Killing 14978:android.process.media/u0a34 (adj 906): empty #17

11-05 19:42:17.127 1157 1202 I ActivityManager: Start proc 20289:android.process.media/u0a34 for broadcast com.android.providers.media/.MtpReceiver

11-05 19:43:42.676 1157 1202 I ActivityManager: Start proc 21970:com.android.mtp/u0a34 for content provider com.android.mtp/.MtpDocumentsProvider

11-05 19:52:49.336 1157 1472 I ActivityManager: Killing 21970:com.android.mtp/u0a34 (adj 906): empty #17

11-05 21:10:35.679 20289 20310 E MtpServer: request read returned -1, errno: 108

11-05 21:10:56.904 20289 20289 D MtpService: starting MTP server in MTP mode with storage /storage/emulated/0 unlocked as user 0

11-05 21:10:56.910 20289 20289 V MtpService: Adding MTP storage:/storage/emulated/0

11-05 21:11:18.360 20289 26156 E MtpServer: request read returned -1, errno: 108

11-05 21:11:18.960 20289 20289 D MtpService: starting MTP server in PTP mode with storage /storage/emulated/0 unlocked as user 0

11-05 21:11:18.965 20289 20289 V MtpService: Adding MTP storage:/storage/emulated/0

11-05 21:11:29.673 20289 26170 E MtpServer: request read returned -1, errno: 108

11-05 21:11:30.223 20289 20289 D MtpService: starting MTP server in MTP mode with storage /storage/emulated/0 unlocked as user 0

11-05 21:11:30.227 20289 20289 V MtpService: Adding MTP storage:/storage/emulated/0

11-05 21:12:12.101 20289 26176 E MtpServer: request read returned -1, errno: 108

11-05 21:12:51.644 20289 20289 D MtpService: starting MTP server in MTP mode with storage /storage/emulated/0 as user 0

11-05 21:12:58.994 20289 26357 E MtpServer: request read returned -1, errno: 108

11-05 21:12:59.584 20289 20289 D MtpService: starting MTP server in MTP mode with storage /storage/emulated/0 unlocked as user 0

11-05 21:12:59.588 20289 20289 V MtpService: Adding MTP storage:/storage/emulated/0

11-05 21:15:44.399 20289 26367 E MtpServer: request read returned -1, errno: 108

11-05 21:15:44.413 20289 20297 W System : A resource failed to call close.

11-05 21:15:44.413 20289 20297 W System : A resource failed to call close.

11-05 21:15:44.414 20289 20297 I chatty : uid=10034(com.android.providers.media) FinalizerDaemon identical 2 lines

11-05 21:15:44.414 20289 20297 W System : A resource failed to call close.

11-05 21:15:44.989 20289 20289 D MtpService: starting MTP server in MTP mode with storage /storage/emulated/0 unlocked as user 0

11-05 21:15:45.001 20289 20289 V MtpService: Adding MTP storage:/storage/emulated/0