Loading core/java/com/android/internal/widget/LockPatternChecker.java +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,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() {} } /** Loading Loading @@ -127,6 +132,11 @@ public final class LockPatternChecker { protected void onPostExecute(Boolean result) { callback.onChecked(result, mThrottleTimeout); } @Override protected void onCancelled() { callback.onCancelled(); } }; task.execute(); return task; Loading Loading @@ -234,6 +244,11 @@ public final class LockPatternChecker { protected void onPostExecute(Boolean result) { callback.onChecked(result, mThrottleTimeout); } @Override protected void onCancelled() { callback.onCancelled(); } }; task.execute(); return task; Loading packages/Keyguard/Android.mk +13 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,17 @@ # LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := SystemUI-tags LOCAL_SRC_FILES := src/com/android/systemui/EventLogTags.logtags include $(BUILD_STATIC_JAVA_LIBRARY) # ------------------ include $(CLEAR_VARS) LOCAL_USE_AAPT2 := true Loading @@ -26,6 +37,8 @@ LOCAL_CERTIFICATE := platform LOCAL_JAVA_LIBRARIES := SettingsLib LOCAL_STATIC_JAVA_LIBRARIES = SystemUI-tags LOCAL_PRIVILEGED_MODULE := true LOCAL_PROGUARD_FLAG_FILES := proguard.flags Loading packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +25 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,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.os.AsyncTask; import android.os.CountDownTimer; Loading Loading @@ -132,6 +135,10 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout return; } if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL); LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL_UNLOCKED); } mPendingLockCheck = LockPatternChecker.checkPassword( mLockPatternUtils, entry, Loading @@ -140,12 +147,20 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout @Override public void onEarlyMatched() { if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionEnd( ACTION_CHECK_CREDENTIAL); } onPasswordChecked(userId, true /* matched */, 0 /* timeoutMs */, true /* isValidPassword */); } @Override public void onChecked(boolean matched, int timeoutMs) { if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionEnd( ACTION_CHECK_CREDENTIAL_UNLOCKED); } setPasswordEntryInputEnabled(true); mPendingLockCheck = null; if (!matched) { Loading @@ -153,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); } } }); } Loading packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +25 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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, Loading @@ -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) { Loading @@ -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(); Loading packages/SystemUI/src/com/android/systemui/LatencyTracker.java→packages/Keyguard/src/com/android/keyguard/LatencyTracker.java +21 −3 Original line number Diff line number Diff line Loading @@ -14,14 +14,13 @@ * limitations under the License */ package com.android.systemui; package com.android.keyguard; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Handler; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; Loading @@ -29,9 +28,15 @@ import android.util.EventLog; import android.util.Log; import android.util.SparseLongArray; import com.android.systemui.EventLogTags; /** * Class to track various latencies in SystemUI. It then outputs the latency to logcat so these * latencies can be captured by tests and then used for dashboards. * <p> * This is currently only in Keyguard so it can be shared between SystemUI and Keyguard, but * eventually we'd want to merge these two packages together so Keyguard can use common classes * that are shared with SystemUI. */ public class LatencyTracker { Loading @@ -55,10 +60,23 @@ public class LatencyTracker { */ public static final int ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 2; /** * Time it takes to check PIN/Pattern/Password. */ public static final int ACTION_CHECK_CREDENTIAL = 3; /** * Time it takes to check fully PIN/Pattern/Password, i.e. that's the time spent including the * actions to unlock a user. */ public static final int ACTION_CHECK_CREDENTIAL_UNLOCKED = 4; private static final String[] NAMES = new String[] { "expand panel", "toggle recents", "fingerprint wake-and-unlock" }; "fingerprint wake-and-unlock", "check credential", "check credential unlocked" }; private static LatencyTracker sLatencyTracker; Loading Loading
core/java/com/android/internal/widget/LockPatternChecker.java +15 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,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() {} } /** Loading Loading @@ -127,6 +132,11 @@ public final class LockPatternChecker { protected void onPostExecute(Boolean result) { callback.onChecked(result, mThrottleTimeout); } @Override protected void onCancelled() { callback.onCancelled(); } }; task.execute(); return task; Loading Loading @@ -234,6 +244,11 @@ public final class LockPatternChecker { protected void onPostExecute(Boolean result) { callback.onChecked(result, mThrottleTimeout); } @Override protected void onCancelled() { callback.onCancelled(); } }; task.execute(); return task; Loading
packages/Keyguard/Android.mk +13 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,17 @@ # LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := SystemUI-tags LOCAL_SRC_FILES := src/com/android/systemui/EventLogTags.logtags include $(BUILD_STATIC_JAVA_LIBRARY) # ------------------ include $(CLEAR_VARS) LOCAL_USE_AAPT2 := true Loading @@ -26,6 +37,8 @@ LOCAL_CERTIFICATE := platform LOCAL_JAVA_LIBRARIES := SettingsLib LOCAL_STATIC_JAVA_LIBRARIES = SystemUI-tags LOCAL_PRIVILEGED_MODULE := true LOCAL_PROGUARD_FLAG_FILES := proguard.flags Loading
packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java +25 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,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.os.AsyncTask; import android.os.CountDownTimer; Loading Loading @@ -132,6 +135,10 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout return; } if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL); LatencyTracker.getInstance(mContext).onActionStart(ACTION_CHECK_CREDENTIAL_UNLOCKED); } mPendingLockCheck = LockPatternChecker.checkPassword( mLockPatternUtils, entry, Loading @@ -140,12 +147,20 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout @Override public void onEarlyMatched() { if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionEnd( ACTION_CHECK_CREDENTIAL); } onPasswordChecked(userId, true /* matched */, 0 /* timeoutMs */, true /* isValidPassword */); } @Override public void onChecked(boolean matched, int timeoutMs) { if (LatencyTracker.isEnabled(mContext)) { LatencyTracker.getInstance(mContext).onActionEnd( ACTION_CHECK_CREDENTIAL_UNLOCKED); } setPasswordEntryInputEnabled(true); mPendingLockCheck = null; if (!matched) { Loading @@ -153,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); } } }); } Loading
packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +25 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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, Loading @@ -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) { Loading @@ -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(); Loading
packages/SystemUI/src/com/android/systemui/LatencyTracker.java→packages/Keyguard/src/com/android/keyguard/LatencyTracker.java +21 −3 Original line number Diff line number Diff line Loading @@ -14,14 +14,13 @@ * limitations under the License */ package com.android.systemui; package com.android.keyguard; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Handler; import android.os.SystemClock; import android.os.SystemProperties; import android.os.Trace; Loading @@ -29,9 +28,15 @@ import android.util.EventLog; import android.util.Log; import android.util.SparseLongArray; import com.android.systemui.EventLogTags; /** * Class to track various latencies in SystemUI. It then outputs the latency to logcat so these * latencies can be captured by tests and then used for dashboards. * <p> * This is currently only in Keyguard so it can be shared between SystemUI and Keyguard, but * eventually we'd want to merge these two packages together so Keyguard can use common classes * that are shared with SystemUI. */ public class LatencyTracker { Loading @@ -55,10 +60,23 @@ public class LatencyTracker { */ public static final int ACTION_FINGERPRINT_WAKE_AND_UNLOCK = 2; /** * Time it takes to check PIN/Pattern/Password. */ public static final int ACTION_CHECK_CREDENTIAL = 3; /** * Time it takes to check fully PIN/Pattern/Password, i.e. that's the time spent including the * actions to unlock a user. */ public static final int ACTION_CHECK_CREDENTIAL_UNLOCKED = 4; private static final String[] NAMES = new String[] { "expand panel", "toggle recents", "fingerprint wake-and-unlock" }; "fingerprint wake-and-unlock", "check credential", "check credential unlocked" }; private static LatencyTracker sLatencyTracker; Loading