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

Commit b0a08742 authored by Android Build Prod User's avatar Android Build Prod User Committed by Android (Google) Code Review
Browse files

Merge "Fix udfps flicker on camera launch + exit" into sc-qpr1-dev

parents 412b6dfe 822e07e0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -791,6 +791,7 @@ public class UdfpsController implements DozeReceiver {
                        mLockscreenShadeTransitionController,
                        mConfigurationController,
                        mSystemClock,
                        mKeyguardStateController,
                        this
                );
            case IUdfpsOverlayController.REASON_AUTH_BP:
+41 −2
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.systemui.statusbar.phone.KeyguardBouncer;
import com.android.systemui.statusbar.phone.StatusBar;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.time.SystemClock;

@@ -52,6 +53,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    @NonNull private final LockscreenShadeTransitionController mLockScreenShadeTransitionController;
    @NonNull private final ConfigurationController mConfigurationController;
    @NonNull private final SystemClock mSystemClock;
    @NonNull private final KeyguardStateController mKeyguardStateController;
    @NonNull private final UdfpsController mUdfpsController;

    private boolean mShowingUdfpsBouncer;
@@ -62,6 +64,8 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    private float mTransitionToFullShadeProgress;
    private float mLastDozeAmount;
    private long mLastUdfpsBouncerShowTime = -1;
    private float mStatusBarExpansion;
    private boolean mLaunchTransitionFadingAway;

    /**
     * hidden amount of pin/pattern/password bouncer
@@ -83,6 +87,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
            @NonNull LockscreenShadeTransitionController transitionController,
            @NonNull ConfigurationController configurationController,
            @NonNull SystemClock systemClock,
            @NonNull KeyguardStateController keyguardStateController,
            @NonNull UdfpsController udfpsController) {
        super(view, statusBarStateController, statusBar, dumpManager);
        mKeyguardViewManager = statusBarKeyguardViewManager;
@@ -92,6 +97,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        mLockScreenShadeTransitionController = transitionController;
        mConfigurationController = configurationController;
        mSystemClock = systemClock;
        mKeyguardStateController = keyguardStateController;
        mUdfpsController = udfpsController;
    }

@@ -116,11 +122,14 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud

        mUdfpsRequested = false;

        mLaunchTransitionFadingAway = mKeyguardStateController.isLaunchTransitionFadingAway();
        mKeyguardStateController.addCallback(mKeyguardStateControllerCallback);
        mStatusBarState = mStatusBarStateController.getState();
        mQsExpanded = mKeyguardViewManager.isQsExpanded();
        mInputBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN;
        mIsBouncerVisible = mKeyguardViewManager.bouncerIsOrWillBeShowing();
        mConfigurationController.addCallback(mConfigurationListener);
        mStatusBar.addExpansionChangedListener(mStatusBarExpansionChangedListener);
        updateAlpha();
        updatePauseAuth();

@@ -133,10 +142,12 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        super.onViewDetached();
        mFaceDetectRunning = false;

        mKeyguardStateController.removeCallback(mKeyguardStateControllerCallback);
        mStatusBarStateController.removeCallback(mStateListener);
        mKeyguardViewManager.removeAlternateAuthInterceptor(mAlternateAuthInterceptor);
        mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false);
        mConfigurationController.removeCallback(mConfigurationListener);
        mStatusBar.removeExpansionChangedListener(mStatusBarExpansionChangedListener);
        if (mLockScreenShadeTransitionController.getUdfpsKeyguardViewController() == this) {
            mLockScreenShadeTransitionController.setUdfpsKeyguardViewController(null);
        }
@@ -151,9 +162,11 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
        pw.println("mQsExpanded=" + mQsExpanded);
        pw.println("mIsBouncerVisible=" + mIsBouncerVisible);
        pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount);
        pw.println("mStatusBarExpansion=" + mStatusBarExpansion);
        pw.println("mAlpha=" + mView.getAlpha());
        pw.println("mUdfpsRequested=" + mUdfpsRequested);
        pw.println("mView.mUdfpsRequested=" + mView.mUdfpsRequested);
        pw.println("mLaunchTransitionFadingAway=" + mLaunchTransitionFadingAway);
    }

    /**
@@ -203,6 +216,10 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
            return false;
        }

        if (mLaunchTransitionFadingAway) {
            return true;
        }

        if (mStatusBarState != KEYGUARD) {
            return true;
        }
@@ -260,10 +277,13 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
    }

    private void updateAlpha() {
        // fade icon on transition to showing bouncer
        // fade icon on transitions to showing the status bar, but if mUdfpsRequested, then
        // the keyguard is occluded by some application - so instead use the input bouncer
        // hidden amount to determine the fade
        float expansion = mUdfpsRequested ? mInputBouncerHiddenAmount : mStatusBarExpansion;
        int alpha = mShowingUdfpsBouncer ? 255
                : (int) MathUtils.constrain(
                    MathUtils.map(.5f, .9f, 0f, 255f, mInputBouncerHiddenAmount),
                    MathUtils.map(.5f, .9f, 0f, 255f, expansion),
                    0f, 255f);
        alpha *= (1.0f - mTransitionToFullShadeProgress);
        mView.setUnpausedAlpha(alpha);
@@ -379,4 +399,23 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
                    mView.updateColor();
                }
            };

    private final StatusBar.ExpansionChangedListener mStatusBarExpansionChangedListener =
            new StatusBar.ExpansionChangedListener() {
                @Override
                public void onExpansionChanged(float expansion, boolean expanded) {
                    mStatusBarExpansion = expansion;
                    updateAlpha();
                }
            };

    private final KeyguardStateController.Callback mKeyguardStateControllerCallback =
            new KeyguardStateController.Callback() {
                @Override
                public void onLaunchTransitionFadingAwayChanged() {
                    mLaunchTransitionFadingAway =
                            mKeyguardStateController.isLaunchTransitionFadingAway();
                    updatePauseAuth();
                }
            };
}
+11 −0
Original line number Diff line number Diff line
@@ -1148,6 +1148,9 @@ public class StatusBar extends SystemUI implements DemoMode,
                    mStatusBarView.setPanel(mNotificationPanelViewController);
                    mStatusBarView.setScrimController(mScrimController);
                    mStatusBarView.setExpansionChangedListeners(mExpansionChangedListeners);
                    for (ExpansionChangedListener listener : mExpansionChangedListeners) {
                        sendInitialExpansionAmount(listener);
                    }

                    // CollapsedStatusBarFragment re-inflated PhoneStatusBarView and both of
                    // mStatusBarView.mExpanded and mStatusBarView.mBouncerShowing are false.
@@ -4943,6 +4946,14 @@ public class StatusBar extends SystemUI implements DemoMode,

    public void addExpansionChangedListener(@NonNull ExpansionChangedListener listener) {
        mExpansionChangedListeners.add(listener);
        sendInitialExpansionAmount(listener);
    }

    private void sendInitialExpansionAmount(ExpansionChangedListener expansionChangedListener) {
        if (mStatusBarView != null) {
            expansionChangedListener.onExpansionChanged(mStatusBarView.getExpansionFraction(),
                    mStatusBarView.isExpanded());
        }
    }

    public void removeExpansionChangedListener(@NonNull ExpansionChangedListener listener) {
+6 −0
Original line number Diff line number Diff line
@@ -245,5 +245,11 @@ public interface KeyguardStateController extends CallbackController<Callback> {
         * animation.
         */
        default void onKeyguardDismissAmountChanged() {}

        /**
         * Triggered when the notification panel is starting or has finished
         * fading away on transition to an app.
         */
        default void onLaunchTransitionFadingAwayChanged() {}
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -343,6 +343,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
    @Override
    public void setLaunchTransitionFadingAway(boolean fadingAway) {
        mLaunchTransitionFadingAway = fadingAway;
        new ArrayList<>(mCallbacks).forEach(Callback::onLaunchTransitionFadingAwayChanged);
    }

    @Override
Loading