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

Commit 7838fee3 authored by Ale Nijamkin's avatar Ale Nijamkin Committed by Automerger Merge Worker
Browse files

Merge "[flexiglass] Adds logging for scene and visibility changes." into...

Merge "[flexiglass] Adds logging for scene and visibility changes." into udc-qpr-dev am: 98870fa0 am: f998a665

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24296061



Change-Id: I36180d7e9463078f07b9cc83a3d0dfe74826437f
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents feebd616 f998a665
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -127,10 +127,12 @@ constructor(
                repository.setMessage(message ?: promptMessage(getAuthenticationMethod()))
                sceneInteractor.setCurrentScene(
                    scene = SceneModel(SceneKey.Bouncer),
                    loggingReason = "request to unlock device while authentication required",
                )
            } else {
                sceneInteractor.setCurrentScene(
                    scene = SceneModel(SceneKey.Gone),
                    loggingReason = "request to unlock device while authentication isn't required",
                )
            }
        }
@@ -176,6 +178,7 @@ constructor(
        if (isAuthenticated) {
            sceneInteractor.setCurrentScene(
                scene = SceneModel(SceneKey.Gone),
                loggingReason = "successful authentication",
            )
        } else {
            repository.setMessage(errorMessage(getAuthenticationMethod()))
+8 −0
Original line number Diff line number Diff line
@@ -496,4 +496,12 @@ public class LogModule {
    public static LogBuffer provideDisplayMetricsRepoLogBuffer(LogBufferFactory factory) {
        return factory.create("DisplayMetricsRepo", 50);
    }

    /** Provides a {@link LogBuffer} for the scene framework. */
    @Provides
    @SysUISingleton
    @SceneFrameworkLog
    public static LogBuffer provideSceneFrameworkLogBuffer(LogBufferFactory factory) {
        return factory.create("SceneFramework", 50);
    }
}
+25 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.dagger

import javax.inject.Qualifier

/** A [com.android.systemui.log.LogBuffer] for the Scene Framework. */
@Qualifier
@MustBeDocumented
@Retention(AnnotationRetention.RUNTIME)
annotation class SceneFrameworkLog
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
                            // If scene framework is enabled, set the scene container window to
                            // visible and let the touch "slip" into that window.
                            if (mFeatureFlags.isEnabled(Flags.SCENE_CONTAINER)) {
                                mSceneInteractor.get().setVisible(true);
                                mSceneInteractor.get().setVisible(true, "swipe down on launcher");
                            } else {
                                centralSurfaces.onInputFocusTransfer(
                                        mInputFocusTransferStarted, false /* cancel */,
+23 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.scene.domain.interactor

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.data.repository.SceneContainerRepository
import com.android.systemui.scene.shared.logger.SceneLogger
import com.android.systemui.scene.shared.model.ObservableTransitionState
import com.android.systemui.scene.shared.model.RemoteUserInput
import com.android.systemui.scene.shared.model.SceneKey
@@ -41,6 +42,7 @@ class SceneInteractor
@Inject
constructor(
    private val repository: SceneContainerRepository,
    private val logger: SceneLogger,
) {

    /**
@@ -54,8 +56,17 @@ constructor(
    }

    /** Sets the scene in the container with the given name. */
    fun setCurrentScene(scene: SceneModel) {
    fun setCurrentScene(scene: SceneModel, loggingReason: String) {
        val currentSceneKey = repository.currentScene.value.key
        if (currentSceneKey == scene.key) {
            return
        }

        logger.logSceneChange(
            from = currentSceneKey,
            to = scene.key,
            reason = loggingReason,
        )
        repository.setCurrentScene(scene)
        repository.setSceneTransition(from = currentSceneKey, to = scene.key)
    }
@@ -64,7 +75,17 @@ constructor(
    val currentScene: StateFlow<SceneModel> = repository.currentScene

    /** Sets the visibility of the container with the given name. */
    fun setVisible(isVisible: Boolean) {
    fun setVisible(isVisible: Boolean, loggingReason: String) {
        val wasVisible = repository.isVisible.value
        if (wasVisible == isVisible) {
            return
        }

        logger.logVisibilityChange(
            from = wasVisible,
            to = isVisible,
            reason = loggingReason,
        )
        return repository.setVisible(isVisible)
    }

Loading