Add latency tracking for checking PIN (1/2)

Also move tags to Keyguard as we need it in Keyguard.

Change-Id: I718581cb4081830da1c3a2f4ad9b9f0ec6f09ae5
This commit is contained in:
Jorim Jaggi
2016-09-15 16:31:14 -07:00
parent 5c8ac12684
commit d05651790a
11 changed files with 59 additions and 14 deletions

View File

@@ -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
@@ -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

View File

@@ -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;
@@ -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,
@@ -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) {

View File

@@ -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;
@@ -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 {
@@ -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;

View File

@@ -2,10 +2,9 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := SystemUI-proto-tags
LOCAL_MODULE := SystemUI-proto
LOCAL_SRC_FILES := $(call all-proto-files-under,src) \
src/com/android/systemui/EventLogTags.logtags
LOCAL_SRC_FILES := $(call all-proto-files-under,src)
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
LOCAL_PROTO_JAVA_OUTPUT_PARAMS := optional_field_style=accessors
@@ -33,7 +32,7 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \
LOCAL_STATIC_JAVA_LIBRARIES := \
framework-protos \
SystemUI-proto-tags
SystemUI-proto
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_JAVA_LIBRARIES += android.car

View File

@@ -43,7 +43,7 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.systemui.DejankUtils;
import com.android.systemui.Interpolators;
import com.android.systemui.LatencyTracker;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.events.EventBus;

View File

@@ -30,7 +30,7 @@ import android.util.Log;
import com.android.keyguard.KeyguardConstants;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.LatencyTracker;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.keyguard.KeyguardViewMediator;
/**

View File

@@ -23,7 +23,6 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Trace;
import android.util.AttributeSet;
import android.util.Log;
import android.view.InputDevice;
@@ -37,7 +36,7 @@ import com.android.systemui.DejankUtils;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
import com.android.systemui.LatencyTracker;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
import com.android.systemui.doze.DozeLog;

View File

@@ -133,7 +133,7 @@ import com.android.systemui.DemoMode;
import com.android.systemui.EventLogConstants;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
import com.android.systemui.LatencyTracker;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.SystemUIFactory;

View File

@@ -31,7 +31,7 @@ import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.DejankUtils;
import com.android.systemui.LatencyTracker;
import com.android.keyguard.LatencyTracker;
import com.android.systemui.SystemUIFactory;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.RemoteInputController;

View File

@@ -45,7 +45,8 @@ LOCAL_STATIC_ANDROID_LIBRARIES := \
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-test \
mockito-target-minus-junit4 \
SystemUI-proto-tags
SystemUI-proto \
SystemUI-tags
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common android.car