Merge "Fix issue where bouncer would go away" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fddbae9c78
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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());
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyFloat;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -307,4 +308,12 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
||||
mBouncer.isSecure(), mode != KeyguardSecurityModel.SecurityMode.None);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWillDismissWithAction() {
|
||||
mBouncer.ensureView();
|
||||
Assert.assertFalse("Action not set yet", mBouncer.willDismissWithAction());
|
||||
when(mKeyguardHostView.hasDismissActions()).thenReturn(true);
|
||||
Assert.assertTrue("Action should exist", mBouncer.willDismissWithAction());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user