diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java index 8690b36c12d7d..b92715516a75a 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/PreviewPositionHelper.java @@ -62,7 +62,7 @@ public class PreviewPositionHelper { */ public void updateThumbnailMatrix(Rect thumbnailBounds, ThumbnailData thumbnailData, int canvasWidth, int canvasHeight, int screenWidthPx, int screenHeightPx, - int taskbarSize, boolean isLargeScreen, + int taskbarSize, boolean isTablet, int currentRotation, boolean isRtl) { boolean isRotated = false; boolean isOrientationDifferent; @@ -95,7 +95,7 @@ public class PreviewPositionHelper { canvasScreenRatio = (float) canvasWidth / screenWidthPx; } scaledTaskbarSize = taskbarSize * canvasScreenRatio; - thumbnailClipHint.bottom = isLargeScreen ? scaledTaskbarSize : 0; + thumbnailClipHint.bottom = isTablet ? scaledTaskbarSize : 0; float scale = thumbnailData.scale; final float thumbnailScale; @@ -103,7 +103,7 @@ public class PreviewPositionHelper { // Landscape vs portrait change. // Note: Disable rotation in grid layout. boolean windowingModeSupportsRotation = - thumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN && !isLargeScreen; + thumbnailData.windowingMode == WINDOWING_MODE_FULLSCREEN && !isTablet; isOrientationDifferent = isOrientationChange(deltaRotate) && windowingModeSupportsRotation; if (canvasWidth == 0 || canvasHeight == 0 || scale == 0) { diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java index 751a3f8458bd7..77a13bd91b907 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/utilities/Utilities.java @@ -137,7 +137,7 @@ 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) { + public static boolean isTablet(Context context) { final WindowManager windowManager = context.getSystemService(WindowManager.class); final Rect bounds = windowManager.getCurrentWindowMetrics().getBounds(); diff --git a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java index 98a3e4b552569..cef415c8a490f 100644 --- a/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java +++ b/packages/SystemUI/src/com/android/systemui/charging/WirelessChargingLayout.java @@ -130,8 +130,7 @@ final class WirelessChargingLayout extends FrameLayout { animatorSet.playTogether(textSizeAnimator, textOpacityAnimator, textFadeAnimator); // For tablet docking animation, we don't play the background scrim. - // TODO(b/270524780): use utility to check for tablet instead. - if (!Utilities.isLargeScreen(context)) { + if (!Utilities.isTablet(context)) { ValueAnimator scrimFadeInAnimator = ObjectAnimator.ofArgb(this, "backgroundColor", Color.TRANSPARENT, SCRIM_COLOR); scrimFadeInAnimator.setDuration(SCRIM_FADE_DURATION); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt index 8ae171f9264fb..f964cb39a8d49 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardUnlockAnimationController.kt @@ -950,9 +950,9 @@ class KeyguardUnlockAnimationController @Inject constructor( return false } - // 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)) { + // We don't do the shared element on tablets because they're large and the smartspace has to + // fly across large distances, which is distracting. + if (Utilities.isTablet(context)) { return false } diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt index 9b9d561b5180b..d4991f90a86b5 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/MediaProjectionTaskView.kt @@ -33,7 +33,7 @@ import com.android.systemui.R import com.android.systemui.mediaprojection.appselector.data.RecentTask import com.android.systemui.shared.recents.model.ThumbnailData import com.android.systemui.shared.recents.utilities.PreviewPositionHelper -import com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen +import com.android.systemui.shared.recents.utilities.Utilities.isTablet /** * Custom view that shows a thumbnail preview of one recent task based on [ThumbnailData]. @@ -150,9 +150,9 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 val displayWidthPx = windowMetrics.bounds.width() val displayHeightPx = windowMetrics.bounds.height() val isRtl = layoutDirection == LAYOUT_DIRECTION_RTL - val isLargeScreen = isLargeScreen(context) + val isTablet = isTablet(context) val taskbarSize = - if (isLargeScreen) { + if (isTablet) { resources.getDimensionPixelSize(AndroidR.dimen.taskbar_frame_height) } else { 0 @@ -166,7 +166,7 @@ constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 displayWidthPx, displayHeightPx, taskbarSize, - isLargeScreen, + isTablet, currentRotation, isRtl ) diff --git a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProvider.kt b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProvider.kt index 1c901540ed392..88d5eaaff2165 100644 --- a/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProvider.kt +++ b/packages/SystemUI/src/com/android/systemui/mediaprojection/appselector/view/TaskPreviewSizeProvider.kt @@ -23,7 +23,7 @@ import android.view.WindowManager import com.android.internal.R as AndroidR import com.android.systemui.mediaprojection.appselector.MediaProjectionAppSelectorScope import com.android.systemui.mediaprojection.appselector.view.TaskPreviewSizeProvider.TaskPreviewSizeListener -import com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen +import com.android.systemui.shared.recents.utilities.Utilities.isTablet import com.android.systemui.statusbar.policy.CallbackController import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener @@ -61,8 +61,8 @@ constructor( val width = windowMetrics.bounds.width() var height = maximumWindowHeight - val isLargeScreen = isLargeScreen(context) - if (isLargeScreen) { + val isTablet = isTablet(context) + if (isTablet) { val taskbarSize = context.resources.getDimensionPixelSize(AndroidR.dimen.taskbar_frame_height) height -= taskbarSize diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java index f81743928e3bd..97c290d3e1f0c 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBar.java @@ -37,7 +37,7 @@ import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSE import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.HOME_BUTTON_LONG_PRESS_DURATION_MS; import static com.android.systemui.navigationbar.NavBarHelper.transitionMode; import static com.android.systemui.recents.OverviewProxyService.OverviewProxyListener; -import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen; +import static com.android.systemui.shared.recents.utilities.Utilities.isTablet; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ALLOW_GESTURE_IGNORING_BAR_VISIBILITY; @@ -1724,7 +1724,7 @@ public class NavigationBar extends ViewController implements private void setNavigationIconHints(int hints) { if (hints == mNavigationIconHints) return; - if (!isLargeScreen(mContext)) { + if (!isTablet(mContext)) { // All IME functions handled by launcher via Sysui flags for large screen final boolean newBackAlt = (hints & StatusBarManager.NAVIGATION_HINT_BACK_ALT) != 0; final boolean oldBackAlt = diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java index 153d5a651f9ca..8c19111cab246 100644 --- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java +++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java @@ -21,7 +21,7 @@ import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR; import static com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler.DEBUG_MISSING_GESTURE_TAG; -import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen; +import static com.android.systemui.shared.recents.utilities.Utilities.isTablet; import android.content.Context; import android.content.pm.ActivityInfo; @@ -91,7 +91,7 @@ public class NavigationBarController implements private final DisplayManager mDisplayManager; private final TaskbarDelegate mTaskbarDelegate; private int mNavMode; - @VisibleForTesting boolean mIsLargeScreen; + @VisibleForTesting boolean mIsTablet; /** A displayId - nav bar maps. */ @VisibleForTesting @@ -138,16 +138,16 @@ public class NavigationBarController implements navBarHelper, navigationModeController, sysUiFlagsContainer, dumpManager, autoHideController, lightBarController, pipOptional, backAnimation.orElse(null), taskStackChangeListeners); - mIsLargeScreen = isLargeScreen(mContext); + mIsTablet = isTablet(mContext); dumpManager.registerDumpable(this); } @Override public void onConfigChanged(Configuration newConfig) { - boolean isOldConfigLargeScreen = mIsLargeScreen; - mIsLargeScreen = isLargeScreen(mContext); + boolean isOldConfigTablet = mIsTablet; + mIsTablet = isTablet(mContext); boolean willApplyConfig = mConfigChanges.applyNewConfig(mContext.getResources()); - boolean largeScreenChanged = mIsLargeScreen != isOldConfigLargeScreen; + boolean largeScreenChanged = mIsTablet != isOldConfigTablet; // TODO(b/243765256): Disable this logging once b/243765256 is fixed. Log.i(DEBUG_MISSING_GESTURE_TAG, "NavbarController: newConfig=" + newConfig + " mTaskbarDelegate initialized=" + mTaskbarDelegate.isInitialized() @@ -235,9 +235,8 @@ public class NavigationBarController implements /** @return {@code true} if taskbar is enabled, false otherwise */ private boolean initializeTaskbarIfNecessary() { - // Enable for large screens or (phone AND flag is set); assuming phone = !mIsLargeScreen - boolean taskbarEnabled = mIsLargeScreen || mFeatureFlags.isEnabled( - Flags.HIDE_NAVBAR_WINDOW); + // Enable for tablet or (phone AND flag is set); assuming phone = !mIsTablet + boolean taskbarEnabled = mIsTablet || mFeatureFlags.isEnabled(Flags.HIDE_NAVBAR_WINDOW); if (taskbarEnabled) { Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary"); @@ -259,7 +258,7 @@ public class NavigationBarController implements @Override public void onDisplayReady(int displayId) { Display display = mDisplayManager.getDisplay(displayId); - mIsLargeScreen = isLargeScreen(mContext); + mIsTablet = isTablet(mContext); createNavigationBar(display, null /* savedState */, null /* result */); } @@ -471,7 +470,7 @@ public class NavigationBarController implements @Override public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { - pw.println("mIsLargeScreen=" + mIsLargeScreen); + pw.println("mIsTablet=" + mIsTablet); pw.println("mNavMode=" + mNavMode); for (int i = 0; i < mNavigationBars.size(); i++) { if (i > 0) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java index 346acf958e51d..645b1256e5f16 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +++ b/packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java @@ -16,7 +16,7 @@ package com.android.systemui.recents; -import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen; +import static com.android.systemui.shared.recents.utilities.Utilities.isTablet; import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE; @@ -265,7 +265,7 @@ public class ScreenPinningRequest implements View.OnClickListener, .setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); View buttons = mLayout.findViewById(R.id.screen_pinning_buttons); if (!QuickStepContract.isGesturalMode(mNavBarMode) - && hasSoftNavigationBar(mContext.getDisplayId()) && !isLargeScreen(mContext)) { + && hasSoftNavigationBar(mContext.getDisplayId()) && !isTablet(mContext)) { buttons.setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); swapChildrenIfRtlAndVertical(buttons); } else { diff --git a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java index 0a91a0ed0532c..aacbf8f2adebe 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/navigationbar/NavigationBarControllerTest.java @@ -143,8 +143,8 @@ public class NavigationBarControllerTest extends SysuiTestCase { @Test public void testCreateNavigationBarsIncludeDefaultTrue() { - // Large screens may be using taskbar and the logic is different - mNavigationBarController.mIsLargeScreen = false; + // Tablets may be using taskbar and the logic is different + mNavigationBarController.mIsTablet = false; doNothing().when(mNavigationBarController).createNavigationBar(any(), any(), any()); mNavigationBarController.createNavigationBars(true, null); @@ -292,7 +292,7 @@ public class NavigationBarControllerTest extends SysuiTestCase { @Test public void testConfigurationChange_taskbarNotInitialized() { Configuration configuration = mContext.getResources().getConfiguration(); - when(Utilities.isLargeScreen(any())).thenReturn(true); + when(Utilities.isTablet(any())).thenReturn(true); mNavigationBarController.onConfigChanged(configuration); verify(mTaskbarDelegate, never()).onConfigurationChanged(configuration); } @@ -300,7 +300,7 @@ public class NavigationBarControllerTest extends SysuiTestCase { @Test public void testConfigurationChange_taskbarInitialized() { Configuration configuration = mContext.getResources().getConfiguration(); - when(Utilities.isLargeScreen(any())).thenReturn(true); + when(Utilities.isTablet(any())).thenReturn(true); when(mTaskbarDelegate.isInitialized()).thenReturn(true); mNavigationBarController.onConfigChanged(configuration); verify(mTaskbarDelegate, times(1)).onConfigurationChanged(configuration);