diff options
| author | 2023-07-17 13:06:12 +0000 | |
|---|---|---|
| committer | 2023-07-17 13:06:12 +0000 | |
| commit | ddb03a45b8e06cb84df7568ec95e683f83e47d9c (patch) | |
| tree | ba97542cfa73e36830eb9b43b6275a33c9ac6553 | |
| parent | 7b715ed99e7b58e59d2271e3516b5c0462a64a59 (diff) | |
| parent | 5e56874d7cb2a3ead8b672670d231787593fe4d6 (diff) | |
Merge "Wrap the lottie views and trace whenever it invalidates" into udc-dev
13 files changed, 150 insertions, 11 deletions
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"> -            <com.airbnb.lottie.LottieAnimationView +            <com.android.systemui.reardisplay.RearDisplayEducationLottieViewWrapper                  android:id="@+id/rear_display_folded_animation"                  android:importantForAccessibility="no"                  android:layout_width="@dimen/rear_display_animation_width" diff --git a/packages/SystemUI/res/layout/activity_rear_display_education_opened.xml b/packages/SystemUI/res/layout/activity_rear_display_education_opened.xml index 0e6b2812a8a9..bded0127ec84 100644 --- a/packages/SystemUI/res/layout/activity_rear_display_education_opened.xml +++ b/packages/SystemUI/res/layout/activity_rear_display_education_opened.xml @@ -29,7 +29,7 @@          app:cardCornerRadius="28dp"          app:cardBackgroundColor="@color/rear_display_overlay_animation_background_color"> -        <com.airbnb.lottie.LottieAnimationView +        <com.android.systemui.reardisplay.RearDisplayEducationLottieViewWrapper              android:id="@+id/rear_display_folded_animation"              android:importantForAccessibility="no"              android:layout_width="@dimen/rear_display_animation_width_opened" diff --git a/packages/SystemUI/res/layout/auth_biometric_contents.xml b/packages/SystemUI/res/layout/auth_biometric_contents.xml index efc661a6e974..50b3bec93731 100644 --- a/packages/SystemUI/res/layout/auth_biometric_contents.xml +++ b/packages/SystemUI/res/layout/auth_biometric_contents.xml @@ -57,7 +57,7 @@          <include layout="@layout/auth_biometric_icon"/> -        <com.airbnb.lottie.LottieAnimationView +        <com.android.systemui.biometrics.BiometricPromptLottieViewWrapper              android:id="@+id/biometric_icon_overlay"              android:layout_width="wrap_content"              android:layout_height="wrap_content" diff --git a/packages/SystemUI/res/layout/biometric_prompt_layout.xml b/packages/SystemUI/res/layout/biometric_prompt_layout.xml index 05ff1b1c2e6f..595cea8b9018 100644 --- a/packages/SystemUI/res/layout/biometric_prompt_layout.xml +++ b/packages/SystemUI/res/layout/biometric_prompt_layout.xml @@ -59,7 +59,7 @@          android:layout_height="wrap_content"          android:layout_gravity="center"> -        <com.airbnb.lottie.LottieAnimationView +        <com.android.systemui.biometrics.BiometricPromptLottieViewWrapper              android:id="@+id/biometric_icon"              android:layout_width="wrap_content"              android:layout_height="wrap_content" @@ -67,7 +67,7 @@              android:contentDescription="@null"              android:scaleType="fitXY" /> -        <com.airbnb.lottie.LottieAnimationView +        <com.android.systemui.biometrics.BiometricPromptLottieViewWrapper              android:id="@+id/biometric_icon_overlay"              android:layout_width="wrap_content"              android:layout_height="wrap_content" diff --git a/packages/SystemUI/res/layout/sidefps_view.xml b/packages/SystemUI/res/layout/sidefps_view.xml index 73050c253d72..4d952209da6f 100644 --- a/packages/SystemUI/res/layout/sidefps_view.xml +++ b/packages/SystemUI/res/layout/sidefps_view.xml @@ -14,7 +14,7 @@    ~ See the License for the specific language governing permissions and    ~ limitations under the License.    --> -<com.airbnb.lottie.LottieAnimationView +<com.android.systemui.biometrics.SideFpsLottieViewWrapper      xmlns:android="http://schemas.android.com/apk/res/android"      xmlns:app="http://schemas.android.com/apk/res-auto"      android:id="@+id/sidefps_animation" diff --git a/packages/SystemUI/res/layout/udfps_keyguard_preview.xml b/packages/SystemUI/res/layout/udfps_keyguard_preview.xml index c068b7bc46a9..0964a21aeb36 100644 --- a/packages/SystemUI/res/layout/udfps_keyguard_preview.xml +++ b/packages/SystemUI/res/layout/udfps_keyguard_preview.xml @@ -24,7 +24,7 @@      android:background="@drawable/fingerprint_bg">      <!-- LockScreen fingerprint icon from 0 stroke width to full width --> -    <com.airbnb.lottie.LottieAnimationView +    <com.android.systemui.keyguard.ui.view.UdfpsLottieViewWrapper          android:layout_width="0dp"          android:layout_height="0dp"          android:scaleType="centerCrop" diff --git a/packages/SystemUI/res/layout/udfps_keyguard_view_internal.xml b/packages/SystemUI/res/layout/udfps_keyguard_view_internal.xml index 191158e4e8c2..1d6147cd2169 100644 --- a/packages/SystemUI/res/layout/udfps_keyguard_view_internal.xml +++ b/packages/SystemUI/res/layout/udfps_keyguard_view_internal.xml @@ -32,7 +32,7 @@      <!-- Fingerprint -->      <!-- AOD dashed fingerprint icon with moving dashes --> -    <com.airbnb.lottie.LottieAnimationView +    <com.android.systemui.keyguard.ui.view.UdfpsLottieViewWrapper          android:id="@+id/udfps_aod_fp"          android:layout_width="match_parent"          android:layout_height="match_parent" @@ -43,7 +43,7 @@          app:lottie_rawRes="@raw/udfps_aod_fp"/>      <!-- LockScreen fingerprint icon from 0 stroke width to full width --> -    <com.airbnb.lottie.LottieAnimationView +    <com.android.systemui.keyguard.ui.view.UdfpsLottieViewWrapper          android:id="@+id/udfps_lockscreen_fp"          android:layout_width="match_parent"          android:layout_height="match_parent" diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/BiometricPromptLottieViewWrapper.kt b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricPromptLottieViewWrapper.kt new file mode 100644 index 000000000000..e48e6e2dfdc6 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/biometrics/BiometricPromptLottieViewWrapper.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 BiometricPromptLottieViewWrapper +@JvmOverloads +constructor(context: Context, attrs: AttributeSet? = null) : LottieViewWrapper(context, attrs) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt index d48b9c339d15..54aef00a5a8c 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt @@ -117,6 +117,8 @@ constructor(      private var overlayView: View? = null          set(value) {              field?.let { oldView -> +                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<Any?>("${this::class} invalidate") { +            super.invalidate() +            null +        } +    } +}  |