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

Commit 90841a40 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

Merge "Fix issue where bouncer would go away" into pi-dev am: fddbae9c

am: 574eff07

Change-Id: I5789ab85d4e43ce7c6fdbfbaaccc746a77a4f0df
parents 58d1fb77 574eff07
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
        mCancelAction = cancelAction;
    }

    public boolean hasDismissActions() {
        return mDismissAction != null || mCancelAction != null;
    }

    public void cancelDismissAction() {
        setOnDismissAction(null, null);
    }
+4 −0
Original line number Diff line number Diff line
@@ -330,6 +330,10 @@ public class KeyguardBouncer {
        }
    }

    public boolean willDismissWithAction() {
        return mKeyguardView != null && mKeyguardView.hasDismissActions();
    }

    protected void ensureView() {
        // Removal of the view might be deferred to reduce unlock latency,
        // in this case we need to force the removal, otherwise we'll
+6 −3
Original line number Diff line number Diff line
@@ -4654,9 +4654,12 @@ public class StatusBar extends SystemUI implements DemoMode,

        if (mBouncerShowing) {
            // Bouncer needs the front scrim when it's on top of an activity,
            // tapping on a notification or editing QS.
            mScrimController.transitionTo(mIsOccluded || mNotificationPanel.needsScrimming() ?
                    ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER);
            // tapping on a notification, editing QS or being dismissed by
            // FLAG_DISMISS_KEYGUARD_ACTIVITY.
            ScrimState state = mIsOccluded || mNotificationPanel.needsScrimming()
                    || mStatusBarKeyguardViewManager.willDismissWithAction() ?
                    ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER;
            mScrimController.transitionTo(state);
        } else if (mLaunchCameraOnScreenTurningOn || isInLaunchTransition()) {
            mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback);
        } else if (mBrightnessMirrorVisible) {
+11 −4
Original line number Diff line number Diff line
@@ -140,11 +140,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
    }

    private void onPanelExpansionChanged(float expansion, boolean tracking) {
        // We don't want to translate the bounce when the keyguard is occluded, because we're in
        // a FLAG_SHOW_WHEN_LOCKED activity and need to conserve the original animation.
        // We also don't want to show the bouncer when the user quickly taps on the display.
        // We don't want to translate the bounce when:
        // • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
        //   conserve the original animation.
        // • The user quickly taps on the display and we show "swipe up to unlock."
        // • Keyguard will be dismissed by an action. a.k.a: FLAG_DISMISS_KEYGUARD_ACTIVITY
        final boolean noLongerTracking = mLastTracking != tracking && !tracking;
        if (mOccluded || mNotificationPanelView.isUnlockHintRunning()) {
        if (mOccluded || mNotificationPanelView.isUnlockHintRunning()
                || mBouncer.willDismissWithAction()) {
            mBouncer.setExpansion(0);
        } else if (mShowing && mStatusBar.isKeyguardCurrentlySecure() && !mDozing) {
            mBouncer.setExpansion(expansion);
@@ -696,6 +699,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
        }
    }

    public boolean willDismissWithAction() {
        return mBouncer.willDismissWithAction();
    }

    private static class DismissWithActionRequest {
        final OnDismissAction dismissAction;
        final Runnable cancelAction;
+51 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License
 */

package com.android.keyguard;

import static org.mockito.Mockito.mock;

import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;

import com.android.systemui.SysuiTestCase;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@SmallTest
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
public class KeyguardHostViewTest extends SysuiTestCase {

    private KeyguardHostView mKeyguardHostView;

    @Before
    public void setup() {
        mKeyguardHostView = new KeyguardHostView(getContext());
    }

    @Test
    public void testHasDismissActions() {
        Assert.assertFalse("Action not set yet", mKeyguardHostView.hasDismissActions());
        mKeyguardHostView.setOnDismissAction(mock(KeyguardHostView.OnDismissAction.class),
                null /* cancelAction */);
        Assert.assertTrue("Action should exist", mKeyguardHostView.hasDismissActions());
    }
}
Loading