Merge "SysUI: Log lockscreen state to eventlog" into lmp-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bd0db7b18f
@@ -9,7 +9,14 @@ option java_package com.android.systemui;
|
|||||||
36001 sysui_heads_up_status (key|3),(visible|1)
|
36001 sysui_heads_up_status (key|3),(visible|1)
|
||||||
36002 sysui_fullscreen_notification (key|3)
|
36002 sysui_fullscreen_notification (key|3)
|
||||||
36003 sysui_heads_up_escalation (key|3)
|
36003 sysui_heads_up_escalation (key|3)
|
||||||
36004 sysui_status_bar_state (state|1)
|
# sysui_status_bar_state: Logged whenever the status bar / keyguard state changes
|
||||||
|
## state: 0: SHADE, 1: KEYGUARD, 2: SHADE_LOCKED
|
||||||
|
## keyguardShowing: 1: Keyguard shown to the user (or keyguardOccluded)
|
||||||
|
## keyguardOccluded: 1: Keyguard active, but another activity is occluding it
|
||||||
|
## bouncerShowing: 1: Bouncer currently shown to the user
|
||||||
|
## secure: 1: The user has set up a secure unlock method (PIN, password, etc.)
|
||||||
|
## currentlyInsecure: 1: No secure unlock method set up (!secure), or trusted environment (TrustManager)
|
||||||
|
36004 sysui_status_bar_state (state|1),(keyguardShowing|1),(keyguardOccluded|1),(bouncerShowing|1),(secure|1),(currentlyInsecure|1)
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# PhoneStatusBarView.java
|
# PhoneStatusBarView.java
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
// TODO: Real icon for facelock.
|
// TODO: Real icon for facelock.
|
||||||
int iconRes = mUnlockMethodCache.isFaceUnlockRunning()
|
int iconRes = mUnlockMethodCache.isFaceUnlockRunning()
|
||||||
? com.android.internal.R.drawable.ic_account_circle
|
? com.android.internal.R.drawable.ic_account_circle
|
||||||
: mUnlockMethodCache.isMethodInsecure() ? R.drawable.ic_lock_open_24dp
|
: mUnlockMethodCache.isCurrentlyInsecure() ? R.drawable.ic_lock_open_24dp
|
||||||
: R.drawable.ic_lock_24dp;
|
: R.drawable.ic_lock_24dp;
|
||||||
if (mLastUnlockIconRes != iconRes) {
|
if (mLastUnlockIconRes != iconRes) {
|
||||||
Drawable icon = mContext.getDrawable(iconRes);
|
Drawable icon = mContext.getDrawable(iconRes);
|
||||||
@@ -438,7 +438,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMethodSecureChanged(boolean methodSecure) {
|
public void onUnlockMethodStateChanged() {
|
||||||
updateLockIcon();
|
updateLockIcon();
|
||||||
updateCameraVisibility();
|
updateCameraVisibility();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,9 @@ public class KeyguardBouncer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WARNING: This method might cause Binder calls.
|
||||||
|
*/
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return mKeyguardView == null || mKeyguardView.getSecurityMode() != SecurityMode.None;
|
return mKeyguardView == null || mKeyguardView.getSecurityMode() != SecurityMode.None;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ import com.android.systemui.statusbar.SignalClusterView;
|
|||||||
import com.android.systemui.statusbar.SpeedBumpView;
|
import com.android.systemui.statusbar.SpeedBumpView;
|
||||||
import com.android.systemui.statusbar.StatusBarIconView;
|
import com.android.systemui.statusbar.StatusBarIconView;
|
||||||
import com.android.systemui.statusbar.StatusBarState;
|
import com.android.systemui.statusbar.StatusBarState;
|
||||||
|
import com.android.systemui.statusbar.phone.UnlockMethodCache.OnUnlockMethodChangedListener;
|
||||||
import com.android.systemui.statusbar.policy.AccessibilityController;
|
import com.android.systemui.statusbar.policy.AccessibilityController;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController;
|
import com.android.systemui.statusbar.policy.BatteryController;
|
||||||
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
|
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
|
||||||
@@ -183,7 +184,7 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||||
DragDownHelper.DragDownCallback, ActivityStarter {
|
DragDownHelper.DragDownCallback, ActivityStarter, OnUnlockMethodChangedListener {
|
||||||
static final String TAG = "PhoneStatusBar";
|
static final String TAG = "PhoneStatusBar";
|
||||||
public static final boolean DEBUG = BaseStatusBar.DEBUG;
|
public static final boolean DEBUG = BaseStatusBar.DEBUG;
|
||||||
public static final boolean SPEW = false;
|
public static final boolean SPEW = false;
|
||||||
@@ -493,6 +494,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
private boolean mLaunchTransitionFadingAway;
|
private boolean mLaunchTransitionFadingAway;
|
||||||
private ExpandableNotificationRow mDraggedDownRow;
|
private ExpandableNotificationRow mDraggedDownRow;
|
||||||
|
|
||||||
|
// Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
|
||||||
|
private int mLastLoggedStateFingerprint;
|
||||||
|
|
||||||
private static final int VISIBLE_LOCATIONS = ViewState.LOCATION_FIRST_CARD
|
private static final int VISIBLE_LOCATIONS = ViewState.LOCATION_FIRST_CARD
|
||||||
| ViewState.LOCATION_TOP_STACK_PEEKING
|
| ViewState.LOCATION_TOP_STACK_PEEKING
|
||||||
| ViewState.LOCATION_MAIN_AREA
|
| ViewState.LOCATION_MAIN_AREA
|
||||||
@@ -603,6 +607,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
mHeadsUpObserver);
|
mHeadsUpObserver);
|
||||||
}
|
}
|
||||||
mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
|
mUnlockMethodCache = UnlockMethodCache.getInstance(mContext);
|
||||||
|
mUnlockMethodCache.addListener(this);
|
||||||
startKeyguard();
|
startKeyguard();
|
||||||
|
|
||||||
mDozeServiceHost = new DozeServiceHost();
|
mDozeServiceHost = new DozeServiceHost();
|
||||||
@@ -2159,8 +2164,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
|
|
||||||
public boolean isFalsingThresholdNeeded() {
|
public boolean isFalsingThresholdNeeded() {
|
||||||
boolean onKeyguard = getBarState() == StatusBarState.KEYGUARD;
|
boolean onKeyguard = getBarState() == StatusBarState.KEYGUARD;
|
||||||
boolean isMethodInsecure = mUnlockMethodCache.isMethodInsecure();
|
boolean isCurrentlyInsecure = mUnlockMethodCache.isCurrentlyInsecure();
|
||||||
return onKeyguard && (isMethodInsecure || mDozing || mScreenOnComingFromTouch);
|
return onKeyguard && (isCurrentlyInsecure || mDozing || mScreenOnComingFromTouch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDozing() {
|
public boolean isDozing() {
|
||||||
@@ -2176,6 +2181,18 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
return mScrimSrcModeEnabled;
|
return mScrimSrcModeEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To be called when there's a state change in StatusBarKeyguardViewManager.
|
||||||
|
*/
|
||||||
|
public void onKeyguardViewManagerStatesUpdated() {
|
||||||
|
logStateToEventlog();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // UnlockMethodCache.OnUnlockMethodChangedListener
|
||||||
|
public void onUnlockMethodStateChanged() {
|
||||||
|
logStateToEventlog();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All changes to the status bar and notifications funnel through here and are batched.
|
* All changes to the status bar and notifications funnel through here and are batched.
|
||||||
*/
|
*/
|
||||||
@@ -3348,6 +3365,47 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// State logging
|
||||||
|
|
||||||
|
private void logStateToEventlog() {
|
||||||
|
boolean isShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||||
|
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded();
|
||||||
|
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
|
||||||
|
boolean isSecure = mUnlockMethodCache.isMethodSecure();
|
||||||
|
boolean isCurrentlyInsecure = mUnlockMethodCache.isCurrentlyInsecure();
|
||||||
|
int stateFingerprint = getLoggingFingerprint(mState,
|
||||||
|
isShowing,
|
||||||
|
isOccluded,
|
||||||
|
isBouncerShowing,
|
||||||
|
isSecure,
|
||||||
|
isCurrentlyInsecure);
|
||||||
|
if (stateFingerprint != mLastLoggedStateFingerprint) {
|
||||||
|
EventLogTags.writeSysuiStatusBarState(mState,
|
||||||
|
isShowing ? 1 : 0,
|
||||||
|
isOccluded ? 1 : 0,
|
||||||
|
isBouncerShowing ? 1 : 0,
|
||||||
|
isSecure ? 1 : 0,
|
||||||
|
isCurrentlyInsecure ? 1 : 0);
|
||||||
|
mLastLoggedStateFingerprint = stateFingerprint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a fingerprint of fields logged to eventlog
|
||||||
|
*/
|
||||||
|
private static int getLoggingFingerprint(int statusBarState, boolean keyguardShowing,
|
||||||
|
boolean keyguardOccluded, boolean bouncerShowing, boolean secure,
|
||||||
|
boolean currentlyInsecure) {
|
||||||
|
// Reserve 8 bits for statusBarState. We'll never go higher than
|
||||||
|
// that, right? Riiiight.
|
||||||
|
return (statusBarState & 0xFF)
|
||||||
|
| ((keyguardShowing ? 1 : 0) << 8)
|
||||||
|
| ((keyguardOccluded ? 1 : 0) << 9)
|
||||||
|
| ((bouncerShowing ? 1 : 0) << 10)
|
||||||
|
| ((secure ? 1 : 0) << 11)
|
||||||
|
| ((currentlyInsecure ? 1 : 0) << 12);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// tracing
|
// tracing
|
||||||
//
|
//
|
||||||
@@ -3836,19 +3894,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
* @param state The {@link StatusBarState} to set.
|
* @param state The {@link StatusBarState} to set.
|
||||||
*/
|
*/
|
||||||
public void setBarState(int state) {
|
public void setBarState(int state) {
|
||||||
if (state != mState) {
|
// If we're visible and switched to SHADE_LOCKED (the user dragged
|
||||||
EventLogTags.writeSysuiStatusBarState(state);
|
// down on the lockscreen), clear notification LED, vibration,
|
||||||
|
// ringing.
|
||||||
// If we're visible and switched to SHADE_LOCKED (the user dragged
|
// Other transitions are covered in handleVisibleToUserChanged().
|
||||||
// down on the lockscreen), clear notification LED, vibration,
|
if (state != mState && mVisible && state == StatusBarState.SHADE_LOCKED) {
|
||||||
// ringing.
|
try {
|
||||||
// Other transitions are covered in handleVisibleToUserChanged().
|
mBarService.clearNotificationEffects();
|
||||||
if (mVisible && state == StatusBarState.SHADE_LOCKED) {
|
} catch (RemoteException e) {
|
||||||
try {
|
// Ignore.
|
||||||
mBarService.clearNotificationEffects();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
// Ignore.
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mState = state;
|
mState = state;
|
||||||
@@ -3890,7 +3944,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
|
|
||||||
public void onTrackingStopped(boolean expand) {
|
public void onTrackingStopped(boolean expand) {
|
||||||
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
|
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
|
||||||
if (!expand && !mUnlockMethodCache.isMethodInsecure()) {
|
if (!expand && !mUnlockMethodCache.isCurrentlyInsecure()) {
|
||||||
showBouncer();
|
showBouncer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener {
|
|||||||
|
|
||||||
public void onTrackingStarted() {
|
public void onTrackingStarted() {
|
||||||
mExpanding = true;
|
mExpanding = true;
|
||||||
mDarkenWhileDragging = !mUnlockMethodCache.isMethodInsecure();
|
mDarkenWhileDragging = !mUnlockMethodCache.isCurrentlyInsecure();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onExpandingFinished() {
|
public void onExpandingFinished() {
|
||||||
|
|||||||
@@ -303,6 +303,9 @@ public class StatusBarKeyguardViewManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WARNING: This method might cause Binder calls.
|
||||||
|
*/
|
||||||
public boolean isSecure() {
|
public boolean isSecure() {
|
||||||
return mBouncer.isSecure();
|
return mBouncer.isSecure();
|
||||||
}
|
}
|
||||||
@@ -396,6 +399,8 @@ public class StatusBarKeyguardViewManager {
|
|||||||
mLastOccluded = occluded;
|
mLastOccluded = occluded;
|
||||||
mLastBouncerShowing = bouncerShowing;
|
mLastBouncerShowing = bouncerShowing;
|
||||||
mLastBouncerDismissible = bouncerDismissible;
|
mLastBouncerDismissible = bouncerDismissible;
|
||||||
|
|
||||||
|
mPhoneStatusBar.onKeyguardViewManagerStatesUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onMenuPressed() {
|
public boolean onMenuPressed() {
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ public class UnlockMethodCache {
|
|||||||
private final LockPatternUtils mLockPatternUtils;
|
private final LockPatternUtils mLockPatternUtils;
|
||||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>();
|
private final ArrayList<OnUnlockMethodChangedListener> mListeners = new ArrayList<>();
|
||||||
private boolean mMethodInsecure;
|
/** Whether the user configured a secure unlock method (PIN, password, etc.) */
|
||||||
|
private boolean mSecure;
|
||||||
|
/** Whether the unlock method is currently insecure (insecure method or trusted environment) */
|
||||||
|
private boolean mCurrentlyInsecure;
|
||||||
private boolean mTrustManaged;
|
private boolean mTrustManaged;
|
||||||
private boolean mFaceUnlockRunning;
|
private boolean mFaceUnlockRunning;
|
||||||
|
|
||||||
@@ -44,7 +47,7 @@ public class UnlockMethodCache {
|
|||||||
mLockPatternUtils = new LockPatternUtils(ctx);
|
mLockPatternUtils = new LockPatternUtils(ctx);
|
||||||
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx);
|
mKeyguardUpdateMonitor = KeyguardUpdateMonitor.getInstance(ctx);
|
||||||
KeyguardUpdateMonitor.getInstance(ctx).registerCallback(mCallback);
|
KeyguardUpdateMonitor.getInstance(ctx).registerCallback(mCallback);
|
||||||
updateMethodSecure(true /* updateAlways */);
|
update(true /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UnlockMethodCache getInstance(Context context) {
|
public static UnlockMethodCache getInstance(Context context) {
|
||||||
@@ -55,10 +58,17 @@ public class UnlockMethodCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the current security method is secure, i. e. the bouncer will be shown
|
* @return whether the user configured a secure unlock method like PIN, password, etc.
|
||||||
*/
|
*/
|
||||||
public boolean isMethodInsecure() {
|
public boolean isMethodSecure() {
|
||||||
return mMethodInsecure;
|
return mSecure;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return whether the lockscreen is currently insecure, i. e. the bouncer won't be shown
|
||||||
|
*/
|
||||||
|
public boolean isCurrentlyInsecure() {
|
||||||
|
return mCurrentlyInsecure;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addListener(OnUnlockMethodChangedListener listener) {
|
public void addListener(OnUnlockMethodChangedListener listener) {
|
||||||
@@ -69,58 +79,59 @@ public class UnlockMethodCache {
|
|||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMethodSecure(boolean updateAlways) {
|
private void update(boolean updateAlways) {
|
||||||
int user = mLockPatternUtils.getCurrentUser();
|
int user = mLockPatternUtils.getCurrentUser();
|
||||||
boolean methodInsecure = !mLockPatternUtils.isSecure() ||
|
boolean secure = mLockPatternUtils.isSecure();
|
||||||
mKeyguardUpdateMonitor.getUserHasTrust(user);
|
boolean currentlyInsecure = !secure || mKeyguardUpdateMonitor.getUserHasTrust(user);
|
||||||
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
|
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
|
||||||
boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
|
boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
|
||||||
&& trustManaged;
|
&& trustManaged;
|
||||||
boolean changed = methodInsecure != mMethodInsecure || trustManaged != mTrustManaged
|
boolean changed = secure != mSecure || currentlyInsecure != mCurrentlyInsecure ||
|
||||||
|| faceUnlockRunning != mFaceUnlockRunning;
|
trustManaged != mTrustManaged || faceUnlockRunning != mFaceUnlockRunning;
|
||||||
if (changed || updateAlways) {
|
if (changed || updateAlways) {
|
||||||
mMethodInsecure = methodInsecure;
|
mSecure = secure;
|
||||||
|
mCurrentlyInsecure = currentlyInsecure;
|
||||||
mTrustManaged = trustManaged;
|
mTrustManaged = trustManaged;
|
||||||
mFaceUnlockRunning = faceUnlockRunning;
|
mFaceUnlockRunning = faceUnlockRunning;
|
||||||
notifyListeners(mMethodInsecure);
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyListeners(boolean secure) {
|
private void notifyListeners() {
|
||||||
for (OnUnlockMethodChangedListener listener : mListeners) {
|
for (OnUnlockMethodChangedListener listener : mListeners) {
|
||||||
listener.onMethodSecureChanged(secure);
|
listener.onUnlockMethodStateChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
|
private final KeyguardUpdateMonitorCallback mCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onUserSwitchComplete(int userId) {
|
public void onUserSwitchComplete(int userId) {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrustChanged(int userId) {
|
public void onTrustChanged(int userId) {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTrustManagedChanged(int userId) {
|
public void onTrustManagedChanged(int userId) {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScreenTurnedOn() {
|
public void onScreenTurnedOn() {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintRecognized(int userId) {
|
public void onFingerprintRecognized(int userId) {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFaceUnlockStateChanged(boolean running, int userId) {
|
public void onFaceUnlockStateChanged(boolean running, int userId) {
|
||||||
updateMethodSecure(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -133,6 +144,6 @@ public class UnlockMethodCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static interface OnUnlockMethodChangedListener {
|
public static interface OnUnlockMethodChangedListener {
|
||||||
void onMethodSecureChanged(boolean methodSecure);
|
void onUnlockMethodStateChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user