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

Commit 1267a8ff authored by Ilya Matyukhin's avatar Ilya Matyukhin
Browse files

Fix UDFPS not working when a HUN is showing

We didn't want the UDFPS overlay to handle touches when a user pulls
down the notification shade. We accomplished it by ignoring UDFPS
touches if the notification shade is expanded.

However, that had an undesired side effect. Apparently, the notification
shade is considered expanded when a heads-up notification (HUN) is
showing. Which means if a user receives a HUN during authentication,
their touch will be ignored.

This CL fixes the undesired behavior by also checking the expansion
ratio. It appears that when a HUN is showing, the notification shade
reports itself as expanded with the 0.0f expansion ratio.

Bug: 203213357
Test: authenticate in BiometricPrompt with a HUN showing
Change-Id: I597393b8f8bafda3b28e54237a44ba7517681869
parent ba64f849
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ abstract class UdfpsAnimationView extends FrameLayout {
        return (int) ((1 - percent) * 255);
    }

    public void onExpansionChanged(float expansion, boolean expanded) {
    public void onExpansionChanged(float expansion) {
        mAlpha = expansionToAlpha(expansion);
        updateAlpha();
    }
+7 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
    @NonNull final PanelExpansionStateManager mPanelExpansionStateManager;
    @NonNull final DumpManager mDumpManger;

    boolean mNotificationShadeExpanded;
    boolean mNotificationShadeVisible;

    protected UdfpsAnimationViewController(
            T view,
@@ -85,7 +85,7 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>

    @Override
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("mNotificationShadeExpanded=" + mNotificationShadeExpanded);
        pw.println("mNotificationShadeVisible=" + mNotificationShadeVisible);
        pw.println("shouldPauseAuth()=" + shouldPauseAuth());
        pw.println("isPauseAuth=" + mView.isPauseAuth());
    }
@@ -95,7 +95,7 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
     * authentication.
     */
    boolean shouldPauseAuth() {
        return mNotificationShadeExpanded;
        return mNotificationShadeVisible;
    }

    /**
@@ -182,8 +182,10 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
        @Override
        public void onPanelExpansionChanged(
                float fraction, boolean expanded, boolean tracking) {
            mNotificationShadeExpanded = expanded;
            mView.onExpansionChanged(fraction, expanded);
            // Notification shade can be expanded but not visible (fraction: 0.0), for example
            // when a heads-up notification (HUN) is showing.
            mNotificationShadeVisible = expanded && fraction > 0f;
            mView.onExpansionChanged(fraction);
            updatePauseAuth();
        }
    };
+1 −1
Original line number Diff line number Diff line
@@ -211,7 +211,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
            return false;
        }

        if (mUdfpsRequested && !mNotificationShadeExpanded
        if (mUdfpsRequested && !mNotificationShadeVisible
                && (!mIsBouncerVisible
                || mInputBouncerHiddenAmount != KeyguardBouncer.EXPANSION_VISIBLE)) {
            return false;