diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-07-03 23:25:44 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-07-04 03:00:29 +0200 |
commit | b690f0d5023fcf144f2701058d5a6f88d66cc97a (patch) | |
tree | 7bf8c478f0171edfd7836433b757ad65ba4b83ed /packages/Keyguard | |
parent | e05a56bf9386e2e0c6a862c3080698da8367a22e (diff) | |
download | frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.zip frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.tar.gz frameworks_base-b690f0d5023fcf144f2701058d5a6f88d66cc97a.tar.bz2 |
Clean up user activity handling
- Only call userActivity in down touch event
- Use normal timeout when QS is open
- Clean up old code regarding user activity in Keyguard
Change-Id: I968eeed33fef44def37b68eb1ddc63f1a531ab35
Diffstat (limited to 'packages/Keyguard')
13 files changed, 25 insertions, 63 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java index 2f14003..8d13ac2 100644 --- a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java +++ b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java @@ -66,10 +66,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { // mRunning and mServiceRunning. I'd just rather wait to change that logic. private volatile boolean mIsRunning = false; - // So the user has a consistent amount of time when brought to the backup method from Face - // Unlock - private final int BACKUP_LOCK_TIMEOUT = 5000; - KeyguardSecurityCallback mKeyguardScreenCallback; /** @@ -268,7 +264,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { // When switching between portrait and landscape view while Face Unlock is running, // the screen will eventually go dark unless we poke the wakelock when Face Unlock // is restarted. - mKeyguardScreenCallback.userActivity(0); + mKeyguardScreenCallback.userActivity(); int[] position; position = new int[2]; @@ -325,7 +321,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { mKeyguardScreenCallback.showBackupSecurity(); stop(); - mKeyguardScreenCallback.userActivity(BACKUP_LOCK_TIMEOUT); + mKeyguardScreenCallback.userActivity(); } /** @@ -347,7 +343,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback { void handlePokeWakelock(int millis) { PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE); if (powerManager.isScreenOn()) { - mKeyguardScreenCallback.userActivity(millis); + mKeyguardScreenCallback.userActivity(); } } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java index c49c318..2c9247a 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java @@ -152,7 +152,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - mCallback.userActivity(0); + mCallback.userActivity(); return false; } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java index 69abc7a..2432509 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java @@ -50,7 +50,6 @@ import java.io.IOException; */ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurityView, View.OnClickListener, TextWatcher { - private static final int AWAKE_POKE_MILLIS = 30000; private static final String LOCK_PATTERN_PACKAGE = "com.android.settings"; private static final String LOCK_PATTERN_CLASS = LOCK_PATTERN_PACKAGE + ".ChooseLockGeneric"; @@ -119,7 +118,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit public void onTextChanged(CharSequence s, int start, int before, int count) { if (mCallback != null) { - mCallback.userActivity(AWAKE_POKE_MILLIS); + mCallback.userActivity(); } } @@ -154,7 +153,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit } public void onClick(View v) { - mCallback.userActivity(0); + mCallback.userActivity(); if (v == mOk) { asyncCheckPassword(); } @@ -258,7 +257,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit } private void asyncCheckPassword() { - mCallback.userActivity(AWAKE_POKE_MILLIS); + mCallback.userActivity(); final String login = mLogin.getText().toString(); final String password = mPassword.getText().toString(); Account account = findIntendedAccount(login); @@ -273,7 +272,7 @@ public class KeyguardAccountView extends LinearLayout implements KeyguardSecurit new AccountManagerCallback<Bundle>() { public void run(AccountManagerFuture<Bundle> future) { try { - mCallback.userActivity(AWAKE_POKE_MILLIS); + mCallback.userActivity(); final Bundle result = future.getResult(); final boolean verified = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); postOnCheckPasswordResult(verified); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java index bfa95f3..77643bd 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardConstants.java @@ -26,7 +26,4 @@ public class KeyguardConstants { * be used temporarily for debugging. */ public static final boolean DEBUG = false; - - /** Timeout used for key presses. */ - public static final int DIGIT_PRESS_WAKE_MILLIS = 5000; } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java index 9f820f8..99ff6a7 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPasswordView.java @@ -111,7 +111,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView // Poke the wakelock any time the text is selected or modified mPasswordEntry.setOnClickListener(new OnClickListener() { public void onClick(View v) { - mCallback.userActivity(0); // TODO: customize timeout for text? + mCallback.userActivity(); } }); @@ -127,7 +127,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView public void afterTextChanged(Editable s) { if (mCallback != null) { - mCallback.userActivity(0); + mCallback.userActivity(); } } }); @@ -141,7 +141,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView imeOrDeleteButtonVisible = true; switchImeButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { - mCallback.userActivity(0); // Leave the screen on a bit longer + mCallback.userActivity(); // Leave the screen on a bit longer mImm.showInputMethodPicker(); } }); @@ -247,7 +247,7 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { if (mCallback != null) { - mCallback.userActivity(KeyguardConstants.DIGIT_PRESS_WAKE_MILLIS); + mCallback.userActivity(); } } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java index a0b5536..d5dcd71 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java @@ -59,9 +59,6 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit // how long we stay awake after each key beyond MIN_PATTERN_BEFORE_POKE_WAKELOCK private static final int UNLOCK_PATTERN_WAKE_INTERVAL_MS = 7000; - // how long we stay awake after the user hits the first dot. - private static final int UNLOCK_PATTERN_WAKE_INTERVAL_FIRST_DOTS_MS = 2000; - // how many cells the user has to cross before we poke the wakelock private static final int MIN_PATTERN_BEFORE_POKE_WAKELOCK = 2; @@ -256,14 +253,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit } public void onPatternCellAdded(List<LockPatternView.Cell> pattern) { - // To guard against accidental poking of the wakelock, look for - // the user actually trying to draw a pattern of some minimal length. - if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { - mCallback.userActivity(UNLOCK_PATTERN_WAKE_INTERVAL_MS); - } else { - // Give just a little extra time if they hit one of the first few dots - mCallback.userActivity(UNLOCK_PATTERN_WAKE_INTERVAL_FIRST_DOTS_MS); - } + mCallback.userActivity(); } public void onPatternDetected(List<LockPatternView.Cell> pattern) { @@ -273,7 +263,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit mCallback.dismiss(true); } else { if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) { - mCallback.userActivity(UNLOCK_PATTERN_WAKE_INTERVAL_MS); + mCallback.userActivity(); } mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong); boolean registeredAttempt = diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java index b6f6fd6..bca0305 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPinBasedInputView.java @@ -148,7 +148,7 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView // Poke the wakelock any time the text is selected or modified mPasswordEntry.setOnClickListener(new OnClickListener() { public void onClick(View v) { - mCallback.userActivity(0); // TODO: customize timeout for text? + mCallback.userActivity(); } }); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java index 975ad6c..f361b5c 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java @@ -24,11 +24,9 @@ public interface KeyguardSecurityCallback { void dismiss(boolean securityVerified); /** - * Manually report user activity to keep the device awake. If timeout is 0, - * uses user-defined timeout. - * @param timeout + * Manually report user activity to keep the device awake. */ - void userActivity(long timeout); + void userActivity(); /** * Checks if keyguard is in "verify credentials" mode. diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java index 382cbec..7727e4a 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -47,7 +47,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe // Used to notify the container when something interesting happens. public interface SecurityCallback { public boolean dismiss(boolean authenticated); - public void userActivity(long timeout); + public void userActivity(); public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput); public void finish(); } @@ -419,9 +419,9 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() { - public void userActivity(long timeout) { + public void userActivity() { if (mSecurityCallback != null) { - mSecurityCallback.userActivity(timeout); + mSecurityCallback.userActivity(); } } @@ -459,7 +459,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe // state for the current security method. private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() { @Override - public void userActivity(long timeout) { } + public void userActivity() { } @Override public void showBackupSecurity() { } @Override diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java index 98baa04..85bd87d 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java @@ -58,7 +58,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri if (resId == R.drawable.ic_lockscreen_unlock_phantom || resId == R.drawable.ic_lockscreen_unlock) { - mCallback.userActivity(0); + mCallback.userActivity(); mCallback.dismiss(false); } } @@ -70,7 +70,7 @@ public class KeyguardSelectorView extends LinearLayout implements KeyguardSecuri } public void onGrabbed(View v, int handle) { - mCallback.userActivity(0); + mCallback.userActivity(); doTransition(mFadeView, 0.0f); } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java index cc90bcb..e8e3b19 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSimPinView.java @@ -185,7 +185,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { // otherwise, display a message to the user, and don't submit. mSecurityMessageDisplay.setMessage(R.string.kg_invalid_sim_pin_hint, true); resetPasswordText(true); - mCallback.userActivity(0); + mCallback.userActivity(); return; } @@ -223,7 +223,7 @@ public class KeyguardSimPinView extends KeyguardPinBasedInputView { + " attemptsRemaining=" + attemptsRemaining); resetPasswordText(true /* animate */); } - mCallback.userActivity(0); + mCallback.userActivity(); mCheckSimPinThread = null; } }); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java index 8945b15..737e49b 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardViewBase.java @@ -155,17 +155,6 @@ public abstract class KeyguardViewBase extends FrameLayout implements SecurityCa return mSecurityContainer; } - /** - * Extend display timeout - * @param timeout duration to delay timeout, in ms. - */ - @Override - public void userActivity(long timeout) { - if (mViewMediatorCallback != null) { - mViewMediatorCallback.userActivity(timeout); - } - } - @Override public boolean dismiss(boolean authenticated) { return mSecurityContainer.showNextSecurityScreenOrFinish(authenticated); diff --git a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java index 1f23785..f74843e 100644 --- a/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/ViewMediatorCallback.java @@ -27,13 +27,6 @@ public interface ViewMediatorCallback { void userActivity(); /** - * Reports user activity and requests that the screen stay on for at least - * the specified amount of time. - * @param millis The amount of time in millis. This value is currently ignored. - */ - void userActivity(long millis); - - /** * Report that the keyguard is done. * @param authenticated Whether the user securely got past the keyguard. * the only reason for this to be false is if the keyguard was instructed |