From 5e56874d7cb2a3ead8b672670d231787593fe4d6 Mon Sep 17 00:00:00 2001 From: Beverly Date: Tue, 11 Jul 2023 20:53:19 +0000 Subject: Wrap the lottie views and trace whenever it invalidates To help determine which lottie view is continuously running when it shouldn't be. Test: check sysui trace Bug: 290106681 Change-Id: I9ef168d086357c35484822798c4b67edf2c7422e (cherry picked from commit b106e6cc170bbf6ca3941c5eb0af70f589433f90) --- .../res/layout/activity_rear_display_education.xml | 2 +- .../activity_rear_display_education_opened.xml | 2 +- .../res/layout/auth_biometric_contents.xml | 2 +- .../res/layout/biometric_prompt_layout.xml | 4 +-- packages/SystemUI/res/layout/sidefps_view.xml | 2 +- .../SystemUI/res/layout/udfps_keyguard_preview.xml | 2 +- .../res/layout/udfps_keyguard_view_internal.xml | 4 +-- .../biometrics/BiometricPromptLottieViewWrapper.kt | 24 +++++++++++++ .../systemui/biometrics/SideFpsController.kt | 8 +++-- .../biometrics/SideFpsLottieViewWrapper.kt | 24 +++++++++++++ .../keyguard/ui/view/UdfpsLottieViewWrapper.kt | 24 +++++++++++++ .../RearDisplayEducationLottieViewWrapper.kt | 24 +++++++++++++ .../systemui/util/wrapper/LottieViewWrapper.kt | 39 ++++++++++++++++++++++ 13 files changed, 150 insertions(+), 11 deletions(-) create mode 100644 packages/SystemUI/src/com/android/systemui/biometrics/BiometricPromptLottieViewWrapper.kt create mode 100644 packages/SystemUI/src/com/android/systemui/biometrics/SideFpsLottieViewWrapper.kt create mode 100644 packages/SystemUI/src/com/android/systemui/keyguard/ui/view/UdfpsLottieViewWrapper.kt create mode 100644 packages/SystemUI/src/com/android/systemui/reardisplay/RearDisplayEducationLottieViewWrapper.kt create mode 100644 packages/SystemUI/src/com/android/systemui/util/wrapper/LottieViewWrapper.kt diff --git a/packages/SystemUI/res/layout/activity_rear_display_education.xml b/packages/SystemUI/res/layout/activity_rear_display_education.xml index c295cfe7a2e0..1b6247f29922 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 000000000000..e98f6db12d34 --- /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 000000000000..3a2c3c70a452 --- /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 000000000000..716a4d649665 --- /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 000000000000..a804923bafdf --- /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 + } + } +} -- cgit v1.2.3-59-g8ed1b