Add the SPA page enter/leave logging metrcis

- Update LogEvent adding mapped Action ID in theSettingsEnums.
- Add the SESSION_EXTERNAL and SESSION_UNKNOWN.

Fixes: 271793388
Bug: 253979024
Test: atest SpaLogDataTest MetricsDataModelTest
Change-Id: I565d5bebac46e82cc83e28bf532e1d3bcd76a473
This commit is contained in:
Sunny Shao
2023-03-06 16:27:33 +08:00
parent fd87f82382
commit 5c6e12a8d4
2 changed files with 10 additions and 6 deletions

View File

@@ -16,6 +16,7 @@
package com.android.settingslib.spa.framework.common
import android.app.settings.SettingsEnums
import android.os.Bundle
// Defines the category of the log, for quick filter
@@ -31,20 +32,21 @@ enum class LogCategory {
}
// Defines the log events in Spa.
enum class LogEvent {
enum class LogEvent(val action: Int) {
// Page related events.
PAGE_ENTER,
PAGE_LEAVE,
PAGE_ENTER(SettingsEnums.PAGE_VISIBLE),
PAGE_LEAVE(SettingsEnums.PAGE_HIDE),
// Entry related events.
ENTRY_CLICK,
ENTRY_SWITCH,
ENTRY_CLICK(SettingsEnums.ACTION_SETTINGS_TILE_CLICK),
ENTRY_SWITCH(SettingsEnums.ACTION_SETTINGS_PREFERENCE_CHANGE),
}
internal const val LOG_DATA_DISPLAY_NAME = "name"
internal const val LOG_DATA_SESSION_NAME = "session"
internal const val LOG_DATA_SWITCH_STATUS = "switch"
const val LOG_DATA_SESSION_NAME = "session"
/**
* The interface of logger in Spa
*/

View File

@@ -22,9 +22,11 @@ import com.android.settingslib.spa.framework.common.SettingsEntry
import com.android.settingslib.spa.framework.common.SettingsPage
import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory
const val SESSION_UNKNOWN = "unknown"
const val SESSION_BROWSE = "browse"
const val SESSION_SEARCH = "search"
const val SESSION_SLICE = "slice"
const val SESSION_EXTERNAL = "external"
const val KEY_DESTINATION = "spaActivityDestination"
const val KEY_HIGHLIGHT_ENTRY = "highlightEntry"