phhusson / treble_experimentations

Notes about tinkering with Android Project Treble
3.38k stars 655 forks source link

Redmi 12 - screen backlight stops working after locking/unlocking the screen for a few times #2622

Open ghost opened 5 months ago

ghost commented 5 months ago

Current Behavior:

If I will press the power button for a few times, ~15 times I'd say, the next attempt to unlock I will see very dark text, icons, because the backlight of the screen stops working. Before I thought that the phone itself didn't woke up, however when this happened to me while I was outside and I could see the screen clock, on the lock screen, because of the bright sun. So this has to do something with the backlight. Also, sometimes I can let's say scroll on the touchscreen and it will scroll, during this weird state, but sometimes it's completely frozen. After a few minutes of being in this weird state the phone just performs a soft-reboot on it's own.

Describe the bug

While the phone is in this state, I can do adb shell pkill surfaceflinger to trigger a soft reboot and everything is working fine until I trigger the bug again.

If in this state, I do adb logcat, I see tons of errors "04-07 16:55:50.262 1003 1060 E android.hardware.sensors@2.0-service.multihal-mediatek: MMCKJ6a 20200831 inVG mag -0.098201 0.186791 -0.454408 acc -0.129286 0.033265 1.006837 ts 0.020004 04-07 16:55:50.262 1003 1060 E android.hardware.sensors@2.0-service.multihal-mediatek: MMCKJ6a 20180831 norm2_VG(acc,3)= 1 norm2_VG(mag,3)=0 StartErrCount=0 ErrCountFlag = 0"

To Reproduce

Lock/unlock the phone for a few times

Smartphone

Additional context

I tried changing various settings related to display/backlight in Phh treble settings however I get the same result. On stock the issue is not present.

I tried to trigger this issue and let the logcat running until it soft-rebooted on it's own log.txt

phhusson commented 5 months ago

Relevant extract


04-07 17:07:22.007 29164 29188 W Watchdog: *** WATCHDOG KILLING SYSTEM PROCESS: Blocked in handler on main thread (main), Blocked in handler on ui thread (android.ui)
04-07 17:07:22.010 29164 29188 W Watchdog: main annotated stack trace:
04-07 17:07:22.010 29164 29188 W Watchdog:     at android.hardware.SystemSensorManager$BaseEventQueue.nativeEnableSensor(Native Method)
04-07 17:07:22.010 29164 29188 W Watchdog:     at android.hardware.SystemSensorManager$BaseEventQueue.enableSensor(SystemSensorManager.java:793)
04-07 17:07:22.010 29164 29188 W Watchdog:     at android.hardware.SystemSensorManager$BaseEventQueue.addSensor(SystemSensorManager.java:709)
04-07 17:07:22.010 29164 29188 W Watchdog:     at android.hardware.SystemSensorManager.registerListenerImpl(SystemSensorManager.java:204)
04-07 17:07:22.011 29164 29188 W Watchdog:     - locked <0x040507fa> (a java.util.HashMap)
04-07 17:07:22.011 29164 29188 W Watchdog:     at android.hardware.SensorManager.registerListener(SensorManager.java:798)
04-07 17:07:22.011 29164 29188 W Watchdog:     at com.android.server.power.FaceDownDetector.updateActiveState(FaceDownDetector.java:206)
04-07 17:07:22.011 29164 29188 W Watchdog:     at com.android.server.power.FaceDownDetector.-$$Nest$mupdateActiveState(Unknown Source:0)
04-07 17:07:22.011 29164 29188 W Watchdog:     at com.android.server.power.FaceDownDetector$ScreenStateReceiver.onReceive(FaceDownDetector.java:468)
04-07 17:07:22.011 29164 29188 W Watchdog:     at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$android-app-LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1790)
04-07 17:07:22.012 29164 29188 W Watchdog:     at android.app.LoadedApk$ReceiverDispatcher$Args$$ExternalSyntheticLambda0.run(Unknown Source:2)
04-07 17:07:22.012 29164 29188 W Watchdog:     at android.os.Handler.handleCallback(Handler.java:942)
04-07 17:07:22.012 29164 29188 W Watchdog:     at android.os.Handler.dispatchMessage(Handler.java:99)
04-07 17:07:22.012 29164 29188 W Watchdog:     at android.os.Looper.loopOnce(Looper.java:201)
04-07 17:07:22.012 29164 29188 W Watchdog:     at android.os.Looper.loop(Looper.java:288)
04-07 17:07:22.012 29164 29188 W Watchdog:     at com.android.server.SystemServer.run(SystemServer.java:965)
04-07 17:07:22.012 29164 29188 W Watchdog:     at com.android.server.SystemServer.main(SystemServer.java:650)
04-07 17:07:22.012 29164 29188 W Watchdog:     at java.lang.reflect.Method.invoke(Native Method)
04-07 17:07:22.012 29164 29188 W Watchdog:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
04-07 17:07:22.012 29164 29188 W Watchdog:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:914)
04-07 17:07:22.013 29164 29188 W Watchdog: android.ui annotated stack trace:
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.BinderProxy.transactNative(Native Method)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.BinderProxy.transact(BinderProxy.java:584)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.app.IUidObserver$Stub$Proxy.onUidIdle(IUidObserver.java:280)
04-07 17:07:22.013 29164 29188 W Watchdog:     at com.android.server.am.UidObserverController.dispatchUidsChangedForObserver(UidObserverController.java:281)
04-07 17:07:22.013 29164 29188 W Watchdog:     at com.android.server.am.UidObserverController.dispatchUidsChanged(UidObserverController.java:211)
04-07 17:07:22.013 29164 29188 W Watchdog:     at com.android.server.am.UidObserverController$$ExternalSyntheticLambda0.run(Unknown Source:2)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.Handler.handleCallback(Handler.java:942)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.Handler.dispatchMessage(Handler.java:99)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.Looper.loopOnce(Looper.java:201)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.Looper.loop(Looper.java:288)
04-07 17:07:22.013 29164 29188 W Watchdog:     at android.os.HandlerThread.run(HandlerThread.java:67)
04-07 17:07:22.013 29164 29188 W Watchdog:     at com.android.server.ServiceThread.run(ServiceThread.java:44)
04-07 17:07:22.014 29164 29188 W Watchdog:     at com.android.server.UiThread.run(UiThread.java:45)```
ghost commented 5 months ago

also have found a weird bug, working with the flashlight is awful - e.g. i clicked the flashlight quick tile, and after locked the phone. and it wont unlock ever again. however the flashlight is fine after I reboot / kill surfaceflinger and it also soft reboots in this state after a few minutes... very weird

Captain-Starlet commented 5 months ago

I noticed one way to bypass Soft Reboot on the same device (Xiaomi Redmi 12 4GB/64GB). I turned off all sensors for the duration of testing using the following algorithm:

In total, the phone works without reboots or freezes.

How can you turn off the sensors one by one to identify which one is causing the malfunction?