Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4a8ed3c5 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Increase keyguardDrawnTimeout to reduce fold->AOD flickers

Once we hit the keyguard drawn timeout, the screen is turned on. However, in some cases sysui and launcher are not ready (due to big ui thread latency), and this results with the screen on while showing the wrong layout, followed by a rapid jump to the correct one.

This cl makes the timeout configurable in overlays for each device. In this way, the chances to have flicker are greatly reduced, but the underlying latency problem remains.
In parallel, we're looking to fix the root cause latency problem

Bug: 243015678
Test: trying to repro the scenario generating flicker many times, no flicker.
Change-Id: I08f147e7e4944656a0028df7e521441b1a9cc65c
parent 4626fa48
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -727,6 +727,9 @@
         mode. -->
    <integer name="config_unfoldTransitionHalfFoldedTimeout">1000</integer>

    <!-- Timeout for receiving the keyguard drawn event from System UI.  -->
    <integer name="config_keyguardDrawnTimeout">1000</integer>

    <!-- Indicates that the device supports having more than one internal display on at the same
         time. Only applicable to devices with more than one internal display. If this option is
         set to false, DisplayManager will make additional effort to ensure no more than 1 internal
+1 −0
Original line number Diff line number Diff line
@@ -1987,6 +1987,7 @@
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromDock" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromWindowLayout" />
  <java-symbol type="bool" name="config_keepDreamingWhenUndocking" />
  <java-symbol type="integer" name="config_keyguardDrawnTimeout" />
  <java-symbol type="bool" name="config_goToSleepOnButtonPressTheaterMode" />
  <java-symbol type="bool" name="config_supportLongPressPowerWhenNonInteractive" />
  <java-symbol type="bool" name="config_wimaxEnabled" />
+6 −1
Original line number Diff line number Diff line
@@ -629,6 +629,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {

    private boolean mLockNowPending = false;

    // Timeout for showing the keyguard after the screen is on, in case no "ready" is received.
    private int mKeyguardDrawnTimeout = 1000;

    private static final int MSG_DISPATCH_MEDIA_KEY_WITH_WAKE_LOCK = 3;
    private static final int MSG_DISPATCH_MEDIA_KEY_REPEAT_WITH_WAKE_LOCK = 4;
    private static final int MSG_KEYGUARD_DRAWN_COMPLETE = 5;
@@ -2161,6 +2164,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            }
        });

        mKeyguardDrawnTimeout = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_keyguardDrawnTimeout);
        mKeyguardDelegate = new KeyguardServiceDelegate(mContext,
                new StateCallback() {
                    @Override
@@ -4766,7 +4771,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        final boolean bootCompleted =
                LocalServices.getService(SystemServiceManager.class).isBootCompleted();
        // Set longer timeout if it has not booted yet to prevent showing empty window.
        return bootCompleted ? 1000 : 5000;
        return bootCompleted ? mKeyguardDrawnTimeout : 5000;
    }

    // Called on the DisplayManager's DisplayPowerController thread.