summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src
diff options
context:
space:
mode:
author Nicolò Mazzucato <nicomazz@google.com> 2023-09-07 12:16:06 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-09-07 12:16:06 +0000
commit9c115d55e6d178234c20e92d34f73910add561fb (patch)
treec30f572a25fd8ce4f897b57d8bec5a699abec0ea /packages/SystemUI/src
parentec39b9a459afa21168416adab309907dc6d6c892 (diff)
parentd0bb2106d0f2007f41f8517e4d0347100ae09894 (diff)
Merge "Consider only external displays as pending" into main
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r--packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt21
1 files changed, 16 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt b/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
index 82b032450938..01d689e584c0 100644
--- a/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
+++ b/packages/SystemUI/src/com/android/systemui/display/data/repository/DisplayRepository.kt
@@ -175,24 +175,35 @@ constructor(
initialValue = emptySet()
)
+ private val connectedExternalDisplayIds: Flow<Set<Int>> =
+ connectedDisplayIds
+ .map { connectedDisplayIds ->
+ connectedDisplayIds
+ .filter { id -> displayManager.getDisplay(id)?.type == Display.TYPE_EXTERNAL }
+ .toSet()
+ }
+ .flowOn(backgroundCoroutineDispatcher)
+ .debugLog("connectedExternalDisplayIds")
+
/**
* Pending displays are the ones connected, but not enabled and not ignored. A connected display
* is ignored after the user makes the decision to use it or not. For now, the initial decision
* from the user is final and not reversible.
*/
private val pendingDisplayIds: Flow<Set<Int>> =
- combine(enabledDisplayIds, connectedDisplayIds, ignoredDisplayIds) {
+ combine(enabledDisplayIds, connectedExternalDisplayIds, ignoredDisplayIds) {
enabledDisplaysIds,
- connectedDisplayIds,
+ connectedExternalDisplayIds,
ignoredDisplayIds ->
if (DEBUG) {
Log.d(
TAG,
- "combining enabled: $enabledDisplaysIds, " +
- "connected: $connectedDisplayIds, ignored: $ignoredDisplayIds"
+ "combining enabled=$enabledDisplaysIds, " +
+ "connectedExternalDisplayIds=$connectedExternalDisplayIds, " +
+ "ignored=$ignoredDisplayIds"
)
}
- connectedDisplayIds - enabledDisplaysIds - ignoredDisplayIds
+ connectedExternalDisplayIds - enabledDisplaysIds - ignoredDisplayIds
}
.debugLog("pendingDisplayIds")