Update StatsLogManager to support ranking related events.

Change-Id: I238f00a782a620f704005d37c8972b5e25610c75
This commit is contained in:
thiruram 2020-06-09 17:24:29 -07:00 committed by Thiru Ramasamy
parent 23986e9a84
commit 236f40d97e
2 changed files with 45 additions and 0 deletions

View File

@ -104,6 +104,19 @@ public class StatsLogCompatManager extends StatsLogManager {
LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
}
/**
* Logs a ranking event and accompanying {@link InstanceId} and package name.
*/
@Override
public void log(EventEnum rankingEvent, InstanceId instanceId, @Nullable String packageName,
int position) {
SysUiStatsLog.write(SysUiStatsLog.RANKING_SELECTED,
rankingEvent.getId() /* event_id = 1; */,
packageName /* package_name = 2; */,
instanceId.getId() /* instance_id = 3; */,
position /* position_picked = 4; */);
}
/**
* Logs an event and accompanying {@link LauncherState}s. If either of the state refers
* to workspace state, then use pageIndex to pass in index of workspace.

View File

@ -141,6 +141,25 @@ public class StatsLogManager implements ResourceBasedOverride {
}
}
/**
* Launcher specific ranking related events.
*/
public enum LauncherRankingEvent implements EventEnum {
UNKNOWN(0);
// ADD MORE
private final int mId;
LauncherRankingEvent(int id) {
mId = id;
}
public int getId() {
return mId;
}
}
protected LogStateProvider mStateProvider;
/**
@ -181,6 +200,19 @@ public class StatsLogManager implements ResourceBasedOverride {
public void log(EventEnum event, InstanceId instanceId, @Nullable ItemInfo itemInfo) {
}
/**
* Log an event with ranked-choice information along with package. Does nothing if event.getId()
* <= 0.
*
* @param rankingEvent an enum implementing UiEventEnum interface.
* @param instanceId An identifier obtained from an InstanceIdSequence.
* @param packageName the package name of the relevant app, if known (null otherwise).
* @param position the position picked.
*/
public void log(EventEnum rankingEvent, InstanceId instanceId, @Nullable String packageName,
int position) {
}
/**
* Logs an event and accompanying {@link LauncherState}s. If either of the state refers
* to workspace state, then use pageIndex to pass in index of workspace.