Only reinflate bouncer after rotation if flag enabled

Re-inflating on orientation change is now guarded by the unreleased flag "lockscreen.enable_landscape", b/293252410, so the behaviour is back to the usual when this flag is off.

New tests to cover this case.

Bug: 295603468
Test: PinBouncerLandscapeLayout, PinBouncerPortraitLayout, PinBouncerLargeLayout
Change-Id: Ida08cc6e5c022a457e0d603ab75424d563dc0538
This commit is contained in:
axfordjc
2023-08-16 08:58:31 +00:00
parent 8c45339dd4
commit ad9db9cfe8
2 changed files with 51 additions and 1 deletions

View File

@@ -27,6 +27,7 @@ import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_PRIMARY;
import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_SECONDARY_USER;
import static com.android.keyguard.KeyguardSecurityContainer.USER_TYPE_WORK_PROFILE;
import static com.android.systemui.DejankUtils.whitelistIpcs;
import static com.android.systemui.flags.Flags.LOCKSCREEN_ENABLE_LANDSCAPE;
import static com.android.systemui.flags.Flags.REVAMPED_BOUNCER_MESSAGES;
import android.app.ActivityManager;
@@ -370,8 +371,12 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
@Override
public void onOrientationChanged(int orientation) {
KeyguardSecurityContainerController.this
if (mFeatureFlags.isEnabled(LOCKSCREEN_ENABLE_LANDSCAPE)) {
// TODO(b/295603468)
// Fix reinflation of views when flag is enabled.
KeyguardSecurityContainerController.this
.onDensityOrFontScaleOrOrientationChanged();
}
}
};
private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback =

View File

@@ -620,6 +620,51 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
configurationListenerArgumentCaptor.value.onUiModeChanged()
verify(view).reloadColors()
}
@Test
fun onOrientationChanged_landscapeKeyguardFlagDisabled_blockReinflate() {
featureFlags.set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, false)
// Run onOrientationChanged
val configurationListenerArgumentCaptor =
ArgumentCaptor.forClass(ConfigurationController.ConfigurationListener::class.java)
underTest.onViewAttached()
verify(configurationController).addCallback(configurationListenerArgumentCaptor.capture())
clearInvocations(viewFlipperController)
configurationListenerArgumentCaptor.value.onOrientationChanged(
Configuration.ORIENTATION_LANDSCAPE
)
// Verify view is reinflated when flag is on
verify(viewFlipperController, never()).clearViews()
verify(viewFlipperController, never())
.asynchronouslyInflateView(
eq(SecurityMode.PIN),
any(),
onViewInflatedCallbackArgumentCaptor.capture()
)
}
@Test
fun onOrientationChanged_landscapeKeyguardFlagEnabled_doesReinflate() {
featureFlags.set(Flags.LOCKSCREEN_ENABLE_LANDSCAPE, true)
// Run onOrientationChanged
val configurationListenerArgumentCaptor =
ArgumentCaptor.forClass(ConfigurationController.ConfigurationListener::class.java)
underTest.onViewAttached()
verify(configurationController).addCallback(configurationListenerArgumentCaptor.capture())
clearInvocations(viewFlipperController)
configurationListenerArgumentCaptor.value.onOrientationChanged(
Configuration.ORIENTATION_LANDSCAPE
)
// Verify view is reinflated when flag is on
verify(viewFlipperController).clearViews()
verify(viewFlipperController)
.asynchronouslyInflateView(
eq(SecurityMode.PIN),
any(),
onViewInflatedCallbackArgumentCaptor.capture()
)
}
@Test
fun hasDismissActions() {