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

Commit 7629f260 authored by Yuri Lin's avatar Yuri Lin
Browse files

Log whether a bundle was ever opened as part of the dismiss event.

Bug: 415113012
Test: manual by dismissing bundles that have or haven't been opened & observing atom tester
Flag: com.android.systemui.notification_bundle_ui
Change-Id: I8f59cfbb05e927dc0289371cd2a69ba59cf97985
parent 5e44f848
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.notification
import com.android.internal.logging.UiEvent
import com.android.internal.logging.UiEventLogger
import com.android.internal.util.FrameworkStatsLog
import com.android.systemui.notifications.ui.composable.row.BundleHeader
import com.android.systemui.statusbar.notification.collection.BundleEntry
import javax.inject.Inject

@@ -35,8 +36,16 @@ class BundleInteractionLogger @Inject constructor() {
            FrameworkStatsLog.NOTIFICATION_BUNDLE_INTERACTED,
            /* optional int32 event_id */ BundleInteractedEvent.NOTIF_BUNDLE_DISMISSED.id,
            /* optional int32 type */ bundle.bundleRepository.bundleType,
            // TODO: b/415113012 - correctly reflect whether the bundle was ever expanded
            /* optional bool contents_shown */ false,
            /* optional bool contents_shown */ bundleContentsShown(bundle),
        )
    }

    fun bundleContentsShown(bundle: BundleEntry): Boolean {
        // Consider a bundle's contents to have been shown either if it has ever been collapsed
        // before or if it's expanded now. Otherwise, assume it to have never been opened.
        // TODO: b/422234721 - this logic doesn't correctly handle if the bundle was collapsed by
        //                     the entire shade closing rather than directly by the user
        return (bundle.bundleRepository.lastCollapseTime > 0L) ||
            bundle.bundleRepository.state?.currentScene == BundleHeader.Scenes.Expanded
    }
}