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

Commit fa71940a authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Log whether a bundle was ever opened as part of the dismiss event." into main

parents 58b7d28a 7629f260
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line 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.UiEvent
import com.android.internal.logging.UiEventLogger
import com.android.internal.logging.UiEventLogger
import com.android.internal.util.FrameworkStatsLog
import com.android.internal.util.FrameworkStatsLog
import com.android.systemui.notifications.ui.composable.row.BundleHeader
import com.android.systemui.statusbar.notification.collection.BundleEntry
import com.android.systemui.statusbar.notification.collection.BundleEntry
import javax.inject.Inject
import javax.inject.Inject


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

    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
    }
}
}