Merge "[Bouncer] Fix MODERN BOUNCER issues." into tm-qpr-dev

This commit is contained in:
Aaron Liu
2022-10-21 23:46:47 +00:00
committed by Android (Google) Code Review
3 changed files with 13 additions and 15 deletions

View File

@@ -273,8 +273,8 @@ constructor(
/** Tell the bouncer to start the pre hide animation. */ /** Tell the bouncer to start the pre hide animation. */
fun startDisappearAnimation(runnable: Runnable) { fun startDisappearAnimation(runnable: Runnable) {
val finishRunnable = Runnable { val finishRunnable = Runnable {
repository.setStartDisappearAnimation(null)
runnable.run() runnable.run()
repository.setStartDisappearAnimation(null)
} }
repository.setStartDisappearAnimation(finishRunnable) repository.setStartDisappearAnimation(finishRunnable)
} }

View File

@@ -60,7 +60,6 @@ import com.android.systemui.dreams.DreamOverlayStateController;
import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.flags.Flags; import com.android.systemui.flags.Flags;
import com.android.systemui.keyguard.data.BouncerView; import com.android.systemui.keyguard.data.BouncerView;
import com.android.systemui.keyguard.data.BouncerViewDelegate;
import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor; import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor;
import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; import com.android.systemui.keyguard.domain.interactor.BouncerInteractor;
import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.navigationbar.NavigationBarView;
@@ -136,7 +135,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private KeyguardMessageAreaController<AuthKeyguardMessageArea> mKeyguardMessageAreaController; private KeyguardMessageAreaController<AuthKeyguardMessageArea> mKeyguardMessageAreaController;
private final BouncerCallbackInteractor mBouncerCallbackInteractor; private final BouncerCallbackInteractor mBouncerCallbackInteractor;
private final BouncerInteractor mBouncerInteractor; private final BouncerInteractor mBouncerInteractor;
private final BouncerViewDelegate mBouncerViewDelegate; private final BouncerView mBouncerView;
private final Lazy<com.android.systemui.shade.ShadeController> mShadeController; private final Lazy<com.android.systemui.shade.ShadeController> mShadeController;
private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() { private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() {
@@ -327,7 +326,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mKeyguardSecurityModel = keyguardSecurityModel; mKeyguardSecurityModel = keyguardSecurityModel;
mBouncerCallbackInteractor = bouncerCallbackInteractor; mBouncerCallbackInteractor = bouncerCallbackInteractor;
mBouncerInteractor = bouncerInteractor; mBouncerInteractor = bouncerInteractor;
mBouncerViewDelegate = bouncerView.getDelegate(); mBouncerView = bouncerView;
mFoldAodAnimationController = sysUIUnfoldComponent mFoldAodAnimationController = sysUIUnfoldComponent
.map(SysUIUnfoldComponent::getFoldAodAnimationController).orElse(null); .map(SysUIUnfoldComponent::getFoldAodAnimationController).orElse(null);
mIsModernBouncerEnabled = featureFlags.isEnabled(Flags.MODERN_BOUNCER); mIsModernBouncerEnabled = featureFlags.isEnabled(Flags.MODERN_BOUNCER);
@@ -804,7 +803,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private void setDozing(boolean dozing) { private void setDozing(boolean dozing) {
if (mDozing != dozing) { if (mDozing != dozing) {
mDozing = dozing; mDozing = dozing;
if (dozing || mBouncer.needsFullscreenBouncer() if (dozing || needsFullscreenBouncer()
|| mKeyguardStateController.isOccluded()) { || mKeyguardStateController.isOccluded()) {
reset(dozing /* hideBouncerWhenShowing */); reset(dozing /* hideBouncerWhenShowing */);
} }
@@ -1082,7 +1081,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* @return whether a back press can be handled right now. * @return whether a back press can be handled right now.
*/ */
public boolean canHandleBackPressed() { public boolean canHandleBackPressed() {
return mBouncer.isShowing(); return bouncerIsShowing();
} }
/** /**
@@ -1125,8 +1124,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} }
public boolean isFullscreenBouncer() { public boolean isFullscreenBouncer() {
if (mBouncerViewDelegate != null) { if (mBouncerView.getDelegate() != null) {
return mBouncerViewDelegate.isFullScreenBouncer(); return mBouncerView.getDelegate().isFullScreenBouncer();
} }
return mBouncer != null && mBouncer.isFullscreenBouncer(); return mBouncer != null && mBouncer.isFullscreenBouncer();
} }
@@ -1285,15 +1284,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} }
public boolean shouldDismissOnMenuPressed() { public boolean shouldDismissOnMenuPressed() {
if (mBouncerViewDelegate != null) { if (mBouncerView.getDelegate() != null) {
return mBouncerViewDelegate.shouldDismissOnMenuPressed(); return mBouncerView.getDelegate().shouldDismissOnMenuPressed();
} }
return mBouncer != null && mBouncer.shouldDismissOnMenuPressed(); return mBouncer != null && mBouncer.shouldDismissOnMenuPressed();
} }
public boolean interceptMediaKey(KeyEvent event) { public boolean interceptMediaKey(KeyEvent event) {
if (mBouncerViewDelegate != null) { if (mBouncerView.getDelegate() != null) {
return mBouncerViewDelegate.interceptMediaKey(event); return mBouncerView.getDelegate().interceptMediaKey(event);
} }
return mBouncer != null && mBouncer.interceptMediaKey(event); return mBouncer != null && mBouncer.interceptMediaKey(event);
} }
@@ -1302,8 +1301,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
* @return true if the pre IME back event should be handled * @return true if the pre IME back event should be handled
*/ */
public boolean dispatchBackKeyEventPreIme() { public boolean dispatchBackKeyEventPreIme() {
if (mBouncerViewDelegate != null) { if (mBouncerView.getDelegate() != null) {
return mBouncerViewDelegate.dispatchBackKeyEventPreIme(); return mBouncerView.getDelegate().dispatchBackKeyEventPreIme();
} }
return mBouncer != null && mBouncer.dispatchBackKeyEventPreIme(); return mBouncer != null && mBouncer.dispatchBackKeyEventPreIme();
} }

View File

@@ -117,7 +117,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Mock private BouncerCallbackInteractor mBouncerCallbackInteractor; @Mock private BouncerCallbackInteractor mBouncerCallbackInteractor;
@Mock private BouncerInteractor mBouncerInteractor; @Mock private BouncerInteractor mBouncerInteractor;
@Mock private BouncerView mBouncerView; @Mock private BouncerView mBouncerView;
// @Mock private WeakReference<BouncerViewDelegate> mBouncerViewDelegateWeakReference;
@Mock private BouncerViewDelegate mBouncerViewDelegate; @Mock private BouncerViewDelegate mBouncerViewDelegate;
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;