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

Commit 93f714da authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Add lock icon to bouncer when scrimmed

Lock icon needs to be reparented to the bouncer when we're
asking for a pin on top of the notification panel, since the
scrim would cove the whole lock screen.

Fixes: 129160870
Test: atest KeyguardBouncerTest
Test: atest StatusBarKeyguardViewManagerTest
Test: double tap notification
Test: swipe up to unlock
Test: swipe to shade locked, tap notification
Test: repeat with and without pin
Change-Id: I476ab2822da0040cfcfe7f8bc775b76407f0c613
parent f6934fb9
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -77,15 +77,20 @@
        android:contentDescription="@string/accessibility_phone_button"
        android:tint="?attr/wallpaperTextColor" />

    <FrameLayout
        android:id="@+id/lock_icon_container"
        android:layout_width="@dimen/keyguard_lock_width"
        android:layout_height="@dimen/keyguard_lock_height"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_marginBottom="@dimen/keyguard_lock_padding">
        <com.android.systemui.statusbar.phone.LockIcon
            android:id="@+id/lock_icon"
            android:layout_width="@dimen/keyguard_lock_width"
            android:layout_height="@dimen/keyguard_lock_height"
        android:layout_gravity="bottom|center_horizontal"
        android:layout_marginBottom="@dimen/keyguard_lock_padding"
            android:src="@*android:drawable/ic_lock"
            android:contentDescription="@string/accessibility_unlock_button"
            android:scaleType="center" />
    </FrameLayout>

    <FrameLayout
        android:id="@+id/overlay_container"
+6 −0
Original line number Diff line number Diff line
@@ -122,6 +122,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
    private KeyguardAffordanceView mRightAffordanceView;
    private KeyguardAffordanceView mLeftAffordanceView;
    private LockIcon mLockIcon;
    private ViewGroup mLockIconContainer;
    private ViewGroup mIndicationArea;
    private TextView mEnterpriseDisclosure;
    private TextView mIndicationText;
@@ -244,6 +245,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        mRightAffordanceView = findViewById(R.id.camera_button);
        mLeftAffordanceView = findViewById(R.id.left_button);
        mLockIcon = findViewById(R.id.lock_icon);
        mLockIconContainer = findViewById(R.id.lock_icon_container);
        mIndicationArea = findViewById(R.id.keyguard_indication_area);
        mEnterpriseDisclosure = findViewById(
                R.id.keyguard_indication_enterprise_disclosure);
@@ -657,6 +659,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
        return mLockIcon;
    }

    public ViewGroup getLockIconContainer() {
        return mLockIconContainer;
    }

    public View getIndicationArea() {
        return mIndicationArea;
    }
+5 −3
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class KeyguardBouncer {
            return;
        }
        ensureView();
        mIsScrimmed = isScrimmed;

        // On the keyguard, we want to show the bouncer when the user drags up, but it's
        // not correct to end the falsing session. We still need to verify if those touches
@@ -132,13 +133,13 @@ public class KeyguardBouncer {
        if (isScrimmed) {
            setExpansion(EXPANSION_VISIBLE);
        }
        mIsScrimmed = isScrimmed;

        if (resetSecuritySelection) {
            // showPrimarySecurityScreen() updates the current security method. This is needed in
            // case we are already showing and the current security method changed.
            showPrimarySecurityScreen();
        }

        if (mRoot.getVisibility() == View.VISIBLE || mShowingSoon) {
            return;
        }
@@ -168,8 +169,8 @@ public class KeyguardBouncer {
        mCallback.onBouncerVisiblityChanged(true /* shown */);
    }

    public boolean isShowingScrimmed() {
        return isShowing() && mIsScrimmed;
    public boolean isScrimmed() {
        return mIsScrimmed;
    }

    public ViewGroup getLockIconContainer() {
@@ -281,6 +282,7 @@ public class KeyguardBouncer {
                StatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__HIDDEN);
            mDismissCallbackRegistry.notifyDismissCancelled();
        }
        mIsScrimmed = false;
        mFalsingManager.onBouncerHidden();
        mCallback.onBouncerVisiblityChanged(false /* shown */);
        cancelShowRunnable();
+15 −2
Original line number Diff line number Diff line
@@ -3040,6 +3040,7 @@ public class NotificationPanelView extends PanelView implements
        }

        ViewGroup bouncerContainer = mBouncer.getLockIconContainer();
        ViewGroup bottomContainer = mKeyguardBottomArea.getLockIconContainer();
        LockIcon lockIcon = mKeyguardBottomArea.getLockIcon();

        if (mBouncer.isAnimatingAway()) {
@@ -3051,9 +3052,21 @@ public class NotificationPanelView extends PanelView implements
            return;
        }

        // Lock icon needs to be re-parented in case of a scrimmed bouncer,
        // otherwise it would be under the scrim.
        if (mBouncer.isScrimmed() && bouncerContainer != null
                && lockIcon.getParent() != bouncerContainer) {
            ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
            bouncerContainer.addView(lockIcon);
        } else if (!mBouncer.isScrimmed() && bottomContainer != null
                && lockIcon.getParent() != bottomContainer) {
            ((ViewGroup) lockIcon.getParent()).removeView(lockIcon);
            bottomContainer.addView(lockIcon);
        }

        float translation = 0;
        if (bouncerContainer != null) {
            float bottomAreaContainerY = getCommonTop(lockIcon);
        if (bouncerContainer != null && bottomContainer != null && !mBouncer.isScrimmed()) {
            float bottomAreaContainerY = getCommonTop(bottomContainer);
            float bouncerLockY = getCommonTop(bouncerContainer);
            if (bouncerLockY < bottomAreaContainerY) {
                translation = bouncerLockY - bottomAreaContainerY;
+4 −1
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        public void onFullyShown() {
            updateStates();
            mStatusBar.wakeUpIfDozing(SystemClock.uptimeMillis(), mContainer, "BOUNCER_VISIBLE");
            mNotificationPanelView.updateLockIcon();
        }

        @Override
@@ -96,6 +97,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        @Override
        public void onFullyHidden() {
            updateStates();
            mNotificationPanelView.updateLockIcon();
        }

        @Override
@@ -759,7 +761,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb

    public boolean bouncerNeedsScrimming() {
        return mOccluded || mBouncer.willDismissWithAction()  || mBouncer.needsFullscreenBouncer()
                || mStatusBar.isFullScreenUserSwitcherState() || mBouncer.isShowingScrimmed();
                || mStatusBar.isFullScreenUserSwitcherState()
                || (mBouncer.isShowing() && mBouncer.isScrimmed());
    }

    public void dump(PrintWriter pw) {
Loading