Loading packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt +20 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.WindowManager import android.view.WindowManager.LayoutParams import android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE import android.window.WindowContext import com.android.app.tracing.TrackGroupUtils.trackGroup import com.android.systemui.CoreStartable import com.android.systemui.common.ui.ConfigurationState import com.android.systemui.common.ui.ConfigurationStateImpl Loading @@ -34,6 +35,8 @@ import com.android.systemui.common.ui.view.ChoreographerUtils import com.android.systemui.common.ui.view.ChoreographerUtilsImpl import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import com.android.systemui.res.R import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.shade.data.repository.MutableShadeDisplaysRepository Loading Loading @@ -266,6 +269,20 @@ object ShadeDisplayAwareModule { @Provides @ShadeOnDefaultDisplayWhenLocked fun provideShadeOnDefaultDisplayWhenLocked(): Boolean = true /** Provides a [LogBuffer] for use by classes related to shade movement */ @Provides @SysUISingleton @ShadeDisplayLog fun provideShadeDisplayLogLogBuffer(factory: LogBufferFactory): LogBuffer { val logBufferName = "ShadeDisplayLog" return factory.create( logBufferName, maxSize = 400, alwaysLogToLogcat = true, systraceTrackName = trackGroup("shade", logBufferName), ) } } /** Module that should be included only if the shade window [WindowRootView] is available. */ Loading Loading @@ -298,3 +315,6 @@ object ShadeDisplayAwareWithShadeWindowModule { * how well this solution behaves from the performance point of view. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class ShadeOnDefaultDisplayWhenLocked /** A [com.android.systemui.log.LogBuffer] for changes to the shade display. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class ShadeDisplayLog packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt +15 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import com.android.systemui.CoreStartable import com.android.systemui.common.ui.data.repository.ConfigurationRepository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.shade.data.repository.ShadeDisplaysRepository import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shade.domain.interactor.ShadeModeInteractor Loading @@ -42,6 +44,7 @@ constructor( private val shadeDisplaysRepository: Lazy<ShadeDisplaysRepository>, @ShadeDisplayAware private val configurationRepository: ConfigurationRepository, @Application private val scope: CoroutineScope, @ShadeDisplayLog private val logBuffer: LogBuffer, ) : CoreStartable { override fun start() { scope.launchTraced("ShadeStateTraceLogger") { Loading Loading @@ -72,6 +75,18 @@ constructor( "configurationChange#smallestScreenWidthDp", it.smallestScreenWidthDp, ) logBuffer.log( "ShadeStateTraceLogger", LogLevel.DEBUG, { int1 = it.smallestScreenWidthDp int2 = it.densityDpi }, { "New configuration change from Shade window. " + "smallestScreenWidthDp: $int1, densityDpi: $int2" }, ) } } } Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractor.kt +24 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,11 @@ import com.android.systemui.common.ui.data.repository.ConfigurationRepository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.ShadeDisplayChangeLatencyTracker import com.android.systemui.shade.ShadeDisplayLog import com.android.systemui.shade.ShadeTraceLogger.logMoveShadeWindowTo import com.android.systemui.shade.ShadeTraceLogger.t import com.android.systemui.shade.ShadeTraceLogger.traceReparenting Loading Loading @@ -69,6 +72,7 @@ constructor( private val notificationRebindingTracker: NotificationRebindingTracker, private val notificationStackRebindingHider: NotificationStackRebindingHider, @ShadeDisplayAware private val configForwarder: ConfigurationForwarder, @ShadeDisplayLog private val logBuffer: LogBuffer, ) : CoreStartable { private val hasActiveNotifications: Boolean Loading Loading @@ -101,7 +105,12 @@ constructor( /** Tries to move the shade. If anything wrong happens, fails gracefully without crashing. */ private suspend fun moveShadeWindowTo(destinationId: Int) { Log.d(TAG, "Trying to move shade window to display with id $destinationId") logBuffer.log( TAG, LogLevel.DEBUG, { int1 = destinationId }, { "Trying to move shade window to display with id $int1" }, ) logMoveShadeWindowTo(destinationId) var currentId = -1 try { Loading @@ -113,7 +122,12 @@ constructor( val currentDisplay = shadeContext.display ?: error("Current shade display is null") currentId = currentDisplay.displayId if (currentId == destinationId) { Log.w(TAG, "Trying to move the shade to a display ($currentId) it was already in ") logBuffer.log( TAG, LogLevel.WARNING, { int1 = currentId }, { "Trying to move the shade to a display ($int1) it was already in." }, ) return } Loading @@ -128,9 +142,14 @@ constructor( } } } catch (e: IllegalStateException) { Log.e( logBuffer.log( TAG, "Unable to move the shade window from display $currentId to $destinationId", LogLevel.ERROR, { int1 = currentId int2 = destinationId }, { "Unable to move the shade window from display $int1 to $int2" }, e, ) } Loading Loading @@ -200,7 +219,7 @@ constructor( } private fun errorLog(s: String) { Log.e(TAG, s) logBuffer.log(TAG, LogLevel.ERROR, s) } private fun checkContextDisplayMatchesExpected(destinationId: Int) { Loading packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.window.WindowContext import com.android.systemui.common.ui.data.repository.configurationRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.shade.ShadeDisplayChangeLatencyTracker import com.android.systemui.shade.ShadeWindowLayoutParams import com.android.systemui.shade.data.repository.fakeShadeDisplaysRepository Loading Loading @@ -60,5 +61,6 @@ val Kosmos.shadeDisplaysInteractor by notificationRebindingTracker, notificationStackRebindingHider, configurationController, logcatLogBuffer("ShadeDisplaysInteractor"), ) } Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayAwareModule.kt +20 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.view.WindowManager import android.view.WindowManager.LayoutParams import android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE import android.window.WindowContext import com.android.app.tracing.TrackGroupUtils.trackGroup import com.android.systemui.CoreStartable import com.android.systemui.common.ui.ConfigurationState import com.android.systemui.common.ui.ConfigurationStateImpl Loading @@ -34,6 +35,8 @@ import com.android.systemui.common.ui.view.ChoreographerUtils import com.android.systemui.common.ui.view.ChoreographerUtilsImpl import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.log.LogBuffer import com.android.systemui.log.LogBufferFactory import com.android.systemui.res.R import com.android.systemui.scene.ui.view.WindowRootView import com.android.systemui.shade.data.repository.MutableShadeDisplaysRepository Loading Loading @@ -266,6 +269,20 @@ object ShadeDisplayAwareModule { @Provides @ShadeOnDefaultDisplayWhenLocked fun provideShadeOnDefaultDisplayWhenLocked(): Boolean = true /** Provides a [LogBuffer] for use by classes related to shade movement */ @Provides @SysUISingleton @ShadeDisplayLog fun provideShadeDisplayLogLogBuffer(factory: LogBufferFactory): LogBuffer { val logBufferName = "ShadeDisplayLog" return factory.create( logBufferName, maxSize = 400, alwaysLogToLogcat = true, systraceTrackName = trackGroup("shade", logBufferName), ) } } /** Module that should be included only if the shade window [WindowRootView] is available. */ Loading Loading @@ -298,3 +315,6 @@ object ShadeDisplayAwareWithShadeWindowModule { * how well this solution behaves from the performance point of view. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class ShadeOnDefaultDisplayWhenLocked /** A [com.android.systemui.log.LogBuffer] for changes to the shade display. */ @Qualifier @Retention(AnnotationRetention.RUNTIME) annotation class ShadeDisplayLog
packages/SystemUI/src/com/android/systemui/shade/ShadeStateTraceLogger.kt +15 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,8 @@ import com.android.systemui.CoreStartable import com.android.systemui.common.ui.data.repository.ConfigurationRepository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.shade.data.repository.ShadeDisplaysRepository import com.android.systemui.shade.domain.interactor.ShadeInteractor import com.android.systemui.shade.domain.interactor.ShadeModeInteractor Loading @@ -42,6 +44,7 @@ constructor( private val shadeDisplaysRepository: Lazy<ShadeDisplaysRepository>, @ShadeDisplayAware private val configurationRepository: ConfigurationRepository, @Application private val scope: CoroutineScope, @ShadeDisplayLog private val logBuffer: LogBuffer, ) : CoreStartable { override fun start() { scope.launchTraced("ShadeStateTraceLogger") { Loading Loading @@ -72,6 +75,18 @@ constructor( "configurationChange#smallestScreenWidthDp", it.smallestScreenWidthDp, ) logBuffer.log( "ShadeStateTraceLogger", LogLevel.DEBUG, { int1 = it.smallestScreenWidthDp int2 = it.densityDpi }, { "New configuration change from Shade window. " + "smallestScreenWidthDp: $int1, densityDpi: $int2" }, ) } } } Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractor.kt +24 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,11 @@ import com.android.systemui.common.ui.data.repository.ConfigurationRepository import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.log.LogBuffer import com.android.systemui.log.core.LogLevel import com.android.systemui.shade.ShadeDisplayAware import com.android.systemui.shade.ShadeDisplayChangeLatencyTracker import com.android.systemui.shade.ShadeDisplayLog import com.android.systemui.shade.ShadeTraceLogger.logMoveShadeWindowTo import com.android.systemui.shade.ShadeTraceLogger.t import com.android.systemui.shade.ShadeTraceLogger.traceReparenting Loading Loading @@ -69,6 +72,7 @@ constructor( private val notificationRebindingTracker: NotificationRebindingTracker, private val notificationStackRebindingHider: NotificationStackRebindingHider, @ShadeDisplayAware private val configForwarder: ConfigurationForwarder, @ShadeDisplayLog private val logBuffer: LogBuffer, ) : CoreStartable { private val hasActiveNotifications: Boolean Loading Loading @@ -101,7 +105,12 @@ constructor( /** Tries to move the shade. If anything wrong happens, fails gracefully without crashing. */ private suspend fun moveShadeWindowTo(destinationId: Int) { Log.d(TAG, "Trying to move shade window to display with id $destinationId") logBuffer.log( TAG, LogLevel.DEBUG, { int1 = destinationId }, { "Trying to move shade window to display with id $int1" }, ) logMoveShadeWindowTo(destinationId) var currentId = -1 try { Loading @@ -113,7 +122,12 @@ constructor( val currentDisplay = shadeContext.display ?: error("Current shade display is null") currentId = currentDisplay.displayId if (currentId == destinationId) { Log.w(TAG, "Trying to move the shade to a display ($currentId) it was already in ") logBuffer.log( TAG, LogLevel.WARNING, { int1 = currentId }, { "Trying to move the shade to a display ($int1) it was already in." }, ) return } Loading @@ -128,9 +142,14 @@ constructor( } } } catch (e: IllegalStateException) { Log.e( logBuffer.log( TAG, "Unable to move the shade window from display $currentId to $destinationId", LogLevel.ERROR, { int1 = currentId int2 = destinationId }, { "Unable to move the shade window from display $int1 to $int2" }, e, ) } Loading Loading @@ -200,7 +219,7 @@ constructor( } private fun errorLog(s: String) { Log.e(TAG, s) logBuffer.log(TAG, LogLevel.ERROR, s) } private fun checkContextDisplayMatchesExpected(destinationId: Int) { Loading
packages/SystemUI/tests/utils/src/com/android/systemui/shade/domain/interactor/ShadeDisplaysInteractorKosmos.kt +2 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.window.WindowContext import com.android.systemui.common.ui.data.repository.configurationRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.testScope import com.android.systemui.log.logcatLogBuffer import com.android.systemui.shade.ShadeDisplayChangeLatencyTracker import com.android.systemui.shade.ShadeWindowLayoutParams import com.android.systemui.shade.data.repository.fakeShadeDisplaysRepository Loading Loading @@ -60,5 +61,6 @@ val Kosmos.shadeDisplaysInteractor by notificationRebindingTracker, notificationStackRebindingHider, configurationController, logcatLogBuffer("ShadeDisplaysInteractor"), ) }