diff options
11 files changed, 91 insertions, 18 deletions
diff --git a/core/java/android/app/servertransaction/ClientTransactionListenerController.java b/core/java/android/app/servertransaction/ClientTransactionListenerController.java index 1a8136e06c28..53cec08f5e80 100644 --- a/core/java/android/app/servertransaction/ClientTransactionListenerController.java +++ b/core/java/android/app/servertransaction/ClientTransactionListenerController.java @@ -23,9 +23,12 @@ import static java.util.Objects.requireNonNull; import android.annotation.NonNull; import android.app.ActivityThread; import android.hardware.display.DisplayManagerGlobal; +import android.util.Log; import com.android.internal.annotations.VisibleForTesting; +import java.util.concurrent.RejectedExecutionException; + /** * Singleton controller to manage listeners to individual {@link ClientTransaction}. * @@ -33,6 +36,8 @@ import com.android.internal.annotations.VisibleForTesting; */ public class ClientTransactionListenerController { + private static final String TAG = "ClientTransactionListenerController"; + private static ClientTransactionListenerController sController; private final DisplayManagerGlobal mDisplayManager; @@ -73,6 +78,10 @@ public class ClientTransactionListenerController { // Not enable for system server. return; } - mDisplayManager.handleDisplayChangeFromWindowManager(displayId); + try { + mDisplayManager.handleDisplayChangeFromWindowManager(displayId); + } catch (RejectedExecutionException e) { + Log.w(TAG, "Failed to notify DisplayListener because the Handler is shutting down"); + } } } diff --git a/core/java/android/window/flags/large_screen_experiences_app_compat.aconfig b/core/java/android/window/flags/large_screen_experiences_app_compat.aconfig index 453ff06591d8..0ef4fa392618 100644 --- a/core/java/android/window/flags/large_screen_experiences_app_compat.aconfig +++ b/core/java/android/window/flags/large_screen_experiences_app_compat.aconfig @@ -8,6 +8,16 @@ flag { } flag { + name: "disable_thin_letterboxing_policy" + namespace: "large_screen_experiences_app_compat" + description: "Whether reachability is disabled in case of thin letterboxing" + bug: "341027847" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "allows_screen_size_decoupled_from_status_bar_and_cutout" namespace: "large_screen_experiences_app_compat" description: "When necessary, configuration decoupled from status bar and display cutout" diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java index 8ac1de898be8..c33b7ce1d002 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java @@ -99,7 +99,7 @@ public class PipSurfaceTransactionHelper { final float startScale = sourceRectHint.width() <= sourceRectHint.height() ? (float) destinationBounds.width() / sourceBounds.width() : (float) destinationBounds.height() / sourceBounds.height(); - scale = (1 - progress) * startScale + progress * endScale; + scale = Math.min((1 - progress) * startScale + progress * endScale, 1.0f); } final float left = destinationBounds.left - (insets.left + sourceBounds.left) * scale; final float top = destinationBounds.top - (insets.top + sourceBounds.top) * scale; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 25d771308aea..dfdf5a2dd9e3 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -101,6 +101,8 @@ import com.android.systemui.util.ViewController; import com.android.systemui.util.kotlin.JavaAdapter; import com.android.systemui.util.settings.GlobalSettings; +import dagger.Lazy; + import java.io.File; import java.util.Arrays; import java.util.Optional; @@ -108,7 +110,6 @@ import java.util.Optional; import javax.inject.Inject; import javax.inject.Provider; -import dagger.Lazy; import kotlinx.coroutines.Job; /** Controller for {@link KeyguardSecurityContainer} */ @@ -589,6 +590,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard public void updateSideFpsVisibility(boolean isVisible) { SideFpsControllerRefactor.assertInLegacyMode(); if (!mSideFpsController.isPresent()) { + Log.d(TAG, "updateSideFpsVisibility(isVisible = " + isVisible + "): " + + "!mSideFpsController.isPresent(): ignoring request"); return; } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt index 19e6a86c6e2f..4674ac601634 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/SideFpsController.kt @@ -124,6 +124,7 @@ constructor( private var overlayView: View? = null set(value) { field?.let { oldView -> + Log.d(TAG, "overlayView updated: removing existing view $oldView") val lottie = oldView.requireViewById(R.id.sidefps_animation) as LottieAnimationView lottie.pauseAnimation() lottie.removeAllLottieOnCompositionLoadedListener() @@ -135,6 +136,7 @@ constructor( field = value field?.let { newView -> + Log.d(TAG, "overlayView updated: adding new view $newView") if (requests.contains(SideFpsUiRequestSource.PRIMARY_BOUNCER)) { newView.alpha = 0f overlayShowAnimator = @@ -223,11 +225,20 @@ constructor( traceSection( "SideFpsController#show(request=${request.name}, reason=$reason)" ) { + Log.d( + TAG, + "show(request=${request.name}, reason=$reason): " + + "overlayView == null, adding request" + ) requests.add(request) createOverlayForDisplay(reason) } } else { - Log.v(TAG, "overlay already shown") + Log.d( + TAG, + "show(request=${request.name}, reason=$reason): " + + "overlay already shown, ignoring request" + ) } } } @@ -236,10 +247,18 @@ constructor( /** Hides the fps overlay if shown. */ fun hide(request: SideFpsUiRequestSource) { SideFpsControllerRefactor.assertInLegacyMode() + Log.d(TAG, "hide(request=${request.name}): removing request") requests.remove(request) mainExecutor.execute { if (requests.isEmpty()) { - traceSection("SideFpsController#hide(${request.name})") { overlayView = null } + traceSection("SideFpsController#hide(${request.name})") { + Log.d( + TAG, + "hide(request=${request.name}): requests.isEmpty(), " + + "setting overlayView = null" + ) + overlayView = null + } } } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepository.kt b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepository.kt index 27bb023e3366..26e247f8167c 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/data/repository/BiometricStatusRepository.kt @@ -25,6 +25,7 @@ import android.hardware.biometrics.BiometricRequestConstants.REASON_AUTH_SETTING import android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_ENROLLING import android.hardware.biometrics.BiometricRequestConstants.REASON_ENROLL_FIND_SENSOR import android.hardware.biometrics.BiometricSourceType +import android.util.Log import com.android.systemui.biometrics.shared.model.AuthenticationReason import com.android.systemui.biometrics.shared.model.AuthenticationReason.SettingsOperations import com.android.systemui.biometrics.shared.model.AuthenticationState @@ -42,6 +43,7 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterIsInstance import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.shareIn /** A repository for the state of biometric authentication. */ @@ -67,6 +69,7 @@ constructor( private val authenticationState: Flow<AuthenticationState> = conflatedCallbackFlow { val updateAuthenticationState = { state: AuthenticationState -> + Log.d(TAG, "authenticationState updated: $state") trySendWithFailureLogging(state, TAG, "Error sending AuthenticationState state") } @@ -121,7 +124,9 @@ constructor( .shareIn(applicationScope, started = SharingStarted.Eagerly, replay = 1) override val fingerprintAuthenticationReason: Flow<AuthenticationReason> = - authenticationState.map { it.requestReason } + authenticationState + .map { it.requestReason } + .onEach { Log.d(TAG, "fingerprintAuthenticationReason updated: $it") } override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> = authenticationState diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractor.kt b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractor.kt index c4967ec0df21..90ad9da476a0 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/domain/interactor/BiometricStatusInteractor.kt @@ -17,6 +17,7 @@ package com.android.systemui.biometrics.domain.interactor import android.app.ActivityTaskManager +import android.util.Log import com.android.systemui.biometrics.data.repository.BiometricStatusRepository import com.android.systemui.biometrics.shared.model.AuthenticationReason import com.android.systemui.biometrics.shared.model.AuthenticationReason.SettingsOperations @@ -25,6 +26,7 @@ import javax.inject.Inject import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.map +import kotlinx.coroutines.flow.onEach /** Encapsulates business logic for interacting with biometric authentication state. */ interface BiometricStatusInteractor { @@ -46,14 +48,16 @@ constructor( ) : BiometricStatusInteractor { override val sfpsAuthenticationReason: Flow<AuthenticationReason> = - biometricStatusRepository.fingerprintAuthenticationReason.map { reason: AuthenticationReason - -> - if (reason.isReasonToAlwaysUpdateSfpsOverlay(activityTaskManager)) { - reason - } else { - AuthenticationReason.NotRunning + biometricStatusRepository.fingerprintAuthenticationReason + .map { reason: AuthenticationReason -> + if (reason.isReasonToAlwaysUpdateSfpsOverlay(activityTaskManager)) { + reason + } else { + AuthenticationReason.NotRunning + } } - }.distinctUntilChanged() + .distinctUntilChanged() + .onEach { Log.d(TAG, "sfpsAuthenticationReason updated: $it") } override val fingerprintAcquiredStatus: Flow<FingerprintAuthenticationStatus> = biometricStatusRepository.fingerprintAcquiredStatus diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt index 9c28f1c16546..9d5505b4b105 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/ui/binder/SideFpsOverlayViewBinder.kt @@ -20,6 +20,7 @@ package com.android.systemui.biometrics.ui.binder import android.content.Context import android.graphics.PorterDuff import android.graphics.PorterDuffColorFilter +import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.WindowManager @@ -96,6 +97,13 @@ constructor( showIndicatorForDeviceEntry, progressBarIsVisible) = combinedFlows + Log.d( + TAG, + "systemServerAuthReason = $systemServerAuthReason, " + + "showIndicatorForDeviceEntry = " + + "$showIndicatorForDeviceEntry, " + + "progressBarIsVisible = $progressBarIsVisible" + ) if (!isInRearDisplayMode) { if (progressBarIsVisible) { hide() @@ -119,6 +127,10 @@ constructor( /** Show the side fingerprint sensor indicator */ private fun show() { if (overlayView?.isAttachedToWindow == true) { + Log.d( + TAG, + "show(): overlayView $overlayView isAttachedToWindow already, ignoring show request" + ) return } @@ -135,12 +147,17 @@ constructor( ) bind(overlayView!!, overlayViewModel, fpsUnlockTracker.get(), windowManager.get()) overlayView!!.visibility = View.INVISIBLE + Log.d(TAG, "show(): adding overlayView $overlayView") windowManager.get().addView(overlayView, overlayViewModel.defaultOverlayViewParams) } /** Hide the side fingerprint sensor indicator */ private fun hide() { if (overlayView != null) { + val lottie = overlayView!!.requireViewById<LottieAnimationView>(R.id.sidefps_animation) + lottie.pauseAnimation() + lottie.removeAllLottieOnCompositionLoadedListener() + Log.d(TAG, "hide(): removing overlayView $overlayView, setting to null") windowManager.get().removeView(overlayView) overlayView = null } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt index e017129bd5c5..6883be9cdb46 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/DeviceEntrySideFpsOverlayInteractor.kt @@ -17,6 +17,7 @@ package com.android.systemui.keyguard.domain.interactor import android.content.Context +import android.util.Log import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor @@ -35,6 +36,7 @@ import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.merge +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch /** @@ -73,9 +75,12 @@ constructor( deviceEntryFingerprintAuthRepository.shouldUpdateIndicatorVisibility.filter { it } ) .map { shouldShowIndicatorForPrimaryBouncer() } + .onEach { Log.d(TAG, "showIndicatorForPrimaryBouncer updated: $it") } private val showIndicatorForAlternateBouncer: Flow<Boolean> = - alternateBouncerInteractor.isVisible + alternateBouncerInteractor.isVisible.onEach { + Log.d(TAG, "showIndicatorForAlternateBouncer updated: $it") + } /** * Indicates whether the primary or alternate bouncers request showing the side fingerprint @@ -88,6 +93,7 @@ constructor( showForPrimaryBouncer || showForAlternateBouncer } .distinctUntilChanged() + .onEach { Log.d(TAG, "showIndicatorForDeviceEntry updated: $it") } private fun shouldShowIndicatorForPrimaryBouncer(): Boolean { val sfpsEnabled: Boolean = diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java index eea8b6a76d08..18225285a4a8 100644 --- a/services/core/java/com/android/server/wm/LetterboxUiController.java +++ b/services/core/java/com/android/server/wm/LetterboxUiController.java @@ -1049,7 +1049,7 @@ final class LetterboxUiController { * thin letteboxing */ boolean allowVerticalReachabilityForThinLetterbox() { - if (!Flags.disableThinLetterboxingReachability()) { + if (!Flags.disableThinLetterboxingPolicy()) { return true; } // When the flag is enabled we allow vertical reachability only if the @@ -1062,7 +1062,7 @@ final class LetterboxUiController { * thin letteboxing */ boolean allowHorizontalReachabilityForThinLetterbox() { - if (!Flags.disableThinLetterboxingReachability()) { + if (!Flags.disableThinLetterboxingPolicy()) { return true; } // When the flag is enabled we allow horizontal reachability only if the diff --git a/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java b/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java index ed205a5a3ffb..f559de8838a6 100644 --- a/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/LetterboxUiControllerTest.java @@ -1553,7 +1553,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase { } @Test - @EnableFlags(Flags.FLAG_DISABLE_THIN_LETTERBOXING_REACHABILITY) + @EnableFlags(Flags.FLAG_DISABLE_THIN_LETTERBOXING_POLICY) public void testAllowReachabilityForThinLetterboxWithFlagEnabled() { spyOn(mController); doReturn(true).when(mController).isVerticalThinLetterboxed(); @@ -1568,7 +1568,7 @@ public class LetterboxUiControllerTest extends WindowTestsBase { } @Test - @DisableFlags(Flags.FLAG_DISABLE_THIN_LETTERBOXING_REACHABILITY) + @DisableFlags(Flags.FLAG_DISABLE_THIN_LETTERBOXING_POLICY) public void testAllowReachabilityForThinLetterboxWithFlagDisabled() { spyOn(mController); doReturn(true).when(mController).isVerticalThinLetterboxed(); |