Loading packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java +7 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; import android.inputmethodservice.InputMethodService; Loading Loading @@ -138,11 +139,15 @@ public class Utilities { /** @return whether or not {@param context} represents that of a large screen device or not */ @TargetApi(Build.VERSION_CODES.R) public static boolean isLargeScreen(Context context) { final WindowManager windowManager = context.getSystemService(WindowManager.class); return isLargeScreen(context.getSystemService(WindowManager.class), context.getResources()); } /** @return whether or not {@param context} represents that of a large screen device or not */ public static boolean isLargeScreen(WindowManager windowManager, Resources resources) { final Rect bounds = windowManager.getCurrentWindowMetrics().getBounds(); float smallestWidth = dpiFromPx(Math.min(bounds.width(), bounds.height()), context.getResources().getConfiguration().densityDpi); resources.getConfiguration().densityDpi); return smallestWidth >= TABLET_MIN_DPS; } Loading packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +20 −17 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.app.WallpaperManager import android.content.Context import android.content.res.Resources import android.graphics.Matrix import android.graphics.Rect import android.os.DeadObjectException Loading @@ -32,16 +32,18 @@ import android.view.RemoteAnimationTarget import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.WindowManager import androidx.annotation.VisibleForTesting import androidx.core.math.MathUtils import com.android.app.animation.Interpolators import com.android.internal.R import com.android.keyguard.KeyguardClockSwitchController import com.android.keyguard.KeyguardViewController import com.android.systemui.Flags.fastUnlockTransition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.Flags.fastUnlockTransition import com.android.systemui.plugins.BcSmartspaceDataPlugin import com.android.systemui.shared.recents.utilities.Utilities import com.android.systemui.shared.system.ActivityManagerWrapper Loading Loading @@ -145,7 +147,8 @@ const val SURFACE_BEHIND_FADE_OUT_START_DELAY_MS = 0L */ @SysUISingleton class KeyguardUnlockAnimationController @Inject constructor( private val context: Context, private val windowManager: WindowManager, @Main private val resources: Resources, private val keyguardStateController: KeyguardStateController, private val keyguardViewMediator: Lazy<KeyguardViewMediator>, Loading Loading @@ -399,7 +402,7 @@ class KeyguardUnlockAnimationController @Inject constructor( keyguardStateController.addCallback(this) roundedCornerRadius = context.resources.getDimensionPixelSize(R.dimen.rounded_corner_radius).toFloat() resources.getDimensionPixelSize(R.dimen.rounded_corner_radius).toFloat() } /** Loading Loading @@ -438,7 +441,7 @@ class KeyguardUnlockAnimationController @Inject constructor( Log.wtf(TAG, " !notificationShadeWindowController.isLaunchingActivity: " + "${!notificationShadeWindowController.isLaunchingActivity}") Log.wtf(TAG, " launcherUnlockController != null: ${launcherUnlockController != null}") Log.wtf(TAG, " !isFoldable(context): ${!isFoldable(context)}") Log.wtf(TAG, " !isFoldable(context): ${!isFoldable(resources)}") } /** Loading Loading @@ -1100,7 +1103,7 @@ class KeyguardUnlockAnimationController @Inject constructor( // We don't do the shared element on large screens because the smartspace has to fly across // large distances, which is distracting. if (Utilities.isLargeScreen(context)) { if (Utilities.isLargeScreen(windowManager, resources)) { return false } Loading Loading @@ -1180,8 +1183,8 @@ class KeyguardUnlockAnimationController @Inject constructor( companion object { fun isFoldable(context: Context): Boolean { return context.resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty() fun isFoldable(resources: Resources): Boolean { return resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty() } } } packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +5 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.ViewRootImpl import android.view.WindowManager import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardViewController import com.android.systemui.Flags Loading Loading @@ -51,6 +52,8 @@ import java.util.function.Predicate class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { private lateinit var keyguardUnlockAnimationController: KeyguardUnlockAnimationController @Mock private lateinit var windowManager: WindowManager @Mock private lateinit var keyguardViewMediator: KeyguardViewMediator @Mock Loading Loading @@ -99,7 +102,8 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) keyguardUnlockAnimationController = KeyguardUnlockAnimationController( context, keyguardStateController, { keyguardViewMediator }, keyguardViewController, windowManager, context.resources, keyguardStateController, { keyguardViewMediator }, keyguardViewController, featureFlags, { biometricUnlockController }, statusBarStateController, notificationShadeWindowController, powerManager, wallpaperManager ) Loading Loading
packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java +7 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.app.StatusBarManager.NAVIGATION_HINT_IME_SWITCHER_SHOWN; import android.annotation.TargetApi; import android.content.Context; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Rect; import android.inputmethodservice.InputMethodService; Loading Loading @@ -138,11 +139,15 @@ public class Utilities { /** @return whether or not {@param context} represents that of a large screen device or not */ @TargetApi(Build.VERSION_CODES.R) public static boolean isLargeScreen(Context context) { final WindowManager windowManager = context.getSystemService(WindowManager.class); return isLargeScreen(context.getSystemService(WindowManager.class), context.getResources()); } /** @return whether or not {@param context} represents that of a large screen device or not */ public static boolean isLargeScreen(WindowManager windowManager, Resources resources) { final Rect bounds = windowManager.getCurrentWindowMetrics().getBounds(); float smallestWidth = dpiFromPx(Math.min(bounds.width(), bounds.height()), context.getResources().getConfiguration().densityDpi); resources.getConfiguration().densityDpi); return smallestWidth >= TABLET_MIN_DPS; } Loading
packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +20 −17 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ import android.animation.Animator import android.animation.AnimatorListenerAdapter import android.animation.ValueAnimator import android.app.WallpaperManager import android.content.Context import android.content.res.Resources import android.graphics.Matrix import android.graphics.Rect import android.os.DeadObjectException Loading @@ -32,16 +32,18 @@ import android.view.RemoteAnimationTarget import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.WindowManager import androidx.annotation.VisibleForTesting import androidx.core.math.MathUtils import com.android.app.animation.Interpolators import com.android.internal.R import com.android.keyguard.KeyguardClockSwitchController import com.android.keyguard.KeyguardViewController import com.android.systemui.Flags.fastUnlockTransition import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.Flags.fastUnlockTransition import com.android.systemui.plugins.BcSmartspaceDataPlugin import com.android.systemui.shared.recents.utilities.Utilities import com.android.systemui.shared.system.ActivityManagerWrapper Loading Loading @@ -145,7 +147,8 @@ const val SURFACE_BEHIND_FADE_OUT_START_DELAY_MS = 0L */ @SysUISingleton class KeyguardUnlockAnimationController @Inject constructor( private val context: Context, private val windowManager: WindowManager, @Main private val resources: Resources, private val keyguardStateController: KeyguardStateController, private val keyguardViewMediator: Lazy<KeyguardViewMediator>, Loading Loading @@ -399,7 +402,7 @@ class KeyguardUnlockAnimationController @Inject constructor( keyguardStateController.addCallback(this) roundedCornerRadius = context.resources.getDimensionPixelSize(R.dimen.rounded_corner_radius).toFloat() resources.getDimensionPixelSize(R.dimen.rounded_corner_radius).toFloat() } /** Loading Loading @@ -438,7 +441,7 @@ class KeyguardUnlockAnimationController @Inject constructor( Log.wtf(TAG, " !notificationShadeWindowController.isLaunchingActivity: " + "${!notificationShadeWindowController.isLaunchingActivity}") Log.wtf(TAG, " launcherUnlockController != null: ${launcherUnlockController != null}") Log.wtf(TAG, " !isFoldable(context): ${!isFoldable(context)}") Log.wtf(TAG, " !isFoldable(context): ${!isFoldable(resources)}") } /** Loading Loading @@ -1100,7 +1103,7 @@ class KeyguardUnlockAnimationController @Inject constructor( // We don't do the shared element on large screens because the smartspace has to fly across // large distances, which is distracting. if (Utilities.isLargeScreen(context)) { if (Utilities.isLargeScreen(windowManager, resources)) { return false } Loading Loading @@ -1180,8 +1183,8 @@ class KeyguardUnlockAnimationController @Inject constructor( companion object { fun isFoldable(context: Context): Boolean { return context.resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty() fun isFoldable(resources: Resources): Boolean { return resources.getIntArray(R.array.config_foldedDeviceStates).isNotEmpty() } } }
packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt +5 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ import android.view.SurfaceControl import android.view.SyncRtSurfaceTransactionApplier import android.view.View import android.view.ViewRootImpl import android.view.WindowManager import androidx.test.filters.SmallTest import com.android.keyguard.KeyguardViewController import com.android.systemui.Flags Loading Loading @@ -51,6 +52,8 @@ import java.util.function.Predicate class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { private lateinit var keyguardUnlockAnimationController: KeyguardUnlockAnimationController @Mock private lateinit var windowManager: WindowManager @Mock private lateinit var keyguardViewMediator: KeyguardViewMediator @Mock Loading Loading @@ -99,7 +102,8 @@ class KeyguardUnlockAnimationControllerTest : SysuiTestCase() { fun setUp() { MockitoAnnotations.initMocks(this) keyguardUnlockAnimationController = KeyguardUnlockAnimationController( context, keyguardStateController, { keyguardViewMediator }, keyguardViewController, windowManager, context.resources, keyguardStateController, { keyguardViewMediator }, keyguardViewController, featureFlags, { biometricUnlockController }, statusBarStateController, notificationShadeWindowController, powerManager, wallpaperManager ) Loading