Unlock latency improvements
- Make sure the latency also gets tracked on first unlocked in which we cancel the AsyncTask. - Also add it for pattern authentication Change-Id: Ie1561264b0a3b75c09819ccc6d269e61e367e1be
This commit is contained in:
@@ -29,6 +29,11 @@ public final class LockPatternChecker {
|
||||
* the call. Only non-0 if matched is false.
|
||||
*/
|
||||
void onChecked(boolean matched, int throttleTimeoutMs);
|
||||
|
||||
/**
|
||||
* Called when the underlying AsyncTask was cancelled.
|
||||
*/
|
||||
default void onCancelled() {}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,6 +115,11 @@ public final class LockPatternChecker {
|
||||
protected void onPostExecute(Boolean result) {
|
||||
callback.onChecked(result, mThrottleTimeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
callback.onCancelled();
|
||||
}
|
||||
};
|
||||
task.execute();
|
||||
return task;
|
||||
@@ -217,6 +227,11 @@ public final class LockPatternChecker {
|
||||
protected void onPostExecute(Boolean result) {
|
||||
callback.onChecked(result, mThrottleTimeout);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCancelled() {
|
||||
callback.onCancelled();
|
||||
}
|
||||
};
|
||||
task.execute();
|
||||
return task;
|
||||
|
||||
@@ -168,6 +168,16 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
|
||||
true /* isValidPassword */);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
// We already got dismissed with the early matched callback, so we cancelled
|
||||
// the check. However, we still need to note down the latency.
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionEnd(
|
||||
ACTION_CHECK_CREDENTIAL_UNLOCKED);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package com.android.keyguard;
|
||||
|
||||
import static com.android.keyguard.LatencyTracker.ACTION_CHECK_CREDENTIAL;
|
||||
import static com.android.keyguard.LatencyTracker.ACTION_CHECK_CREDENTIAL_UNLOCKED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.AsyncTask;
|
||||
@@ -242,6 +245,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
return;
|
||||
}
|
||||
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL);
|
||||
LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL_UNLOCKED);
|
||||
}
|
||||
mPendingLockCheck = LockPatternChecker.checkPattern(
|
||||
mLockPatternUtils,
|
||||
pattern,
|
||||
@@ -250,12 +257,20 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
|
||||
@Override
|
||||
public void onEarlyMatched() {
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionEnd(
|
||||
ACTION_CHECK_CREDENTIAL);
|
||||
}
|
||||
onPatternChecked(userId, true /* matched */, 0 /* timeoutMs */,
|
||||
true /* isValidPattern */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChecked(boolean matched, int timeoutMs) {
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionEnd(
|
||||
ACTION_CHECK_CREDENTIAL_UNLOCKED);
|
||||
}
|
||||
mLockPatternView.enableInput();
|
||||
mPendingLockCheck = null;
|
||||
if (!matched) {
|
||||
@@ -263,6 +278,16 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
true /* isValidPattern */);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled() {
|
||||
// We already got dismissed with the early matched callback, so we
|
||||
// cancelled the check. However, we still need to note down the latency.
|
||||
if (LatencyTracker.isEnabled(mContext)) {
|
||||
LatencyTracker.getInstance(mContext).onActionEnd(
|
||||
ACTION_CHECK_CREDENTIAL_UNLOCKED);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (pattern.size() > MIN_PATTERN_BEFORE_POKE_WAKELOCK) {
|
||||
mCallback.userActivity();
|
||||
|
||||
Reference in New Issue
Block a user