diff --git a/packages/SystemUI/res/layout/activity_rear_display_education.xml b/packages/SystemUI/res/layout/activity_rear_display_education.xml index c295cfe7a2e08..1b6247f299228 100644 --- a/packages/SystemUI/res/layout/activity_rear_display_education.xml +++ b/packages/SystemUI/res/layout/activity_rear_display_education.xml @@ -28,7 +28,7 @@ app:cardCornerRadius="28dp" app:cardBackgroundColor="@color/rear_display_overlay_animation_background_color"> - - - - - - - - - + val lottie = oldView.findViewById(R.id.sidefps_animation) as LottieAnimationView + lottie.pauseAnimation() windowManager.removeView(oldView) orientationListener.disable() } @@ -193,7 +195,9 @@ constructor( requests.add(request) mainExecutor.execute { if (overlayView == null) { - traceSection("SideFpsController#show(request=${request.name}, reason=$reason") { + traceSection( + "SideFpsController#show(request=${request.name}, reason=$reason)" + ) { createOverlayForDisplay(reason) } } else { @@ -208,7 +212,7 @@ constructor( requests.remove(request) mainExecutor.execute { if (requests.isEmpty()) { - traceSection("SideFpsController#hide(${request.name}") { overlayView = null } + traceSection("SideFpsController#hide(${request.name})") { overlayView = null } } } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsLottieViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsLottieViewWrapper.kt new file mode 100644 index 0000000000000..e98f6db12d348 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsLottieViewWrapper.kt @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.systemui.biometrics + +import android.content.Context +import android.util.AttributeSet +import com.android.systemui.util.wrapper.LottieViewWrapper + +class SideFpsLottieViewWrapper +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null) : LottieViewWrapper(context, attrs) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/UdfpsLottieViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/UdfpsLottieViewWrapper.kt new file mode 100644 index 0000000000000..3a2c3c70a452b --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/UdfpsLottieViewWrapper.kt @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.systemui.keyguard.ui.view + +import android.content.Context +import android.util.AttributeSet +import com.android.systemui.util.wrapper.LottieViewWrapper + +class UdfpsLottieViewWrapper +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null) : LottieViewWrapper(context, attrs) diff --git a/packages/SystemUI/src/com/android/systemui/reardisplay/RearDisplayEducationLottieViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/reardisplay/RearDisplayEducationLottieViewWrapper.kt new file mode 100644 index 0000000000000..716a4d6496658 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/reardisplay/RearDisplayEducationLottieViewWrapper.kt @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.systemui.reardisplay + +import android.content.Context +import android.util.AttributeSet +import com.android.systemui.util.wrapper.LottieViewWrapper + +class RearDisplayEducationLottieViewWrapper +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null) : LottieViewWrapper(context, attrs) diff --git a/packages/SystemUI/src/com/android/systemui/util/wrapper/LottieViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/util/wrapper/LottieViewWrapper.kt new file mode 100644 index 0000000000000..a804923bafdf1 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/util/wrapper/LottieViewWrapper.kt @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.systemui.util.wrapper + +import android.content.Context +import android.util.AttributeSet +import com.airbnb.lottie.LottieAnimationView +import com.android.systemui.util.traceSection + +/** LottieAnimationView that traces each call to invalidate. */ +open class LottieViewWrapper : LottieAnimationView { + constructor(context: Context?) : super(context) + constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) + constructor( + context: Context?, + attrs: AttributeSet?, + defStyleAttr: Int + ) : super(context, attrs, defStyleAttr) + + override fun invalidate() { + traceSection("${this::class} invalidate") { + super.invalidate() + null + } + } +}