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

Commit 2ccf4422 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB] Remove status_bar_use_repos_for_call_chip flag.

This flag was launched in 24Q4, which has been released for a month.

Bug: 328584859
Flag: EXEMPT flag removal
Test: Post call notification -> verify call chip still appears
Change-Id: If3b0575b90cee6c766b829c5b40364a27de08d08
parent 33c2d333
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -423,17 +423,6 @@ flag {
    }
}

flag {
    name: "status_bar_use_repos_for_call_chip"
    namespace: "systemui"
    description: "Use repositories as the source of truth for call notifications shown as a chip in"
        "the status bar"
    bug: "328584859"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "status_bar_call_chip_notification_icon"
    namespace: "systemui"
+1 −5
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags.FLAG_STATUS_BAR_CALL_CHIP_NOTIFICATION_ICON
import com.android.systemui.Flags.FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS
import com.android.systemui.Flags.FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP
import com.android.systemui.SysuiTestCase
import com.android.systemui.concurrency.fakeExecutor
import com.android.systemui.dump.DumpManager
@@ -42,7 +41,6 @@ import com.android.systemui.res.R
import com.android.systemui.statusbar.StatusBarIconView
import com.android.systemui.statusbar.data.repository.fakeStatusBarModeRepository
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
import com.android.systemui.statusbar.notification.data.model.activeNotificationModel
import com.android.systemui.statusbar.notification.data.repository.ActiveNotificationsStore
import com.android.systemui.statusbar.notification.data.repository.activeNotificationListRepository
@@ -76,9 +74,8 @@ import org.mockito.kotlin.whenever
@RunWith(AndroidJUnit4::class)
@TestableLooper.RunWithLooper
@OptIn(ExperimentalCoroutinesApi::class)
@EnableFlags(FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP)
@DisableFlags(StatusBarChipsModernization.FLAG_NAME)
class OngoingCallControllerViaRepoTest : SysuiTestCase() {
class OngoingCallControllerTest : SysuiTestCase() {
    private val kosmos = Kosmos()

    private val clock = kosmos.fakeSystemClock
@@ -114,7 +111,6 @@ class OngoingCallControllerViaRepoTest : SysuiTestCase() {
                testScope.backgroundScope,
                context,
                ongoingCallRepository,
                mock<CommonNotifCollection>(),
                kosmos.activeNotificationsInteractor,
                clock,
                mockActivityStarter,
+0 −694

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −23
Original line number Diff line number Diff line
@@ -23,13 +23,7 @@ import com.android.server.notification.Flags.crossAppPoliteNotifications
import com.android.server.notification.Flags.politeNotifications
import com.android.server.notification.Flags.vibrateWhileUnlocked
import com.android.systemui.Flags.FLAG_COMMUNAL_HUB
import com.android.systemui.Flags.FLAG_STATUS_BAR_CALL_CHIP_NOTIFICATION_ICON
import com.android.systemui.Flags.FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS
import com.android.systemui.Flags.FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP
import com.android.systemui.Flags.communalHub
import com.android.systemui.Flags.statusBarCallChipNotificationIcon
import com.android.systemui.Flags.statusBarScreenSharingChips
import com.android.systemui.Flags.statusBarUseReposForCallChip
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.shared.flag.SceneContainerFlag
import com.android.systemui.shade.shared.flag.DualShade
@@ -63,10 +57,6 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha

        // DualShade dependencies
        DualShade.token dependsOn SceneContainerFlag.getMainAconfigFlag()

        // Status bar chip dependencies
        statusBarCallChipNotificationIconToken dependsOn statusBarUseReposForCallChipToken
        statusBarCallChipNotificationIconToken dependsOn statusBarScreenSharingChipsToken
    }

    private inline val politeNotifications
@@ -86,17 +76,4 @@ class FlagDependencies @Inject constructor(featureFlags: FeatureFlagsClassic, ha

    private inline val communalHub
        get() = FlagToken(FLAG_COMMUNAL_HUB, communalHub())

    private inline val statusBarCallChipNotificationIconToken
        get() =
            FlagToken(
                FLAG_STATUS_BAR_CALL_CHIP_NOTIFICATION_ICON,
                statusBarCallChipNotificationIcon(),
            )

    private inline val statusBarScreenSharingChipsToken
        get() = FlagToken(FLAG_STATUS_BAR_SCREEN_SHARING_CHIPS, statusBarScreenSharingChips())

    private inline val statusBarUseReposForCallChipToken
        get() = FlagToken(FLAG_STATUS_BAR_USE_REPOS_FOR_CALL_CHIP, statusBarUseReposForCallChip())
}
+15 −104
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.systemui.statusbar.phone.ongoingcall

import android.app.ActivityManager
import android.app.IActivityManager
import android.app.Notification
import android.app.Notification.CallStyle.CALL_TYPE_ONGOING
import android.app.PendingIntent
import android.app.UidObserver
import android.content.Context
@@ -44,9 +42,6 @@ import com.android.systemui.statusbar.chips.ui.view.ChipBackgroundContainer
import com.android.systemui.statusbar.chips.ui.view.ChipChronometer
import com.android.systemui.statusbar.data.repository.StatusBarModeRepositoryStore
import com.android.systemui.statusbar.gesture.SwipeStatusBarAwayGestureHandler
import com.android.systemui.statusbar.notification.collection.NotificationEntry
import com.android.systemui.statusbar.notification.collection.notifcollection.CommonNotifCollection
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener
import com.android.systemui.statusbar.notification.domain.interactor.ActiveNotificationsInteractor
import com.android.systemui.statusbar.notification.shared.ActiveNotificationModel
import com.android.systemui.statusbar.notification.shared.CallType
@@ -60,7 +55,9 @@ import java.util.concurrent.Executor
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope

/** A controller to handle the ongoing call chip in the collapsed status bar.
/**
 * A controller to handle the ongoing call chip in the collapsed status bar.
 *
 * @deprecated Use [OngoingCallInteractor] instead, which follows recommended architecture patterns
 */
@Deprecated("Use OngoingCallInteractor instead")
@@ -71,7 +68,6 @@ constructor(
    @Application private val scope: CoroutineScope,
    private val context: Context,
    private val ongoingCallRepository: OngoingCallRepository,
    private val notifCollection: CommonNotifCollection,
    private val activeNotificationsInteractor: ActiveNotificationsInteractor,
    private val systemClock: SystemClock,
    private val activityStarter: ActivityStarter,
@@ -90,90 +86,12 @@ constructor(

    private val mListeners: MutableList<OngoingCallListener> = mutableListOf()
    private val uidObserver = CallAppUidObserver()
    private val notifListener =
        object : NotifCollectionListener {
            // Temporary workaround for b/178406514 for testing purposes.
            //
            // b/178406514 means that posting an incoming call notif then updating it to an ongoing
            // call notif does not work (SysUI never receives the update). This workaround allows us
            // to trigger the ongoing call chip when an ongoing call notif is *added* rather than
            // *updated*, allowing us to test the chip.
            //
            // TODO(b/183229367): Remove this function override when b/178406514 is fixed.
            override fun onEntryAdded(entry: NotificationEntry) {
                onEntryUpdated(entry, true)
            }

            override fun onEntryUpdated(entry: NotificationEntry) {
                StatusBarUseReposForCallChip.assertInLegacyMode()
                // We have a new call notification or our existing call notification has been
                // updated.
                // TODO(b/183229367): This likely won't work if you take a call from one app then
                //  switch to a call from another app.
                if (
                    callNotificationInfo == null && isCallNotification(entry) ||
                        (entry.sbn.key == callNotificationInfo?.key)
                ) {
                    val newOngoingCallInfo =
                        CallNotificationInfo(
                            entry.sbn.key,
                            entry.sbn.notification.getWhen(),
                            // In this old listener pattern, we don't have access to the
                            // notification icon.
                            notificationIconView = null,
                            entry.sbn.notification.contentIntent,
                            entry.sbn.uid,
                            entry.sbn.notification.extras.getInt(
                                Notification.EXTRA_CALL_TYPE,
                                -1,
                            ) == CALL_TYPE_ONGOING,
                            statusBarSwipedAway = callNotificationInfo?.statusBarSwipedAway ?: false,
                        )
                    if (newOngoingCallInfo == callNotificationInfo) {
                        return
                    }

                    callNotificationInfo = newOngoingCallInfo
                    if (newOngoingCallInfo.isOngoing) {
                        logger.log(
                            TAG,
                            LogLevel.DEBUG,
                            { str1 = newOngoingCallInfo.key },
                            { "Call notif *is* ongoing -> showing chip. key=$str1" },
                        )
                        updateChip()
                    } else {
                        logger.log(
                            TAG,
                            LogLevel.DEBUG,
                            { str1 = newOngoingCallInfo.key },
                            { "Call notif not ongoing -> hiding chip. key=$str1" },
                        )
                        removeChip()
                    }
                }
            }

            override fun onEntryRemoved(entry: NotificationEntry, reason: Int) {
                if (entry.sbn.key == callNotificationInfo?.key) {
                    logger.log(
                        TAG,
                        LogLevel.DEBUG,
                        { str1 = entry.sbn.key },
                        { "Call notif removed -> hiding chip. key=$str1" },
                    )
                    removeChip()
                }
            }
        }

    override fun start() {
        if (StatusBarChipsModernization.isEnabled)
            return
        if (StatusBarChipsModernization.isEnabled) return

        dumpManager.registerDumpable(this)

        if (Flags.statusBarUseReposForCallChip()) {
        scope.launch {
            // Listening to [ActiveNotificationsInteractor] instead of using
            // [NotifCollectionListener#onEntryUpdated] is better for two reasons:
@@ -187,9 +105,6 @@ constructor(
                updateInfoFromNotifModel(it)
            }
        }
        } else {
            notifCollection.addCollectionListener(notifListener)
        }

        scope.launch {
            statusBarModeRepository.defaultDisplay.isInFullscreenMode.collect {
@@ -597,8 +512,4 @@ constructor(
    }
}

private fun isCallNotification(entry: NotificationEntry): Boolean {
    return entry.sbn.notification.isStyle(Notification.CallStyle::class.java)
}

private const val TAG = OngoingCallRepository.TAG
Loading