Loading packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +9 −5 Original line number Diff line number Diff line Loading @@ -169,11 +169,9 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : setFloatUniform("in_progress", value) val curvedProg = 1 - (1 - value) * (1 - value) * (1 - value) setFloatUniform( "in_size", /* width= */ maxSize.x * curvedProg, /* height= */ maxSize.y * curvedProg ) currentWidth = maxSize.x * curvedProg currentHeight = maxSize.y * curvedProg setFloatUniform("in_size", /* width= */ currentWidth, /* height= */ currentHeight) setFloatUniform("in_thickness", maxSize.y * curvedProg * 0.5f) // radius should not exceed width and height values. setFloatUniform("in_cornerRadius", Math.min(maxSize.x, maxSize.y) * curvedProg) Loading Loading @@ -237,4 +235,10 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : * False for a ring effect. */ var rippleFill: Boolean = false var currentWidth: Float = 0f private set var currentHeight: Float = 0f private set } packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.android.systemui.surfaceeffects.ripple.RippleShader.RippleShape */ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) { private lateinit var rippleShader: RippleShader protected lateinit var rippleShader: RippleShader lateinit var rippleShape: RippleShape private set Loading packages/SystemUI/src/com/android/systemui/flags/Flags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,10 @@ object Flags { // TODO(b/261734857): Tracking Bug @JvmField val UMO_TURBULENCE_NOISE = unreleasedFlag(909, "umo_turbulence_noise") // TODO(b/263272731): Tracking Bug val MEDIA_TTT_RECEIVER_SUCCESS_RIPPLE = unreleasedFlag(910, "media_ttt_receiver_success_ripple", teamfood = true) // 1000 - dock val SIMULATE_DOCK_THROUGH_CHARGING = releasedFlag(1000, "simulate_dock_through_charging") Loading packages/SystemUI/src/com/android/systemui/media/taptotransfer/MediaTttFlags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,8 @@ import javax.inject.Inject class MediaTttFlags @Inject constructor(private val featureFlags: FeatureFlags) { /** */ fun isMediaTttEnabled(): Boolean = featureFlags.isEnabled(Flags.MEDIA_TAP_TO_TRANSFER) /** Check whether the flag for the receiver success state is enabled. */ fun isMediaTttReceiverSuccessRippleEnabled(): Boolean = featureFlags.isEnabled(Flags.MEDIA_TTT_RECEIVER_SUCCESS_RIPPLE) } packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt +26 −4 Original line number Diff line number Diff line Loading @@ -114,6 +114,9 @@ open class MediaTttChipControllerReceiver @Inject constructor( } } private var maxRippleWidth: Float = 0f private var maxRippleHeight: Float = 0f private fun updateMediaTapToTransferReceiverDisplay( @StatusBarManager.MediaTransferReceiverState displayState: Int, routeInfo: MediaRoute2Info, Loading Loading @@ -216,7 +219,7 @@ open class MediaTttChipControllerReceiver @Inject constructor( expandRipple(view.requireViewById(R.id.ripple)) } override fun animateViewOut(view: ViewGroup, onAnimationEnd: Runnable) { override fun animateViewOut(view: ViewGroup, removalReason: String?, onAnimationEnd: Runnable) { val appIconView = view.getAppIconView() appIconView.animate() .translationYBy(getTranslationAmount().toFloat()) Loading @@ -226,7 +229,14 @@ open class MediaTttChipControllerReceiver @Inject constructor( .alpha(0f) .setDuration(ICON_ALPHA_ANIM_DURATION) .start() (view.requireViewById(R.id.ripple) as ReceiverChipRippleView).collapseRipple(onAnimationEnd) val rippleView: ReceiverChipRippleView = view.requireViewById(R.id.ripple) if (removalReason == ChipStateReceiver.TRANSFER_TO_RECEIVER_SUCCEEDED.name && mediaTttFlags.isMediaTttReceiverSuccessRippleEnabled()) { expandRippleToFull(rippleView, onAnimationEnd) } else { rippleView.collapseRipple(onAnimationEnd) } } override fun getTouchableRegion(view: View, outRect: Rect) { Loading Loading @@ -271,12 +281,19 @@ open class MediaTttChipControllerReceiver @Inject constructor( }) } private fun layoutRipple(rippleView: ReceiverChipRippleView) { private fun layoutRipple(rippleView: ReceiverChipRippleView, isFullScreen: Boolean = false) { val windowBounds = windowManager.currentWindowMetrics.bounds val height = windowBounds.height().toFloat() val width = windowBounds.width().toFloat() rippleView.setMaxSize(width / 2f, height / 2f) if (isFullScreen) { maxRippleHeight = height * 2f maxRippleWidth = width * 2f } else { maxRippleHeight = height / 2f maxRippleWidth = width / 2f } rippleView.setMaxSize(maxRippleWidth, maxRippleHeight) // Center the ripple on the bottom of the screen in the middle. rippleView.setCenter(width * 0.5f, height) val color = Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColorAccent) Loading @@ -286,6 +303,11 @@ open class MediaTttChipControllerReceiver @Inject constructor( private fun View.getAppIconView(): CachingIconView { return this.requireViewById(R.id.app_icon) } private fun expandRippleToFull(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable?) { layoutRipple(rippleView, true) rippleView.expandToFull(maxRippleHeight, onAnimationEnd) } } val ICON_TRANSLATION_ANIM_DURATION = 30.frames Loading Loading
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleShader.kt +9 −5 Original line number Diff line number Diff line Loading @@ -169,11 +169,9 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : setFloatUniform("in_progress", value) val curvedProg = 1 - (1 - value) * (1 - value) * (1 - value) setFloatUniform( "in_size", /* width= */ maxSize.x * curvedProg, /* height= */ maxSize.y * curvedProg ) currentWidth = maxSize.x * curvedProg currentHeight = maxSize.y * curvedProg setFloatUniform("in_size", /* width= */ currentWidth, /* height= */ currentHeight) setFloatUniform("in_thickness", maxSize.y * curvedProg * 0.5f) // radius should not exceed width and height values. setFloatUniform("in_cornerRadius", Math.min(maxSize.x, maxSize.y) * curvedProg) Loading Loading @@ -237,4 +235,10 @@ class RippleShader(rippleShape: RippleShape = RippleShape.CIRCLE) : * False for a ring effect. */ var rippleFill: Boolean = false var currentWidth: Float = 0f private set var currentHeight: Float = 0f private set }
packages/SystemUI/animation/src/com/android/systemui/surfaceeffects/ripple/RippleView.kt +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.android.systemui.surfaceeffects.ripple.RippleShader.RippleShape */ open class RippleView(context: Context?, attrs: AttributeSet?) : View(context, attrs) { private lateinit var rippleShader: RippleShader protected lateinit var rippleShader: RippleShader lateinit var rippleShape: RippleShape private set Loading
packages/SystemUI/src/com/android/systemui/flags/Flags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -315,6 +315,10 @@ object Flags { // TODO(b/261734857): Tracking Bug @JvmField val UMO_TURBULENCE_NOISE = unreleasedFlag(909, "umo_turbulence_noise") // TODO(b/263272731): Tracking Bug val MEDIA_TTT_RECEIVER_SUCCESS_RIPPLE = unreleasedFlag(910, "media_ttt_receiver_success_ripple", teamfood = true) // 1000 - dock val SIMULATE_DOCK_THROUGH_CHARGING = releasedFlag(1000, "simulate_dock_through_charging") Loading
packages/SystemUI/src/com/android/systemui/media/taptotransfer/MediaTttFlags.kt +4 −0 Original line number Diff line number Diff line Loading @@ -26,4 +26,8 @@ import javax.inject.Inject class MediaTttFlags @Inject constructor(private val featureFlags: FeatureFlags) { /** */ fun isMediaTttEnabled(): Boolean = featureFlags.isEnabled(Flags.MEDIA_TAP_TO_TRANSFER) /** Check whether the flag for the receiver success state is enabled. */ fun isMediaTttReceiverSuccessRippleEnabled(): Boolean = featureFlags.isEnabled(Flags.MEDIA_TTT_RECEIVER_SUCCESS_RIPPLE) }
packages/SystemUI/src/com/android/systemui/media/taptotransfer/receiver/MediaTttChipControllerReceiver.kt +26 −4 Original line number Diff line number Diff line Loading @@ -114,6 +114,9 @@ open class MediaTttChipControllerReceiver @Inject constructor( } } private var maxRippleWidth: Float = 0f private var maxRippleHeight: Float = 0f private fun updateMediaTapToTransferReceiverDisplay( @StatusBarManager.MediaTransferReceiverState displayState: Int, routeInfo: MediaRoute2Info, Loading Loading @@ -216,7 +219,7 @@ open class MediaTttChipControllerReceiver @Inject constructor( expandRipple(view.requireViewById(R.id.ripple)) } override fun animateViewOut(view: ViewGroup, onAnimationEnd: Runnable) { override fun animateViewOut(view: ViewGroup, removalReason: String?, onAnimationEnd: Runnable) { val appIconView = view.getAppIconView() appIconView.animate() .translationYBy(getTranslationAmount().toFloat()) Loading @@ -226,7 +229,14 @@ open class MediaTttChipControllerReceiver @Inject constructor( .alpha(0f) .setDuration(ICON_ALPHA_ANIM_DURATION) .start() (view.requireViewById(R.id.ripple) as ReceiverChipRippleView).collapseRipple(onAnimationEnd) val rippleView: ReceiverChipRippleView = view.requireViewById(R.id.ripple) if (removalReason == ChipStateReceiver.TRANSFER_TO_RECEIVER_SUCCEEDED.name && mediaTttFlags.isMediaTttReceiverSuccessRippleEnabled()) { expandRippleToFull(rippleView, onAnimationEnd) } else { rippleView.collapseRipple(onAnimationEnd) } } override fun getTouchableRegion(view: View, outRect: Rect) { Loading Loading @@ -271,12 +281,19 @@ open class MediaTttChipControllerReceiver @Inject constructor( }) } private fun layoutRipple(rippleView: ReceiverChipRippleView) { private fun layoutRipple(rippleView: ReceiverChipRippleView, isFullScreen: Boolean = false) { val windowBounds = windowManager.currentWindowMetrics.bounds val height = windowBounds.height().toFloat() val width = windowBounds.width().toFloat() rippleView.setMaxSize(width / 2f, height / 2f) if (isFullScreen) { maxRippleHeight = height * 2f maxRippleWidth = width * 2f } else { maxRippleHeight = height / 2f maxRippleWidth = width / 2f } rippleView.setMaxSize(maxRippleWidth, maxRippleHeight) // Center the ripple on the bottom of the screen in the middle. rippleView.setCenter(width * 0.5f, height) val color = Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColorAccent) Loading @@ -286,6 +303,11 @@ open class MediaTttChipControllerReceiver @Inject constructor( private fun View.getAppIconView(): CachingIconView { return this.requireViewById(R.id.app_icon) } private fun expandRippleToFull(rippleView: ReceiverChipRippleView, onAnimationEnd: Runnable?) { layoutRipple(rippleView, true) rippleView.expandToFull(maxRippleHeight, onAnimationEnd) } } val ICON_TRANSLATION_ANIM_DURATION = 30.frames Loading