summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2022-03-09 21:43:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2022-03-09 21:43:27 +0000
commit0e76941f06b7ca8746b424c8477fab402e3857b8 (patch)
treedcb4bf55a67c230b2e54bac1b074cb5f4697b26b
parent691426b8c3753007a218de11847171a68d378c35 (diff)
parent2caa6d281e1b78d725300e071b2dc4c130d9ee8d (diff)
Merge "Check class type before creating animator" into tm-dev
-rw-r--r--packages/SystemUI/src/com/android/keyguard/NumPadButton.java12
-rw-r--r--packages/SystemUI/src/com/android/keyguard/NumPadKey.java11
2 files changed, 19 insertions, 4 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
index e0d0fc25943b..7b98f2759d80 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java
@@ -19,6 +19,8 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.VectorDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -37,8 +39,14 @@ public class NumPadButton extends AlphaOptimizedImageButton {
public NumPadButton(Context context, AttributeSet attrs) {
super(context, attrs);
- mAnimator = new NumPadAnimator(context, getBackground().mutate(),
- attrs.getStyleAttribute());
+ Drawable background = getBackground();
+ if (background instanceof GradientDrawable) {
+ mAnimator = new NumPadAnimator(context, background.mutate(),
+ attrs.getStyleAttribute());
+ } else {
+ mAnimator = null;
+ }
+
}
@Override
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 88a0bcec0542..5cab547ee435 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -18,6 +18,8 @@ package com.android.keyguard;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.AttributeSet;
@@ -129,8 +131,13 @@ public class NumPadKey extends ViewGroup {
setContentDescription(mDigitText.getText().toString());
- mAnimator = new NumPadAnimator(context, getBackground().mutate(),
- R.style.NumPadKey, mDigitText);
+ Drawable background = getBackground();
+ if (background instanceof GradientDrawable) {
+ mAnimator = new NumPadAnimator(context, background.mutate(),
+ R.style.NumPadKey, mDigitText);
+ } else {
+ mAnimator = null;
+ }
}
@Override