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

Commit 1a1e17c3 authored by Jieru Shi's avatar Jieru Shi Committed by Automerger Merge Worker
Browse files

Merge "Add click logging for Smartspace media recommendation card" into sc-dev am: 04c4a13e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14271917

Change-Id: Ic7750a91b7ea8a6ebec8bec38b8d2c9d98a8845e
parents 0ee3f027 04c4a13e
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -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;
    }
}
+2 −3
Original line number Diff line number Diff line
@@ -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