Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 651c492e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add debug logging to PerDisplayStore" into main

parents 7ecd97f1 4ccf4e23
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -84,6 +84,10 @@ abstract class PerDisplayStoreImpl<T>(
                    "<${instanceClass.simpleName}> returning null because createInstanceForDisplay($displayId) returned null.",
                )
            } else {
                Log.d(
                    TAG,
                    "<${instanceClass.simpleName}> new instance created for displayId=$displayId",
                )
                perDisplayInstances[displayId] = newInstance
            }
            return newInstance
@@ -97,9 +101,19 @@ abstract class PerDisplayStoreImpl<T>(
        backgroundApplicationScope.launch("PerDisplayStore#<$instanceType>start") {
            displayRepository.displayRemovalEvent.collect { removedDisplayId ->
                val removedInstance = perDisplayInstances.remove(removedDisplayId)
                removedInstance?.let { onDisplayRemovalAction(it) }
                removedInstance?.let {
                    logRemovalAction(removedDisplayId)
                    onDisplayRemovalAction(it)
                }
            }
        }
    }

    protected fun logRemovalAction(displayId: Int) {
        Log.d(
            TAG,
            "<${instanceClass.simpleName}> removing instance created for displayId=$displayId",
        )
    }

    abstract val instanceClass: Class<T>
+4 −1
Original line number Diff line number Diff line
@@ -39,7 +39,10 @@ abstract class StatusBarPerDisplayStoreImpl<T>(
                .collect { removedDisplayIds ->
                    removedDisplayIds.forEach { removedDisplayId ->
                        val removedInstance = perDisplayInstances.remove(removedDisplayId)
                        removedInstance?.let { onDisplayRemovalAction(it) }
                        removedInstance?.let {
                            logRemovalAction(removedDisplayId)
                            onDisplayRemovalAction(it)
                        }
                    }
                }
        }