Merge "Migrates Bouncer dismiss events from Tron to WW." into rvc-dev am: 54f1e9b617 am: 577ed68cb1
Change-Id: I6cbe4e1f70c66f38f54f46320979ab36f36205d2
This commit is contained in:
@@ -56,6 +56,9 @@ import androidx.dynamicanimation.animation.DynamicAnimation;
|
||||
import androidx.dynamicanimation.animation.SpringAnimation;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.UiEvent;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.internal.logging.UiEventLoggerImpl;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
|
||||
@@ -95,6 +98,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
// How much to scale the default slop by, to avoid accidental drags.
|
||||
private static final float SLOP_SCALE = 4f;
|
||||
|
||||
private static final UiEventLogger sUiEventLogger = new UiEventLoggerImpl();
|
||||
|
||||
private KeyguardSecurityModel mSecurityModel;
|
||||
private LockPatternUtils mLockPatternUtils;
|
||||
|
||||
@@ -178,6 +183,44 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
public void onCancelClicked();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public enum BouncerUiEvent implements UiEventLogger.UiEventEnum {
|
||||
@UiEvent(doc = "Default UiEvent used for variable initialization.")
|
||||
UNKNOWN(0),
|
||||
|
||||
@UiEvent(doc = "Bouncer is dismissed using extended security access.")
|
||||
BOUNCER_DISMISS_EXTENDED_ACCESS(413),
|
||||
|
||||
@UiEvent(doc = "Bouncer is dismissed using biometric.")
|
||||
BOUNCER_DISMISS_BIOMETRIC(414),
|
||||
|
||||
@UiEvent(doc = "Bouncer is dismissed without security access.")
|
||||
BOUNCER_DISMISS_NONE_SECURITY(415),
|
||||
|
||||
@UiEvent(doc = "Bouncer is dismissed using password security.")
|
||||
BOUNCER_DISMISS_PASSWORD(416),
|
||||
|
||||
@UiEvent(doc = "Bouncer is dismissed using sim security access.")
|
||||
BOUNCER_DISMISS_SIM(417),
|
||||
|
||||
@UiEvent(doc = "Bouncer is successfully unlocked using password.")
|
||||
BOUNCER_PASSWORD_SUCCESS(418),
|
||||
|
||||
@UiEvent(doc = "An attempt to unlock bouncer using password has failed.")
|
||||
BOUNCER_PASSWORD_FAILURE(419);
|
||||
|
||||
private final int mId;
|
||||
|
||||
BouncerUiEvent(int id) {
|
||||
mId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
}
|
||||
|
||||
public KeyguardSecurityContainer(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
@@ -574,17 +617,21 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
boolean finish = false;
|
||||
boolean strongAuth = false;
|
||||
int eventSubtype = -1;
|
||||
BouncerUiEvent uiEvent = BouncerUiEvent.UNKNOWN;
|
||||
if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_EXTENDED_ACCESS;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_EXTENDED_ACCESS;
|
||||
} else if (mUpdateMonitor.getUserUnlockedWithBiometric(targetUserId)) {
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_BIOMETRIC;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_BIOMETRIC;
|
||||
} else if (SecurityMode.None == mCurrentSecuritySelection) {
|
||||
SecurityMode securityMode = mSecurityModel.getSecurityMode(targetUserId);
|
||||
if (SecurityMode.None == securityMode) {
|
||||
finish = true; // no security required
|
||||
eventSubtype = BOUNCER_DISMISS_NONE_SECURITY;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_NONE_SECURITY;
|
||||
} else {
|
||||
showSecurityScreen(securityMode); // switch to the alternate security view
|
||||
}
|
||||
@@ -596,6 +643,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
strongAuth = true;
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_PASSWORD;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_PASSWORD;
|
||||
break;
|
||||
|
||||
case SimPin:
|
||||
@@ -606,6 +654,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
KeyguardUpdateMonitor.getCurrentUser())) {
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_SIM;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_SIM;
|
||||
} else {
|
||||
showSecurityScreen(securityMode);
|
||||
}
|
||||
@@ -630,6 +679,9 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
|
||||
.setType(MetricsEvent.TYPE_DISMISS).setSubtype(eventSubtype));
|
||||
}
|
||||
if (uiEvent != BouncerUiEvent.UNKNOWN) {
|
||||
sUiEventLogger.log(uiEvent);
|
||||
}
|
||||
if (finish) {
|
||||
mSecurityCallback.finish(strongAuth, targetUserId);
|
||||
}
|
||||
@@ -735,6 +787,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
}
|
||||
mMetricsLogger.write(new LogMaker(MetricsEvent.BOUNCER)
|
||||
.setType(success ? MetricsEvent.TYPE_SUCCESS : MetricsEvent.TYPE_FAILURE));
|
||||
sUiEventLogger.log(success ? BouncerUiEvent.BOUNCER_PASSWORD_SUCCESS
|
||||
: BouncerUiEvent.BOUNCER_PASSWORD_FAILURE);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
|
||||
Reference in New Issue
Block a user