Only make Recents activity invisible if not focused on TV devices.
Change was introduced in b/28246419 to fix Recents activity visibility
issues on TV, but was causing other issues on phones. So, only apply
rule on TV devices.
Bug: 28246419
Bug: 28943853
Change-Id: Icd19eae4ffa5e0a798bc9f63bc7a6c9a60422236
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 8b637e0..ba044cc4 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1832,9 +1832,9 @@
boolean isVisible =
!behindFullscreenActivity || r.mLaunchTaskBehind || activityVisibleBehind;
- if (isVisible && r.isRecentsActivity()) {
- // Recents activity can only be visible if the home stack is the focused stack or we are
- // in split-screen mode.
+ if (mService.mSupportsLeanbackOnly && isVisible && r.isRecentsActivity()) {
+ // On devices that support leanback only (Android TV), Recents activity can only be
+ // visible if the home stack is the focused stack or we are in split-screen mode.
isVisible = mStackSupervisor.getStack(DOCKED_STACK_ID) != null
|| mStackSupervisor.isFocusedStack(this);
}