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

Commit 26cd5061 authored by Andreas Miko's avatar Andreas Miko Committed by Android (Google) Code Review
Browse files

Merge changes Ieb39f19d,I76568de0 into main

* changes:
  [SceneContainer] Log SceneFramework to Logcat
  [SceneContainer] Log all transitions
parents 6ca97d84 e0bc2d6e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ class QSTileLoggerTest : SysuiTestCase() {
    @Before
    fun setup() {
        MockitoAnnotations.initMocks(this)
        whenever(logBufferFactory.create(any(), any(), any())).thenReturn(logBuffer)
        whenever(logBufferFactory.create(any(), any(), any(), any())).thenReturn(logBuffer)
        val tileSpec: TileSpec = TileSpec.create("chatty_tile")
        underTest =
            QSTileLogger(mapOf(tileSpec to chattyLogBuffer), logBufferFactory, statusBarController)
+8 −3
Original line number Diff line number Diff line
@@ -19,10 +19,13 @@ package com.android.systemui.log
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.log.LogBufferHelper.Companion.adjustMaxSize
import com.android.systemui.log.echo.LogcatEchoTrackerAlways
import javax.inject.Inject

@SysUISingleton
class LogBufferFactory @Inject constructor(
class LogBufferFactory
@Inject
constructor(
    private val dumpManager: DumpManager,
    private val logcatEchoTracker: LogcatEchoTracker
) {
@@ -30,9 +33,11 @@ class LogBufferFactory @Inject constructor(
    fun create(
        name: String,
        maxSize: Int,
        systrace: Boolean = true
        systrace: Boolean = true,
        alwaysLogToLogcat: Boolean = false,
    ): LogBuffer {
        val buffer = LogBuffer(name, adjustMaxSize(maxSize), logcatEchoTracker, systrace)
        val echoTracker = if (alwaysLogToLogcat) LogcatEchoTrackerAlways else logcatEchoTracker
        val buffer = LogBuffer(name, adjustMaxSize(maxSize), echoTracker, systrace)
        dumpManager.registerBuffer(name, buffer)
        return buffer
    }
+2 −1
Original line number Diff line number Diff line
@@ -622,7 +622,8 @@ public class LogModule {
    @SysUISingleton
    @SceneFrameworkLog
    public static LogBuffer provideSceneFrameworkLogBuffer(LogBufferFactory factory) {
        return factory.create("SceneFramework", 50);
        return factory
                .create("SceneFramework", 50, /* systrace */ true, /* alwaysLogToLogcat */  true);
    }

    /** Provides a {@link LogBuffer} for the bluetooth QS tile dialog. */
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.log.echo

import com.android.systemui.log.LogcatEchoTracker
import com.android.systemui.log.core.LogLevel

/**
 * The buffer and all of its tags will be logged to logcat at all times.
 *
 * This can be used for buffers that are important and should appear in bugreports in logcat
 * directly.
 */
object LogcatEchoTrackerAlways : LogcatEchoTracker {
    override fun isBufferLoggable(bufferName: String, level: LogLevel): Boolean = true

    override fun isTagLoggable(tagName: String, level: LogLevel): Boolean = true
}
+9 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.stateIn

/**
@@ -102,7 +103,14 @@ constructor(
     * 2. When transitioning, which scenes are being transitioned between.
     * 3. When transitioning, what the progress of the transition is.
     */
    val transitionState: StateFlow<ObservableTransitionState> = repository.transitionState
    val transitionState: StateFlow<ObservableTransitionState> =
        repository.transitionState
            .onEach { logger.logSceneTransition(it) }
            .stateIn(
                scope = applicationScope,
                started = SharingStarted.Eagerly,
                initialValue = repository.transitionState.value,
            )

    /**
     * The key of the scene that the UI is currently transitioning to or `null` if there is no
Loading