Resolved Status bar getting black color when locking


Status
Not open for further replies.
Ooohhh yeaaaah, I fixed it! :)

Problem is with ScrimView +id/scrim_in_front in status bar. It has default black color and class com.android.systemui.statusbar.phone.ScrimController changes its alpha between 0.0f and 1.0f under different circumstances. Front scrim covers everything inside status bar/notification drawer/lock screen. Switching off AOD was probably fixing it because there are different conditions for this in ScrimController and AOD being active is one of them. Root problem is probably deeper, e.g. dozing (another condition) being activated too early when you press power button and not when screen actually turns off, or something like that.

I just modified method com.android.systemui.statusbar.ScrimView.setScrimColor(int color) to change color from black to transparent whenever it tries to set it for scrim_in_front.
Good news!
Can you fix my file if i provide to you?
 
It's an interesting finding, but given the fact I don't have a device other than Mi 5 and Mi 6, there nothing I can do to investigate this any further...
I think I found a better solution than changing scrim color.
This code in com.android.systemui.statusbar.phone.FingerprintUnlockController.onStartedGoingToSleep() eventually causes scrim to appear:
Code:
if (MiuiKeyguardUtils.isAodEnable(this.mContext) || (MiuiKeyguardUtils.isGxzwSensor() && this.mUpdateMonitor.isUnlockWithFingerprintPossible(currentUser))) {
     this.mScrimController.setAodWaitUnlocking(true);
}
Maybe it's a black background for AOD, but I have no idea why it is also required when fingerprint is available.
Anyway, just moving this part of code from onStartedGoingToSleep to onFinishedGoingToSleep should work too.
 
How you can?
Attached file is an Xposed module that incorporates the method above (but with fingerprint condition removed).
The only way to remove this visual bug without modifications is by disabling both fingerprint authentication and AOD.
 

Attachments

  • FixMIUI.apk
    19.2 KB · Views: 264
  • Like
Reactions: Faabio
Actually, I had this bug by accident. Mi Mix 2S doesn't have AOD, I was just experimenting with it to make it work on my device, so I had an AOD system setting enabled, that's why this code was executing :) Gxzw sensor is an in-screen fingerprint sensor, this device also doesn't have that.
 
Attached file is an Xposed module that incorporates the method above (but with fingerprint condition removed).
The only way to remove this visual bug without modifications is by disabling both fingerprint authentication and AOD.
I install your apk, its ok.
Thank you very much!
I hope that eu Xiaomi use thie fix for our roms!
 
It's an interesting finding, but given the fact I don't have a device other than Mi 5 and Mi 6, there nothing I can do to investigate this any further...
You can also make this bug appear on your device by running
Code:
settings put secure doze_always_on 1
for SDK >= 28 or
Code:
settings put secure aod_mode 1
for lower versions.
 
  • Like
Reactions: Dorisnov
You can also make this bug appear on your device by running
Code:
settings put secure doze_always_on 1
for SDK >= 28 or
Code:
settings put secure aod_mode 1
for lower versions.
Very nice, confirmed.

It seems that this issue originates from stock China ROM, but it's not visible there because official ROMs don't have the screen off fade-out animation enabled, so it's turning off the screen instantaneously. Xiaomi didn't consider the possibility that the 'going to sleep' will be delayed with an animation, so they used onStartedGoingToSleep to set the scrim immediately, but moving that piece of code to onFinishedGoingToSleep seems to be the best approach indeed.
 
  • Like
Reactions: Mikanoshi
Status
Not open for further replies.