Skip to content

Commit 8bbafed

Browse files
author
Jim Miller
committed
Don't handle click events on the emergency button in bouncer mode
This fixes a bug where the emergency call button was hidden, but not gone. This adds a call to setVisibility(INVISIBLE) when the alpha is animated to 0 and restore it when bouncer mode is dismissed. Fixes bug 7498389 Change-Id: I0898542ff7c666c8f41175a330b72d3450475739
1 parent c717d11 commit 8bbafed

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/KeyguardSecurityViewHelper.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.android.internal.policy.impl.keyguard;
1818

1919
import android.animation.Animator;
20+
import android.animation.AnimatorListenerAdapter;
2021
import android.animation.ObjectAnimator;
2122
import android.graphics.drawable.Drawable;
2223
import android.view.View;
@@ -27,17 +28,31 @@
2728
public class KeyguardSecurityViewHelper {
2829

2930
public static void showBouncer(SecurityMessageDisplay securityMessageDisplay,
30-
View ecaView, Drawable bouncerFrame, int duration) {
31+
final View ecaView, Drawable bouncerFrame, int duration) {
3132
if (securityMessageDisplay != null) {
3233
securityMessageDisplay.showBouncer(duration);
3334
}
3435
if (ecaView != null) {
3536
if (duration > 0) {
3637
Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 0f);
3738
anim.setDuration(duration);
39+
anim.addListener(new AnimatorListenerAdapter() {
40+
private boolean mCanceled;
41+
@Override
42+
public void onAnimationCancel(Animator animation) {
43+
// Fail safe and show the emergency button in onAnimationEnd()
44+
mCanceled = true;
45+
ecaView.setAlpha(1f);
46+
}
47+
@Override
48+
public void onAnimationEnd(Animator animation) {
49+
ecaView.setVisibility(mCanceled ? View.VISIBLE : View.INVISIBLE);
50+
}
51+
});
3852
anim.start();
3953
} else {
4054
ecaView.setAlpha(0f);
55+
ecaView.setVisibility(View.INVISIBLE);
4156
}
4257
}
4358
if (bouncerFrame != null) {
@@ -57,6 +72,7 @@ public static void hideBouncer(SecurityMessageDisplay securityMessageDisplay,
5772
securityMessageDisplay.hideBouncer(duration);
5873
}
5974
if (ecaView != null) {
75+
ecaView.setVisibility(View.VISIBLE);
6076
if (duration > 0) {
6177
Animator anim = ObjectAnimator.ofFloat(ecaView, "alpha", 1f);
6278
anim.setDuration(duration);

0 commit comments

Comments
 (0)