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

Commit 9891a20a authored by David Saff's avatar David Saff
Browse files

Introduce DeprecatedSysuiVisibleForTesting, and use in one place

See go/internal-harmful for reasoning.

Bug: 358139604
Test: See bug for ABTD run showing fewer compilation errors
Flag: TEST_ONLY
Change-Id: I74468eb4f7aaa373c4b269f071113b0d69dce428
parent d8593110
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChang
import com.android.systemui.statusbar.policy.ConfigurationController
import com.android.systemui.statusbar.policy.ZenModeController
import com.android.systemui.statusbar.policy.domain.interactor.ZenModeInteractor
import com.android.systemui.util.annotations.DeprecatedSysuiVisibleForTesting
import com.android.systemui.util.concurrency.DelayableExecutor
import java.util.Locale
import java.util.TimeZone
@@ -392,8 +393,9 @@ constructor(
            }
        }

    @VisibleForTesting
    internal fun listenForDnd(scope: CoroutineScope): Job {
    @DeprecatedSysuiVisibleForTesting
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun listenForDnd(scope: CoroutineScope): Job {
        ModesUi.unsafeAssertInNewMode()
        return scope.launch {
            zenModeInteractor.dndMode.collect {
@@ -592,8 +594,9 @@ constructor(
        dozeAmount.value = doze
    }

    @VisibleForTesting
    internal fun listenForDozeAmountTransition(scope: CoroutineScope): Job {
    @DeprecatedSysuiVisibleForTesting
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun listenForDozeAmountTransition(scope: CoroutineScope): Job {
        return scope.launch {
            merge(
                    keyguardTransitionInteractor.transition(Edge.create(AOD, LOCKSCREEN)).map {
@@ -609,8 +612,9 @@ constructor(
    /**
     * When keyguard is displayed again after being gone, the clock must be reset to full dozing.
     */
    @VisibleForTesting
    internal fun listenForAnyStateToAodTransition(scope: CoroutineScope): Job {
    @DeprecatedSysuiVisibleForTesting
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun listenForAnyStateToAodTransition(scope: CoroutineScope): Job {
        return scope.launch {
            keyguardTransitionInteractor
                .transition(Edge.create(to = AOD))
@@ -620,8 +624,9 @@ constructor(
        }
    }

    @VisibleForTesting
    internal fun listenForAnyStateToLockscreenTransition(scope: CoroutineScope): Job {
    @DeprecatedSysuiVisibleForTesting
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun listenForAnyStateToLockscreenTransition(scope: CoroutineScope): Job {
        return scope.launch {
            keyguardTransitionInteractor
                .transition(Edge.create(to = LOCKSCREEN))
@@ -635,8 +640,9 @@ constructor(
     * When keyguard is displayed due to pulsing notifications when AOD is off, we should make sure
     * clock is in dozing state instead of LS state
     */
    @VisibleForTesting
    internal fun listenForAnyStateToDozingTransition(scope: CoroutineScope): Job {
    @DeprecatedSysuiVisibleForTesting
    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
    fun listenForAnyStateToDozingTransition(scope: CoroutineScope): Job {
        return scope.launch {
            keyguardTransitionInteractor
                .transition(Edge.create(to = DOZING))
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.util.annotations

/**
 * Given the effort in go/internal-harmful to eliminate the attempt to use Kotlin `internal` as a
 * test-visibility marker, we are centrally moving these APIs to public, marked both with
 * [VisibleForTesting] and this annotation. Ideally, over time, these APIs should be replaced with
 * explicit named testing APIs (see go/internal-harmful)
 */
@Deprecated(
    "Indicates an API that has been marked @VisibleForTesting, but requires further thought"
)
annotation class DeprecatedSysuiVisibleForTesting()