Add click logging for media player seekbar interaction.
Bug: 181364757 Test: will append statsd_drive logs Change-Id: I8d299ef3c06bfb541bf048a0f1c86f7cfb2f0ce1
This commit is contained in:
@@ -64,6 +64,7 @@ import java.util.concurrent.Executor;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import dagger.Lazy;
|
||||
import kotlin.Unit;
|
||||
|
||||
/**
|
||||
* A view controller used for Media Playback.
|
||||
@@ -133,6 +134,13 @@ public class MediaControlPanel {
|
||||
mMediaOutputDialogFactory = mediaOutputDialogFactory;
|
||||
mMediaCarouselController = mediaCarouselController;
|
||||
loadDimens();
|
||||
|
||||
mSeekBarViewModel.setLogSmartspaceClick(() -> {
|
||||
logSmartspaceCardReported(
|
||||
760, // SMARTSPACE_CARD_CLICK
|
||||
/* isRecommendationCard */ false);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
|
||||
public void onDestroy() {
|
||||
|
||||
@@ -28,8 +28,8 @@ import android.widget.SeekBar
|
||||
import androidx.annotation.AnyThread
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.view.GestureDetectorCompat
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.android.systemui.dagger.qualifiers.Background
|
||||
import com.android.systemui.util.concurrency.RepeatableExecutor
|
||||
import javax.inject.Inject
|
||||
@@ -70,7 +70,9 @@ private fun PlaybackState.computePosition(duration: Long): Long {
|
||||
}
|
||||
|
||||
/** ViewModel for seek bar in QS media player. */
|
||||
class SeekBarViewModel @Inject constructor(@Background private val bgExecutor: RepeatableExecutor) {
|
||||
class SeekBarViewModel @Inject constructor(
|
||||
@Background private val bgExecutor: RepeatableExecutor
|
||||
) {
|
||||
private var _data = Progress(false, false, null, 0)
|
||||
set(value) {
|
||||
field = value
|
||||
@@ -127,6 +129,8 @@ class SeekBarViewModel @Inject constructor(@Background private val bgExecutor: R
|
||||
}
|
||||
}
|
||||
|
||||
lateinit var logSmartspaceClick: () -> Unit
|
||||
|
||||
/**
|
||||
* Event indicating that the user has started interacting with the seek bar.
|
||||
*/
|
||||
@@ -167,6 +171,7 @@ class SeekBarViewModel @Inject constructor(@Background private val bgExecutor: R
|
||||
scrubbing = false
|
||||
checkPlaybackPosition()
|
||||
} else {
|
||||
logSmartspaceClick()
|
||||
controller?.transportControls?.seekTo(position)
|
||||
// Invalidate the cached playbackState to avoid the thumb jumping back to the previous
|
||||
// position.
|
||||
|
||||
@@ -75,6 +75,7 @@ public class SeekBarViewModelTest : SysuiTestCase() {
|
||||
fun setUp() {
|
||||
fakeExecutor = FakeExecutor(FakeSystemClock())
|
||||
viewModel = SeekBarViewModel(FakeRepeatableExecutor(fakeExecutor))
|
||||
viewModel.logSmartspaceClick = { }
|
||||
mockController = mock(MediaController::class.java)
|
||||
whenever(mockController.sessionToken).thenReturn(token1)
|
||||
mockTransport = mock(MediaController.TransportControls::class.java)
|
||||
|
||||
Reference in New Issue
Block a user