[Xiaomi Mi Max ROMs, Kernels, Recoveries, & Other D] dungphp:
At present, Mi Max has 1 important bug fix that no one has been able to handle. Devs and users who know how to fix this work out for Mi Max to work better. How to handle things like this:

https://gitlab.com/Okeys/proprietary_vendor_oneplus/commit/0c52751deacdd97b13f7145816a3a3b673229b1c

Exp for kenzo: https://github.com/aranhid/proprietary_vendor_xiaomi/commit/3f99cec0e893ba4f135538abb2ee030c098ba3d4

If fixed the camera or flashlight in some roms like as aosp will work fast, no lags

Please join us!

Original file not modified (flashable): https://www.androidfilehost.com/?fid=1395089523397946186

Bugs in logcat:

04-18 18:59:59.841 416 6592 I CamDev@1.0-impl: Closing camera 0
04-18 18:59:59.849 416 6592 I qomx_image_core: OMX_Deinit:119] Complete
04-18 18:59:59.851 416 6592 I Thermal-Lib: Thermal-Lib-Client: Unregisteration is successfull for handle:1
04-18 18:59:59.851 464 608 I ThermalEngine: Thermal-Server: removing client on fd 58
04-18 18:59:59.851 416 6592 I Thermal-Lib: Thermal-Lib-Client: Unregisteration is successfull for handle:2
04-18 18:59:59.872 8492 8801 F libc : FORTIFY: pthread_mutex_destroy called on a destroyed mutex (0xe75322dc)
04-18 18:59:59.873 8492 8801 F libc : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 8801 (CAM_stopisp), pid 8492 (mm-qcamera-daem)
04-18 18:59:59.874 413 6339 D audio_hw_primary: start_output_stream: exit
04-18 18:59:59.898 8807 8807 I crash_dump32: type=1400 audit(0.0:2415): avc: denied { ptrace } for uid=1006 scontext=u:r:crash_dump:s0 tcontext=u:r:init:s0 tclass=process permissive=1
04-18 18:59:59.955 8807 8807 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
04-18 18:59:59.948 8799 8799 I CAM_stopsensor: type=1400 audit(0.0:2416): avc: denied { ioctl } for uid=1006 path="/dev/v4l-subdev19" dev="tmpfs" ino=16726 ioctlcmd=56c1 scontext=u:r:init:s0 tcontext=u:object_r:device:s0 tclass=chr_file permissive=1
04-18 18:59:59.955 495 495 I /system/bin/tombstoned: received crash request for pid 8801
04-18 18:59:59.956 8807 8807 I crash_dump32: performing dump of process 8492 (target tid = 8801)
04-18 18:59:59.977 8807 8807 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-18 18:59:59.978 8807 8807 F DEBUG : Build fingerprint: 'Xiaomi/hydrogen/hydrogen:6.0.1/MMB29M/V8.2.3.0.MBCCNDL:user/release-keys'
04-18 18:59:59.978 8807 8807 F DEBUG : Revision: '0'
04-18 18:59:59.978 8807 8807 F DEBUG : ABI: 'arm'
04-18 18:59:59.978 8807 8807 F DEBUG : pid: 8492, tid: 8801, name: CAM_stopisp >>> /system/bin/mm-qcamera-daemon <<<
04-18 18:59:59.978 8807 8807 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
04-18 18:59:59.978 8807 8807 F DEBUG : Abort message: 'FORTIFY: pthread_mutex_destroy called on a destroyed mutex (0xe75322dc)'
04-18 18:59:59.978 8807 8807 F DEBUG : r0 00000000 r1 00002261 r2 00000006 r3 00000008
04-18 18:59:59.978 8807 8807 F DEBUG : r4 0000212c r5 00002261 r6 e648188c r7 0000010c
04-18 18:59:59.978 8807 8807 F DEBUG : r8 00000002 r9 0005e848 r10 00000000 r11 0005e848
04-18 18:59:59.979 8807 8807 F DEBUG : ip ee72fd8c sp e6481878 lr ee6a8e49 pc ee6a0c9a
04-18 18:59:59.982 8807 8807 F DEBUG :
04-18 18:59:59.982 8807 8807 F DEBUG : backtrace:
04-18 18:59:59.982 8807 8807 F DEBUG : #00 pc 0001cc9a /system/lib/libc.so (abort+58)
04-18 18:59:59.982 8807 8807 F DEBUG : #01 pc 00064533 /system/lib/libc.so (__fortify_fatal(char const*, ...)+26)
04-18 18:59:59.982 8807 8807 F DEBUG : #02 pc 000643ed /system/lib/libc.so (pthread_mutex_destroy+128)
04-18 18:59:59.982 8807 8807 F DEBUG : #03 pc 00006ffd /system/vendor/lib/libmmcamera2_isp_modules.so
04-18 18:59:59.982 8807 8807 F DEBUG : #04 pc 0000e23d /system/vendor/lib/libmmcamera2_mct.so
04-18 18:59:59.982 8807 8807 F DEBUG : #05 pc 000632c9 /system/lib/libc.so (__pthread_start(void*)+22)
04-18 18:59:59.982 8807 8807 F DEBUG : #06 pc 0001de5d /system/lib/libc.so (__start_thread+24)
04-18 19:00:00.148 1116 2581 W NativeCrashListener: Couldn't find ProcessRecord for pid 8492
04-18 19:00:00.148 495 495 E /system/bin/tombstoned: Tombstone written to: /data/tombstones/tombstone_18
04-18 19:00:00.165 1116 1492 I BootReceiver: Copying /data/tombstones/tombstone_18 to DropBox (SYSTEM_TOMBSTONE)

ps: I fixed it in the sources