Merge "Disable screenOffUdfps by default" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
39e1e04a04
@@ -53,7 +53,8 @@ public class AmbientDisplayConfiguration {
|
||||
|| pickupGestureEnabled(user)
|
||||
|| tapGestureEnabled(user)
|
||||
|| doubleTapGestureEnabled(user)
|
||||
|| quickPickupSensorEnabled(user);
|
||||
|| quickPickupSensorEnabled(user)
|
||||
|| screenOffUdfpsEnabled(user);
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
@@ -105,6 +106,12 @@ public class AmbientDisplayConfiguration {
|
||||
return !TextUtils.isEmpty(quickPickupSensorType()) && !alwaysOnEnabled(user);
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public boolean screenOffUdfpsEnabled(int user) {
|
||||
return !TextUtils.isEmpty(udfpsLongPressSensorType())
|
||||
&& boolSettingDefaultOff("screen_off_udfps_enabled", user);
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
public boolean wakeScreenGestureAvailable() {
|
||||
return mContext.getResources()
|
||||
|
||||
@@ -66,10 +66,8 @@ import android.os.Handler;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -243,21 +241,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
private final boolean mIsPrimaryUser;
|
||||
private final boolean mIsAutomotive;
|
||||
private final AuthController mAuthController;
|
||||
private final PowerManager mPowerManager;
|
||||
private final StatusBarStateController mStatusBarStateController;
|
||||
private int mStatusBarState;
|
||||
private boolean mDozing;
|
||||
private final StatusBarStateController.StateListener mStatusBarStateControllerListener =
|
||||
new StatusBarStateController.StateListener() {
|
||||
@Override
|
||||
public void onStateChanged(int newState) {
|
||||
mStatusBarState = newState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDozingChanged(boolean dozing) {
|
||||
mDozing = dozing;
|
||||
}
|
||||
};
|
||||
|
||||
HashMap<Integer, SimData> mSimDatas = new HashMap<>();
|
||||
@@ -1330,19 +1321,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
|
||||
private final FingerprintManager.AuthenticationCallback mFingerprintAuthenticationCallback
|
||||
= new AuthenticationCallback() {
|
||||
private boolean mIsUdfpsRunningWhileDozing;
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailed() {
|
||||
handleFingerprintAuthFailed();
|
||||
cancelAodInterrupt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
||||
Trace.beginSection("KeyguardUpdateMonitor#onAuthenticationSucceeded");
|
||||
handleFingerprintAuthenticated(result.getUserId(), result.isStrongBiometric());
|
||||
cancelAodInterrupt();
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@@ -1354,7 +1342,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
@Override
|
||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||
handleFingerprintError(errMsgId, errString.toString());
|
||||
cancelAodInterrupt();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1365,25 +1352,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
@Override
|
||||
public void onUdfpsPointerDown(int sensorId) {
|
||||
Log.d(TAG, "onUdfpsPointerDown, sensorId: " + sensorId);
|
||||
|
||||
if (mDozing) {
|
||||
mIsUdfpsRunningWhileDozing = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUdfpsPointerUp(int sensorId) {
|
||||
Log.d(TAG, "onUdfpsPointerUp, sensorId: " + sensorId);
|
||||
}
|
||||
|
||||
private void cancelAodInterrupt() {
|
||||
if (mIsUdfpsRunningWhileDozing) {
|
||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
|
||||
"com.android.systemui:AOD_INTERRUPT_END");
|
||||
}
|
||||
mAuthController.onCancelUdfps();
|
||||
mIsUdfpsRunningWhileDozing = false;
|
||||
}
|
||||
};
|
||||
|
||||
private final FaceManager.FaceDetectionCallback mFaceDetectionCallback
|
||||
@@ -1676,7 +1650,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
LockPatternUtils lockPatternUtils,
|
||||
AuthController authController,
|
||||
TelephonyListenerManager telephonyListenerManager,
|
||||
PowerManager powerManager,
|
||||
FeatureFlags featureFlags) {
|
||||
mContext = context;
|
||||
mSubscriptionManager = SubscriptionManager.from(context);
|
||||
@@ -1689,10 +1662,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
mStatusBarStateController = statusBarStateController;
|
||||
mStatusBarStateController.addCallback(mStatusBarStateControllerListener);
|
||||
mStatusBarState = mStatusBarStateController.getState();
|
||||
mDozing = mStatusBarStateController.isDozing();
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
mAuthController = authController;
|
||||
mPowerManager = powerManager;
|
||||
dumpManager.registerDumpable(getClass().getName(), this);
|
||||
|
||||
mHandler = new Handler(mainLooper) {
|
||||
|
||||
@@ -70,6 +70,7 @@ public class DozeSensors {
|
||||
private final Consumer<Boolean> mProxCallback;
|
||||
private final SecureSettings mSecureSettings;
|
||||
private final Callback mCallback;
|
||||
private final boolean mScreenOffUdfpsEnabled;
|
||||
@VisibleForTesting
|
||||
protected TriggerSensor[] mSensors;
|
||||
|
||||
@@ -116,6 +117,8 @@ public class DozeSensors {
|
||||
mProximitySensor = proximitySensor;
|
||||
mSelectivelyRegisterProxSensors = dozeParameters.getSelectivelyRegisterSensorsUsingProx();
|
||||
mListeningProxSensors = !mSelectivelyRegisterProxSensors;
|
||||
mScreenOffUdfpsEnabled =
|
||||
config.screenOffUdfpsEnabled(KeyguardUpdateMonitor.getCurrentUser());
|
||||
|
||||
boolean udfpsEnrolled =
|
||||
authController.isUdfpsEnrolled(KeyguardUpdateMonitor.getCurrentUser());
|
||||
@@ -171,7 +174,7 @@ public class DozeSensors {
|
||||
findSensorWithType(config.udfpsLongPressSensorType()),
|
||||
"doze_pulse_on_auth",
|
||||
true /* settingDef */,
|
||||
udfpsEnrolled,
|
||||
udfpsEnrolled && (alwaysOn || mScreenOffUdfpsEnabled),
|
||||
DozeLog.REASON_SENSOR_UDFPS_LONG_PRESS,
|
||||
true /* reports touch coordinates */,
|
||||
true /* touchscreen */,
|
||||
@@ -369,6 +372,7 @@ public class DozeSensors {
|
||||
pw.println("mListeningTouchScreenSensors=" + mListeningTouchScreenSensors);
|
||||
pw.println("mSelectivelyRegisterProxSensors=" + mSelectivelyRegisterProxSensors);
|
||||
pw.println("mListeningProxSensors=" + mListeningProxSensors);
|
||||
pw.println("mScreenOffUdfpsEnabled=" + mScreenOffUdfpsEnabled);
|
||||
IndentingPrintWriter idpw = new IndentingPrintWriter(pw);
|
||||
idpw.increaseIndent();
|
||||
for (TriggerSensor s : mSensors) {
|
||||
|
||||
@@ -62,7 +62,6 @@ import android.nfc.NfcAdapter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.IRemoteCallback;
|
||||
import android.os.PowerManager;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.telephony.ServiceState;
|
||||
@@ -166,8 +165,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private AuthController mAuthController;
|
||||
@Mock
|
||||
private PowerManager mPowerManager;
|
||||
@Mock
|
||||
private TelephonyListenerManager mTelephonyListenerManager;
|
||||
@Mock
|
||||
private FeatureFlags mFeatureFlags;
|
||||
@@ -525,46 +522,6 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
verify(mFaceManager).authenticate(any(), any(), any(), any(), anyInt());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFingerprintCancelAodInterrupt_onAuthenticationFailed() {
|
||||
// GIVEN on keyguard and listening for fingerprint authentication
|
||||
mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(0 /* why */);
|
||||
mTestableLooper.processAllMessages();
|
||||
|
||||
ArgumentCaptor<FingerprintManager.AuthenticationCallback> fingerprintCallbackCaptor =
|
||||
ArgumentCaptor.forClass(FingerprintManager.AuthenticationCallback.class);
|
||||
verify(mFingerprintManager).authenticate(any(), any(), fingerprintCallbackCaptor.capture(),
|
||||
any(), anyInt(), anyInt());
|
||||
FingerprintManager.AuthenticationCallback authCallback =
|
||||
fingerprintCallbackCaptor.getValue();
|
||||
|
||||
// WHEN authentication fails
|
||||
authCallback.onAuthenticationFailed();
|
||||
|
||||
// THEN aod interrupt is cancelled
|
||||
verify(mAuthController).onCancelUdfps();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFingerprintCancelAodInterrupt_onAuthenticationError() {
|
||||
// GIVEN on keyguard and listening for fingerprint authentication
|
||||
mKeyguardUpdateMonitor.dispatchStartedGoingToSleep(0 /* why */);
|
||||
mTestableLooper.processAllMessages();
|
||||
|
||||
ArgumentCaptor<FingerprintManager.AuthenticationCallback> fingerprintCallbackCaptor =
|
||||
ArgumentCaptor.forClass(FingerprintManager.AuthenticationCallback.class);
|
||||
verify(mFingerprintManager).authenticate(any(), any(), fingerprintCallbackCaptor.capture(),
|
||||
any(), anyInt(), anyInt());
|
||||
FingerprintManager.AuthenticationCallback authCallback =
|
||||
fingerprintCallbackCaptor.getValue();
|
||||
|
||||
// WHEN authentication errors
|
||||
authCallback.onAuthenticationError(0, "");
|
||||
|
||||
// THEN aod interrupt is cancelled
|
||||
verify(mAuthController).onCancelUdfps();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void skipsAuthentication_whenStatusBarShadeLocked() {
|
||||
mStatusBarStateListener.onStateChanged(StatusBarState.SHADE_LOCKED);
|
||||
@@ -1022,7 +979,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
||||
mBroadcastDispatcher, mDumpManager,
|
||||
mRingerModeTracker, mBackgroundExecutor,
|
||||
mStatusBarStateController, mLockPatternUtils,
|
||||
mAuthController, mTelephonyListenerManager, mPowerManager, mFeatureFlags);
|
||||
mAuthController, mTelephonyListenerManager, mFeatureFlags);
|
||||
setStrongAuthTracker(KeyguardUpdateMonitorTest.this.mStrongAuthTracker);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ public class DozeConfigurationUtil {
|
||||
when(config.dozePickupSensorAvailable()).thenReturn(false);
|
||||
when(config.wakeScreenGestureAvailable()).thenReturn(false);
|
||||
when(config.quickPickupSensorEnabled(anyInt())).thenReturn(false);
|
||||
when(config.screenOffUdfpsEnabled(anyInt())).thenReturn(false);
|
||||
|
||||
doneHolder[0] = true;
|
||||
return config;
|
||||
|
||||
Reference in New Issue
Block a user