summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-01-30 13:23:21 -0800
committerAndrew Lee <anwlee@google.com>2015-02-02 12:30:59 -0800
commit72b46d429cbab54af962c25ffe087c5f927f7340 (patch)
treeb3329a688b367eddac23d554eeb7bf4ea676fed4 /packages/Keyguard
parentc37fa833ada2981b479a7582010a173ff9adc5bf (diff)
downloadframeworks_base-72b46d429cbab54af962c25ffe087c5f927f7340.zip
frameworks_base-72b46d429cbab54af962c25ffe087c5f927f7340.tar.gz
frameworks_base-72b46d429cbab54af962c25ffe087c5f927f7340.tar.bz2
Reset keyguard/bouncer on "return to call".
+ Add callback, to be invoked when EmergencyButton is clicked when inside a call. + Route callback to the KeyguardViewMediator, to invoke resetStateLocked() to reset the bouncer. Bug: 18977746 Change-Id: I4733ccfb6809c4610184a33a28ba38ecf255231f
Diffstat (limited to 'packages/Keyguard')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/EmergencyButton.java12
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java9
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java7
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java10
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java4
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java7
-rw-r--r--packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java5
7 files changed, 49 insertions, 5 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index 50ac261..4a9440c 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -50,8 +50,14 @@ public class EmergencyButton extends Button {
updateEmergencyCallButton();
}
};
+
+ public interface EmergencyButtonCallback {
+ public void onEmergencyButtonClickedWhenInCall();
+ }
+
private LockPatternUtils mLockPatternUtils;
private PowerManager mPowerManager;
+ private EmergencyButtonCallback mEmergencyButtonCallback;
public EmergencyButton(Context context) {
this(context, null);
@@ -95,6 +101,9 @@ public class EmergencyButton extends Button {
mPowerManager.userActivity(SystemClock.uptimeMillis(), true);
if (mLockPatternUtils.isInCall()) {
mLockPatternUtils.resumeCall();
+ if (mEmergencyButtonCallback != null) {
+ mEmergencyButtonCallback.onEmergencyButtonClickedWhenInCall();
+ }
} else {
final boolean bypassHandler = true;
KeyguardUpdateMonitor.getInstance(mContext).reportEmergencyCallAction(bypassHandler);
@@ -124,4 +133,7 @@ public class EmergencyButton extends Button {
mLockPatternUtils.updateEmergencyCallButtonState(this, enabled, false);
}
+ public void setCallback(EmergencyButtonCallback callback) {
+ mEmergencyButtonCallback = callback;
+ }
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index b03176c..6f322b6 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -32,7 +32,7 @@ import com.android.internal.widget.LockPatternUtils;
* Base class for PIN and password unlock screens.
*/
public abstract class KeyguardAbsKeyInputView extends LinearLayout
- implements KeyguardSecurityView {
+ implements KeyguardSecurityView, EmergencyButton.EmergencyButtonCallback {
protected KeyguardSecurityCallback mCallback;
protected LockPatternUtils mLockPatternUtils;
protected SecurityMessageDisplay mSecurityMessageDisplay;
@@ -85,6 +85,13 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
mLockPatternUtils = new LockPatternUtils(mContext);
mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
+
+ EmergencyButton button = (EmergencyButton) findViewById(R.id.emergency_call_button);
+ button.setCallback(this);
+ }
+
+ public void onEmergencyButtonClickedWhenInCall() {
+ mCallback.reset();
}
/*
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index 08f6991..10ce426 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -196,6 +196,11 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
}
@Override
+ public void reset() {
+ mViewMediatorCallback.resetKeyguard();
+ }
+
+ @Override
public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput) {
if (mViewMediatorCallback != null) {
mViewMediatorCallback.setNeedsInput(needsInput);
@@ -427,6 +432,4 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
public SecurityMode getCurrentSecurityMode() {
return mSecurityContainer.getCurrentSecurityMode();
}
-
-
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index 62f1b69..053b309 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -38,7 +38,8 @@ import com.android.internal.widget.LockPatternView;
import java.util.List;
public class KeyguardPatternView extends LinearLayout implements KeyguardSecurityView,
- AppearAnimationCreator<LockPatternView.CellState> {
+ AppearAnimationCreator<LockPatternView.CellState>,
+ EmergencyButton.EmergencyButtonCallback {
private static final String TAG = "SecurityPatternView";
private static final boolean DEBUG = KeyguardConstants.DEBUG;
@@ -140,6 +141,13 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
mEcaView = findViewById(R.id.keyguard_selector_fade_container);
mContainer = (ViewGroup) findViewById(R.id.container);
mHelpMessage = (KeyguardMessageArea) findViewById(R.id.keyguard_message_area);
+
+ EmergencyButton button = (EmergencyButton) findViewById(R.id.emergency_call_button);
+ button.setCallback(this);
+ }
+
+ public void onEmergencyButtonClickedWhenInCall() {
+ mCallback.reset();
}
@Override
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
index 8bb8805..5877bc8 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
@@ -40,4 +40,8 @@ public interface KeyguardSecurityCallback {
*/
void reportUnlockAttempt(boolean success);
+ /**
+ * Resets the keyguard view.
+ */
+ void reset();
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index fb4f480..41ec3b0 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -55,6 +55,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
public void userActivity();
public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput);
public void finish();
+ public void reset();
}
public KeyguardSecurityContainer(Context context, AttributeSet attrs) {
@@ -414,7 +415,6 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
}
private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
-
public void userActivity() {
if (mSecurityCallback != null) {
mSecurityCallback.userActivity();
@@ -439,6 +439,9 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
}
}
+ public void reset() {
+ mSecurityCallback.reset();
+ }
};
// The following is used to ignore callbacks from SecurityViews that are no longer current
@@ -453,6 +456,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
public boolean isVerifyUnlockOnly() { return false; }
@Override
public void dismiss(boolean securityVerified) { }
+ @Override
+ public void reset() {}
};
private int getSecurityViewIdForMode(SecurityMode securityMode) {
diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
index f327078..5bbcc8c 100644
--- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java
@@ -62,6 +62,11 @@ public interface ViewMediatorCallback {
void readyForKeyguardDone();
/**
+ * Reset the keyguard and bouncer.
+ */
+ void resetKeyguard();
+
+ /**
* Play the "device trusted" sound.
*/
void playTrustedSound();