Loading core/java/android/hardware/biometrics/IBiometricContextListener.aidl +0 −5 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ package android.hardware.biometrics; * @hide */ oneway interface IBiometricContextListener { // Called when aod or awake (screen on) status changes. // These may be called while the device is still transitioning to the new state // (i.e. about to become awake or enter doze) void onDozeChanged(boolean isAod, boolean isAwake); @VintfStability @Backing(type="int") enum FoldState { Loading packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractor.kt +0 −6 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map Loading Loading @@ -147,11 +146,6 @@ constructor( override fun addBiometricContextListener(listener: IBiometricContextListener): Job { return applicationScope.launch { combine(isAod, isAwake) { doze, awake -> doze to awake } .onEach { (aod, awake) -> listener.onDozeChanged(aod, awake) } .catch { t -> Log.w(TAG, "failed to notify new doze state", t) } .launchIn(this) foldState .onEach { state -> listener.onFoldChanged(state) } .catch { t -> Log.w(TAG, "failed to notify new fold state", t) } Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt +0 −13 Original line number Diff line number Diff line Loading @@ -191,18 +191,11 @@ class LogContextInteractorImplTest : SysuiTestCase() { foldListener.onFoldUpdate(FOLD_UPDATE_FINISH_CLOSED) keyguardTransitionRepository.startTransitionTo(KeyguardState.AOD) var aod: Boolean? = null var awake: Boolean? = null var folded: Int? = null var displayState: Int? = null val job = interactor.addBiometricContextListener( object : IBiometricContextListener.Stub() { override fun onDozeChanged(isAod: Boolean, isAwake: Boolean) { aod = isAod awake = isAwake } override fun onFoldChanged(foldState: Int) { folded = foldState } Loading @@ -214,8 +207,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { ) runCurrent() assertThat(aod).isTrue() assertThat(awake).isFalse() assertThat(folded).isEqualTo(FoldState.FULLY_CLOSED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_AOD) Loading @@ -224,8 +215,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { keyguardTransitionRepository.startTransitionTo(KeyguardState.LOCKSCREEN) runCurrent() assertThat(aod).isFalse() assertThat(awake).isTrue() assertThat(folded).isEqualTo(FoldState.HALF_OPENED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN) Loading @@ -236,8 +225,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { keyguardTransitionRepository.startTransitionTo(KeyguardState.AOD) runCurrent() assertThat(aod).isFalse() assertThat(awake).isTrue() assertThat(folded).isEqualTo(FoldState.HALF_OPENED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN) } Loading services/core/java/com/android/server/biometrics/log/BiometricContext.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.hardware.biometrics.AuthenticateOptions; import android.hardware.biometrics.IBiometricContextListener; import android.hardware.biometrics.common.OperationContext; import android.view.Surface; Loading Loading @@ -65,6 +66,7 @@ public interface BiometricContext { * Current fold state from * {@link android.hardware.biometrics.IBiometricContextListener.FoldState}. */ @IBiometricContextListener.FoldState int getFoldState(); /** Current device display rotation. */ Loading services/core/java/com/android/server/biometrics/log/BiometricContextProvider.java +9 −15 Original line number Diff line number Diff line Loading @@ -84,8 +84,6 @@ public final class BiometricContextProvider implements BiometricContext { private final AuthSessionCoordinator mAuthSessionCoordinator; private final WindowManager mWindowManager; @Nullable private final Handler mHandler; private boolean mIsAod = false; private boolean mIsAwake = false; private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED; private int mFoldState = IBiometricContextListener.FoldState.UNKNOWN; Loading Loading @@ -116,16 +114,6 @@ public final class BiometricContextProvider implements BiometricContext { private void subscribeBiometricContextListener(@NonNull IStatusBarService service) { try { service.setBiometicContextListener(new IBiometricContextListener.Stub() { @Override public void onDozeChanged(boolean isAod, boolean isAwake) { final boolean changed = (mIsAod != isAod) || (mIsAwake != isAwake); if (changed) { mIsAod = isAod; mIsAwake = isAwake; notifyChanged(); } } @Override public void onFoldChanged(int foldState) { mFoldState = foldState; Loading Loading @@ -185,12 +173,18 @@ public final class BiometricContextProvider implements BiometricContext { @Override public boolean isAod() { return mIsAod; return mDisplayState == AuthenticateOptions.DISPLAY_STATE_AOD; } @Override public boolean isAwake() { return mIsAwake; switch (mDisplayState) { case AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN: case AuthenticateOptions.DISPLAY_STATE_SCREENSAVER: case AuthenticateOptions.DISPLAY_STATE_UNKNOWN: return true; } return false; } @Override Loading Loading @@ -252,7 +246,7 @@ public final class BiometricContextProvider implements BiometricContext { public String toString() { return "[keyguard session: " + getKeyguardEntrySessionInfo() + ", " + "bp session: " + getBiometricPromptSessionInfo() + ", " + "isAod: " + isAod() + ", " + "displayState: " + getDisplayState() + ", " + "isAwake: " + isAwake() + ", " + "isDisplayOn: " + isDisplayOn() + ", " + "dock: " + getDockedState() + ", " Loading Loading
core/java/android/hardware/biometrics/IBiometricContextListener.aidl +0 −5 Original line number Diff line number Diff line Loading @@ -23,11 +23,6 @@ package android.hardware.biometrics; * @hide */ oneway interface IBiometricContextListener { // Called when aod or awake (screen on) status changes. // These may be called while the device is still transitioning to the new state // (i.e. about to become awake or enter doze) void onDozeChanged(boolean isAod, boolean isAwake); @VintfStability @Backing(type="int") enum FoldState { Loading
packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractor.kt +0 −6 Original line number Diff line number Diff line Loading @@ -38,7 +38,6 @@ import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map Loading Loading @@ -147,11 +146,6 @@ constructor( override fun addBiometricContextListener(listener: IBiometricContextListener): Job { return applicationScope.launch { combine(isAod, isAwake) { doze, awake -> doze to awake } .onEach { (aod, awake) -> listener.onDozeChanged(aod, awake) } .catch { t -> Log.w(TAG, "failed to notify new doze state", t) } .launchIn(this) foldState .onEach { state -> listener.onFoldChanged(state) } .catch { t -> Log.w(TAG, "failed to notify new fold state", t) } Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/domain/interactor/LogContextInteractorImplTest.kt +0 −13 Original line number Diff line number Diff line Loading @@ -191,18 +191,11 @@ class LogContextInteractorImplTest : SysuiTestCase() { foldListener.onFoldUpdate(FOLD_UPDATE_FINISH_CLOSED) keyguardTransitionRepository.startTransitionTo(KeyguardState.AOD) var aod: Boolean? = null var awake: Boolean? = null var folded: Int? = null var displayState: Int? = null val job = interactor.addBiometricContextListener( object : IBiometricContextListener.Stub() { override fun onDozeChanged(isAod: Boolean, isAwake: Boolean) { aod = isAod awake = isAwake } override fun onFoldChanged(foldState: Int) { folded = foldState } Loading @@ -214,8 +207,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { ) runCurrent() assertThat(aod).isTrue() assertThat(awake).isFalse() assertThat(folded).isEqualTo(FoldState.FULLY_CLOSED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_AOD) Loading @@ -224,8 +215,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { keyguardTransitionRepository.startTransitionTo(KeyguardState.LOCKSCREEN) runCurrent() assertThat(aod).isFalse() assertThat(awake).isTrue() assertThat(folded).isEqualTo(FoldState.HALF_OPENED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN) Loading @@ -236,8 +225,6 @@ class LogContextInteractorImplTest : SysuiTestCase() { keyguardTransitionRepository.startTransitionTo(KeyguardState.AOD) runCurrent() assertThat(aod).isFalse() assertThat(awake).isTrue() assertThat(folded).isEqualTo(FoldState.HALF_OPENED) assertThat(displayState).isEqualTo(AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN) } Loading
services/core/java/com/android/server/biometrics/log/BiometricContext.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.content.Context; import android.hardware.biometrics.AuthenticateOptions; import android.hardware.biometrics.IBiometricContextListener; import android.hardware.biometrics.common.OperationContext; import android.view.Surface; Loading Loading @@ -65,6 +66,7 @@ public interface BiometricContext { * Current fold state from * {@link android.hardware.biometrics.IBiometricContextListener.FoldState}. */ @IBiometricContextListener.FoldState int getFoldState(); /** Current device display rotation. */ Loading
services/core/java/com/android/server/biometrics/log/BiometricContextProvider.java +9 −15 Original line number Diff line number Diff line Loading @@ -84,8 +84,6 @@ public final class BiometricContextProvider implements BiometricContext { private final AuthSessionCoordinator mAuthSessionCoordinator; private final WindowManager mWindowManager; @Nullable private final Handler mHandler; private boolean mIsAod = false; private boolean mIsAwake = false; private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED; private int mFoldState = IBiometricContextListener.FoldState.UNKNOWN; Loading Loading @@ -116,16 +114,6 @@ public final class BiometricContextProvider implements BiometricContext { private void subscribeBiometricContextListener(@NonNull IStatusBarService service) { try { service.setBiometicContextListener(new IBiometricContextListener.Stub() { @Override public void onDozeChanged(boolean isAod, boolean isAwake) { final boolean changed = (mIsAod != isAod) || (mIsAwake != isAwake); if (changed) { mIsAod = isAod; mIsAwake = isAwake; notifyChanged(); } } @Override public void onFoldChanged(int foldState) { mFoldState = foldState; Loading Loading @@ -185,12 +173,18 @@ public final class BiometricContextProvider implements BiometricContext { @Override public boolean isAod() { return mIsAod; return mDisplayState == AuthenticateOptions.DISPLAY_STATE_AOD; } @Override public boolean isAwake() { return mIsAwake; switch (mDisplayState) { case AuthenticateOptions.DISPLAY_STATE_LOCKSCREEN: case AuthenticateOptions.DISPLAY_STATE_SCREENSAVER: case AuthenticateOptions.DISPLAY_STATE_UNKNOWN: return true; } return false; } @Override Loading Loading @@ -252,7 +246,7 @@ public final class BiometricContextProvider implements BiometricContext { public String toString() { return "[keyguard session: " + getKeyguardEntrySessionInfo() + ", " + "bp session: " + getBiometricPromptSessionInfo() + ", " + "isAod: " + isAod() + ", " + "displayState: " + getDisplayState() + ", " + "isAwake: " + isAwake() + ", " + "isDisplayOn: " + isDisplayOn() + ", " + "dock: " + getDockedState() + ", " Loading