Prevent CtS invocation in fake landscape mode

Bug: 383421642
Test: manual, atest ContextualSearchInvokerTest
Flag: EXEMPT bugfix

Change-Id: I71ff453c54ade4583494ae9a6b44560d59b010d8
This commit is contained in:
Hyunyoung Song
2025-01-04 06:41:06 +00:00
parent d4bfadf263
commit 299576a777
2 changed files with 23 additions and 1 deletions
@@ -161,7 +161,11 @@ internal constructor(
statsLogManager.logger().log(LAUNCHER_LAUNCH_OMNI_FAILED_NOT_AVAILABLE)
return false
}
if (isFakeLandscape()) {
// TODO (b/383421642): Fake landscape is to be removed in 25Q3 and this entire block
// can be removed when that happens.
return false
}
return true
}
@@ -197,6 +201,13 @@ internal constructor(
return true
}
private fun isFakeLandscape(): Boolean =
getRecentsContainerInterface()
?.getCreatedContainer()
?.getOverviewPanel<RecentsView<*, *>>()
?.getPagedOrientationHandler()
?.isLayoutNaturalToLauncher == false
private fun isInSplitscreen(): Boolean {
return topTaskTracker.getRunningSplitTaskIds().isNotEmpty()
}
@@ -52,6 +52,7 @@ import com.android.quickstep.BaseContainerInterface;
import com.android.quickstep.DeviceConfigWrapper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TopTaskTracker;
import com.android.quickstep.orientation.RecentsPagedOrientationHandler;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsViewContainer;
@@ -82,6 +83,7 @@ public class ContextualSearchInvokerTest {
private @Mock BaseContainerInterface mMockContainerInterface;
private @Mock RecentsViewContainer mMockRecentsViewContainer;
private @Mock RecentsView mMockRecentsView;
private @Mock RecentsPagedOrientationHandler mMockOrientationHandler;
private ContextualSearchInvoker mContextualSearchInvoker;
@Before
@@ -189,6 +191,15 @@ public class ContextualSearchInvokerTest {
verify(mMockStatsLogger).log(LAUNCHER_LAUNCH_OMNI_ATTEMPTED_SPLITSCREEN);
}
@Test
public void runContextualSearchInvocationChecksAndLogFailures_isFakeLandscape() {
when(mMockRecentsView.getPagedOrientationHandler()).thenReturn(mMockOrientationHandler);
when(mMockOrientationHandler.isLayoutNaturalToLauncher()).thenReturn(false);
assertFalse("Expect invocation checks to fail in fake landscape.",
mContextualSearchInvoker.runContextualSearchInvocationChecksAndLogFailures());
verifyNoMoreInteractions(mMockStatsLogManager);
}
@Test
public void invokeContextualSearchUncheckedWithHaptic_cssIsAvailable_commitHapticEnabled() {
try (AutoCloseable flag = overrideSearchHapticCommitFlag(true)) {