Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt +21 −13 Original line number Diff line number Diff line Loading @@ -26,18 +26,11 @@ import javax.inject.Inject /** A logger for all events related to the media tap-to-transfer receiver experience. */ @SysUISingleton class MediaTttReceiverLogger @Inject constructor( @MediaTttReceiverLogBuffer buffer: LogBuffer, ) : TemporaryViewLogger<ChipReceiverInfo>(buffer, TAG) { class MediaTttReceiverLogger @Inject constructor(@MediaTttReceiverLogBuffer buffer: LogBuffer) : TemporaryViewLogger<ChipReceiverInfo>(buffer, TAG) { /** Logs a change in the chip state for the given [mediaRouteId]. */ fun logStateChange( stateName: String, mediaRouteId: String, packageName: String?, ) { fun logStateChange(stateName: String, mediaRouteId: String, packageName: String?) { MediaTttLoggerUtils.logStateChange(buffer, TAG, stateName, mediaRouteId, packageName) } Loading @@ -51,12 +44,27 @@ constructor( MediaTttLoggerUtils.logPackageNotFound(buffer, TAG, packageName) } fun logRippleAnimationEnd(id: Int) { fun logRippleAnimationEnd(id: Int, type: String) { buffer.log( tag, LogLevel.DEBUG, { int1 = id }, { "ripple animation for view with id: $int1 is ended" } { int1 = id str1 = type }, { "ripple animation for view with id=$int1 is ended, animation type=$str1" }, ) } fun logRippleAnimationStart(id: Int, type: String) { buffer.log( tag, LogLevel.DEBUG, { int1 = id str1 = type }, { "ripple animation for view with id=$int1 is started, animation type=$str1" }, ) } Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt +5 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,9 @@ constructor( ) rippleView.addOnAttachStateChangeListener( object : View.OnAttachStateChangeListener { override fun onViewDetachedFromWindow(view: View) {} override fun onViewDetachedFromWindow(view: View) { view.visibility = View.GONE } override fun onViewAttachedToWindow(view: View) { if (view == null) { Loading @@ -81,7 +83,7 @@ constructor( } else { layoutRipple(attachedRippleView) } attachedRippleView.expandRipple() attachedRippleView.expandRipple(mediaTttReceiverLogger) attachedRippleView.removeOnAttachStateChangeListener(this) } } Loading Loading @@ -126,7 +128,7 @@ constructor( iconRippleView.setMaxSize(radius * 0.8f, radius * 0.8f) iconRippleView.setCenter( width * 0.5f, height - getReceiverIconSize() * 0.5f - getReceiverIconBottomMargin() height - getReceiverIconSize() * 0.5f - getReceiverIconBottomMargin(), ) iconRippleView.setColor(getRippleColor(), RIPPLE_OPACITY) } Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +22 −5 Original line number Diff line number Diff line Loading @@ -37,10 +37,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi isStarted = false } fun expandRipple(onAnimationEnd: Runnable? = null) { fun expandRipple(logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null) { duration = DEFAULT_DURATION isStarted = true super.startRipple(onAnimationEnd) super.startRipple { logger.logRippleAnimationEnd(id, EXPAND) onAnimationEnd?.run() } logger.logRippleAnimationStart(id, EXPAND) } /** Used to animate out the ripple. No-op if the ripple was never started via [startRipple]. */ Loading @@ -53,10 +57,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi animator.removeAllListeners() animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationCancel(animation: Animator) { onAnimationEnd(animation) } override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) logger.logRippleAnimationEnd(id, COLLAPSE) } onAnimationEnd?.run() isStarted = false Loading @@ -64,13 +72,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } ) animator.reverse() logger.logRippleAnimationStart(id, COLLAPSE) } // Expands the ripple to cover full screen. fun expandToFull( newHeight: Float, logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null onAnimationEnd: Runnable? = null, ) { if (!isStarted) { return Loading @@ -95,10 +104,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationCancel(animation: Animator) { onAnimationEnd(animation) } override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) logger.logRippleAnimationEnd(id, EXPAND_TO_FULL) } onAnimationEnd?.run() isStarted = false Loading @@ -106,6 +119,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } ) animator.start() logger.logRippleAnimationStart(id, EXPAND_TO_FULL) } // Calculates the actual starting percentage according to ripple shader progress set method. Loading Loading @@ -151,5 +165,8 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi companion object { const val DEFAULT_DURATION = 333L const val EXPAND_TO_FULL_DURATION = 1000L private const val COLLAPSE = "collapse" private const val EXPAND_TO_FULL = "expand to full" private const val EXPAND = "expand" } } Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverLogger.kt +21 −13 Original line number Diff line number Diff line Loading @@ -26,18 +26,11 @@ import javax.inject.Inject /** A logger for all events related to the media tap-to-transfer receiver experience. */ @SysUISingleton class MediaTttReceiverLogger @Inject constructor( @MediaTttReceiverLogBuffer buffer: LogBuffer, ) : TemporaryViewLogger<ChipReceiverInfo>(buffer, TAG) { class MediaTttReceiverLogger @Inject constructor(@MediaTttReceiverLogBuffer buffer: LogBuffer) : TemporaryViewLogger<ChipReceiverInfo>(buffer, TAG) { /** Logs a change in the chip state for the given [mediaRouteId]. */ fun logStateChange( stateName: String, mediaRouteId: String, packageName: String?, ) { fun logStateChange(stateName: String, mediaRouteId: String, packageName: String?) { MediaTttLoggerUtils.logStateChange(buffer, TAG, stateName, mediaRouteId, packageName) } Loading @@ -51,12 +44,27 @@ constructor( MediaTttLoggerUtils.logPackageNotFound(buffer, TAG, packageName) } fun logRippleAnimationEnd(id: Int) { fun logRippleAnimationEnd(id: Int, type: String) { buffer.log( tag, LogLevel.DEBUG, { int1 = id }, { "ripple animation for view with id: $int1 is ended" } { int1 = id str1 = type }, { "ripple animation for view with id=$int1 is ended, animation type=$str1" }, ) } fun logRippleAnimationStart(id: Int, type: String) { buffer.log( tag, LogLevel.DEBUG, { int1 = id str1 = type }, { "ripple animation for view with id=$int1 is started, animation type=$str1" }, ) } Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttReceiverRippleController.kt +5 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,9 @@ constructor( ) rippleView.addOnAttachStateChangeListener( object : View.OnAttachStateChangeListener { override fun onViewDetachedFromWindow(view: View) {} override fun onViewDetachedFromWindow(view: View) { view.visibility = View.GONE } override fun onViewAttachedToWindow(view: View) { if (view == null) { Loading @@ -81,7 +83,7 @@ constructor( } else { layoutRipple(attachedRippleView) } attachedRippleView.expandRipple() attachedRippleView.expandRipple(mediaTttReceiverLogger) attachedRippleView.removeOnAttachStateChangeListener(this) } } Loading Loading @@ -126,7 +128,7 @@ constructor( iconRippleView.setMaxSize(radius * 0.8f, radius * 0.8f) iconRippleView.setCenter( width * 0.5f, height - getReceiverIconSize() * 0.5f - getReceiverIconBottomMargin() height - getReceiverIconSize() * 0.5f - getReceiverIconBottomMargin(), ) iconRippleView.setColor(getRippleColor(), RIPPLE_OPACITY) } Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/ReceiverChipRippleView.kt +22 −5 Original line number Diff line number Diff line Loading @@ -37,10 +37,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi isStarted = false } fun expandRipple(onAnimationEnd: Runnable? = null) { fun expandRipple(logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null) { duration = DEFAULT_DURATION isStarted = true super.startRipple(onAnimationEnd) super.startRipple { logger.logRippleAnimationEnd(id, EXPAND) onAnimationEnd?.run() } logger.logRippleAnimationStart(id, EXPAND) } /** Used to animate out the ripple. No-op if the ripple was never started via [startRipple]. */ Loading @@ -53,10 +57,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi animator.removeAllListeners() animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationCancel(animation: Animator) { onAnimationEnd(animation) } override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) logger.logRippleAnimationEnd(id, COLLAPSE) } onAnimationEnd?.run() isStarted = false Loading @@ -64,13 +72,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } ) animator.reverse() logger.logRippleAnimationStart(id, COLLAPSE) } // Expands the ripple to cover full screen. fun expandToFull( newHeight: Float, logger: MediaTttReceiverLogger, onAnimationEnd: Runnable? = null onAnimationEnd: Runnable? = null, ) { if (!isStarted) { return Loading @@ -95,10 +104,14 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } animator.addListener( object : AnimatorListenerAdapter() { override fun onAnimationCancel(animation: Animator) { onAnimationEnd(animation) } override fun onAnimationEnd(animation: Animator) { animation?.let { visibility = GONE logger.logRippleAnimationEnd(id) logger.logRippleAnimationEnd(id, EXPAND_TO_FULL) } onAnimationEnd?.run() isStarted = false Loading @@ -106,6 +119,7 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi } ) animator.start() logger.logRippleAnimationStart(id, EXPAND_TO_FULL) } // Calculates the actual starting percentage according to ripple shader progress set method. Loading Loading @@ -151,5 +165,8 @@ class ReceiverChipRippleView(context: Context?, attrs: AttributeSet?) : RippleVi companion object { const val DEFAULT_DURATION = 333L const val EXPAND_TO_FULL_DURATION = 1000L private const val COLLAPSE = "collapse" private const val EXPAND_TO_FULL = "expand to full" private const val EXPAND = "expand" } }