Merge "Add click logging for Smartspace media recommendation card" into sc-dev
This commit is contained in:
@@ -54,6 +54,7 @@ import com.android.systemui.animation.GhostedViewLaunchAnimatorController;
|
||||
import com.android.systemui.dagger.qualifiers.Background;
|
||||
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
|
||||
import com.android.systemui.util.animation.TransitionLayout;
|
||||
|
||||
@@ -519,7 +520,8 @@ public class MediaControlPanel {
|
||||
mediaCoverImageView.setImageIcon(recommendation.getIcon());
|
||||
|
||||
// Set up the click listener if applicable.
|
||||
setSmartspaceOnClickListener(mediaCoverImageView, recommendation, callback);
|
||||
setSmartspaceOnClickListener(mediaCoverImageView, recommendation,
|
||||
target.getSmartspaceTargetId(), callback);
|
||||
|
||||
setVisibleAndAlpha(expandedSet, mediaCoverItemsResIds.get(i), true);
|
||||
setVisibleAndAlpha(expandedSet, mediaLogoItemsResIds.get(i), true);
|
||||
@@ -614,6 +616,7 @@ public class MediaControlPanel {
|
||||
private void setSmartspaceOnClickListener(
|
||||
@NonNull View view,
|
||||
@NonNull SmartspaceAction action,
|
||||
@NonNull String targetId,
|
||||
@Nullable View.OnClickListener callback) {
|
||||
if (view == null || action == null || action.getIntent() == null) {
|
||||
Log.e(TAG, "No tap action can be set up");
|
||||
@@ -621,6 +624,16 @@ public class MediaControlPanel {
|
||||
}
|
||||
|
||||
view.setOnClickListener(v -> {
|
||||
// When media recommendation card is shown, there could be only one card.
|
||||
SysUiStatsLog.write(SysUiStatsLog.SMARTSPACE_CARD_REPORTED,
|
||||
760, // SMARTSPACE_CARD_CLICK
|
||||
targetId.hashCode(),
|
||||
SysUiStatsLog
|
||||
.SMART_SPACE_CARD_REPORTED__CARD_TYPE__HEADPHONE_MEDIA_RECOMMENDATIONS,
|
||||
getSurfaceForSmartspaceLogging(mMediaViewController.getCurrentEndLocation()),
|
||||
/* rank */ 1,
|
||||
/* cardinality */ 1);
|
||||
|
||||
mActivityStarter.postStartActivityDismissingKeyguard(
|
||||
action.getIntent(),
|
||||
0 /* delay */,
|
||||
@@ -630,4 +643,14 @@ public class MediaControlPanel {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private int getSurfaceForSmartspaceLogging(int currentEndLocation) {
|
||||
if (currentEndLocation == MediaHierarchyManager.LOCATION_QQS
|
||||
|| currentEndLocation == MediaHierarchyManager.LOCATION_QS) {
|
||||
return SysUiStatsLog.SMART_SPACE_CARD_REPORTED__DISPLAY_SURFACE__SHADE;
|
||||
} else if (currentEndLocation == MediaHierarchyManager.LOCATION_LOCKSCREEN) {
|
||||
return SysUiStatsLog.SMART_SPACE_CARD_REPORTED__DISPLAY_SURFACE__LOCKSCREEN;
|
||||
}
|
||||
return SysUiStatsLog.SMART_SPACE_CARD_REPORTED__DISPLAY_SURFACE__DEFAULT_SURFACE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,11 +70,10 @@ class MediaViewController @Inject constructor(
|
||||
* finished
|
||||
*/
|
||||
@MediaLocation
|
||||
private var currentEndLocation: Int = -1
|
||||
var currentEndLocation: Int = -1
|
||||
|
||||
/**
|
||||
* The ending location of the view where it ends when all animations and transitions have
|
||||
* finished
|
||||
* The starting location of the view where it starts for all animations and transitions
|
||||
*/
|
||||
@MediaLocation
|
||||
private var currentStartLocation: Int = -1
|
||||
|
||||
Reference in New Issue
Block a user