Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java +25 −16 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ public class DesktopModeStatus { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } /** * Return {@code true} if desktop mode dev option should be shown on current device */ Loading @@ -239,12 +240,12 @@ public class DesktopModeStatus { */ public static boolean canShowDesktopExperienceDevOption(@NonNull Context context) { return Flags.showDesktopExperienceDevOption() && isInternalDisplayEligibleToHostDesktops(context); && isDeviceEligibleForDesktopMode(context); } /** Returns if desktop mode dev option should be enabled if there is no user override. */ public static boolean shouldDevOptionBeEnabledByDefault(Context context) { return isInternalDisplayEligibleToHostDesktops(context) return isDeviceEligibleForDesktopMode(context) && Flags.enableDesktopWindowingMode(); } Loading @@ -252,10 +253,9 @@ public class DesktopModeStatus { * Return {@code true} if desktop mode is enabled and can be entered on the current device. */ public static boolean canEnterDesktopMode(@NonNull Context context) { return (isInternalDisplayEligibleToHostDesktops(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue() && (isDesktopModeSupported(context) || !enforceDeviceRestrictions()) || isDesktopModeEnabledByDevOption(context)); return (isDeviceEligibleForDesktopMode(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue()) || isDesktopModeEnabledByDevOption(context); } /** Loading Loading @@ -323,25 +323,34 @@ public class DesktopModeStatus { } /** * Return {@code true} if desktop sessions is unrestricted and can be host for the device's * internal display. * Return {@code true} if desktop mode is unrestricted and is supported on the device. */ public static boolean isInternalDisplayEligibleToHostDesktops(@NonNull Context context) { return !enforceDeviceRestrictions() || canInternalDisplayHostDesktops(context) || ( Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionSupported( context)); public static boolean isDeviceEligibleForDesktopMode(@NonNull Context context) { if (!enforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); final boolean desktopModeSupportedByDevOptions = Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionSupported(context); return desktopModeSupported || desktopModeSupportedByDevOptions; } /** * Return {@code true} if the developer option for desktop mode is unrestricted and is supported * in the device. * * Note that, if {@link #isInternalDisplayEligibleToHostDesktops(Context)} is true, then * Note that, if {@link #isDeviceEligibleForDesktopMode(Context)} is true, then * {@link #isDeviceEligibleForDesktopModeDevOption(Context)} is also true. */ private static boolean isDeviceEligibleForDesktopModeDevOption(@NonNull Context context) { return !enforceDeviceRestrictions() || isDesktopModeSupported(context) || isDesktopModeDevOptionSupported(context); if (!enforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); return desktopModeSupported || isDesktopModeDevOptionSupported(context); } /** Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatusTest.kt +22 −5 Original line number Diff line number Diff line Loading @@ -157,23 +157,40 @@ class DesktopModeStatusTest : ShellTestCase() { } @Test fun isInternalDisplayEligibleToHostDesktops_configDEModeOn_returnsTrue() { fun isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktop_returnsTrue() { doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isTrue() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isTrue() } @Test fun isDeviceEligibleForDesktopMode_configDEModeOffAndIntDispHostsDesktop_returnsFalse() { doReturn(false).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @Test fun isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktopOff_returnsFalse() { doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(false).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test fun isInternalDisplayEligibleToHostDesktops_supportFlagOff_returnsFalse() { assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isFalse() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test fun isInternalDisplayEligibleToHostDesktops_supportFlagOn_returnsFalse() { assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isFalse() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) Loading @@ -183,7 +200,7 @@ class DesktopModeStatusTest : ShellTestCase() { eq(R.bool.config_isDesktopModeDevOptionSupported) ) assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isTrue() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isTrue() } @DisableFlags(Flags.FLAG_SHOW_DESKTOP_EXPERIENCE_DEV_OPTION) Loading services/core/java/com/android/server/wm/DesktopModeHelper.java +23 −15 Original line number Diff line number Diff line Loading @@ -51,13 +51,8 @@ public final class DesktopModeHelper { } /** * Return {@code true} if the current device can hosts desktop sessions on its internal display. * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting static boolean canInternalDisplayHostDesktops(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } // TODO(b/337819319): use a companion object instead. private static boolean isDesktopModeSupported(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_isDesktopModeSupported); Loading @@ -67,33 +62,46 @@ public final class DesktopModeHelper { return context.getResources().getBoolean(R.bool.config_isDesktopModeDevOptionSupported); } /** * Return {@code true} if the current device can hosts desktop sessions on its internal display. */ @VisibleForTesting static boolean canInternalDisplayHostDesktops(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } /** * Check if Desktop mode should be enabled because the dev option is shown and enabled. */ private static boolean isDesktopModeEnabledByDevOption(@NonNull Context context) { return DesktopModeFlags.isDesktopModeForcedEnabled() && (isDesktopModeDevOptionsSupported( context) || isInternalDisplayEligibleToHostDesktops(context)); context) || isDeviceEligibleForDesktopMode(context)); } @VisibleForTesting static boolean isInternalDisplayEligibleToHostDesktops(@NonNull Context context) { return !shouldEnforceDeviceRestrictions() || canInternalDisplayHostDesktops(context) || ( Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionsSupported( context)); static boolean isDeviceEligibleForDesktopMode(@NonNull Context context) { if (!shouldEnforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); final boolean desktopModeSupportedByDevOptions = Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionsSupported(context); return desktopModeSupported || desktopModeSupportedByDevOptions; } /** * Return {@code true} if desktop mode can be entered on the current device. */ static boolean canEnterDesktopMode(@NonNull Context context) { return (isInternalDisplayEligibleToHostDesktops(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue() && (isDesktopModeSupported(context) || !shouldEnforceDeviceRestrictions())) return (isDeviceEligibleForDesktopMode(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue()) || isDesktopModeEnabledByDevOption(context); } /** Returns {@code true} if desktop experience wallpaper is supported on this device. */ public static boolean isDeviceEligibleForDesktopExperienceWallpaper(@NonNull Context context) { return enableConnectedDisplaysWallpaper() && canEnterDesktopMode(context); return enableConnectedDisplaysWallpaper() && isDeviceEligibleForDesktopMode(context); } } services/tests/wmtests/src/com/android/server/wm/DesktopModeHelperTest.java +24 −5 Original line number Diff line number Diff line Loading @@ -177,22 +177,41 @@ public class DesktopModeHelperTest { } @Test public void isDeviceEligibleForDesktopMode_configDEModeOn_returnsTrue() { public void isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktop_returnsTrue() { doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(true).when(mMockResources) .getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isTrue(); } @Test public void isDeviceEligibleForDesktopMode_configDEModeOffAndIntDispHostsDesktop_returnsFalse() { doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(false).when(mMockResources) .getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @Test public void isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktopOff_returnsFalse() { doReturn(false).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isTrue(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test public void isDeviceEligibleForDesktopMode_supportFlagOff_returnsFalse() { assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isFalse(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test public void isDeviceEligibleForDesktopMode_supportFlagOn_returnsFalse() { assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isFalse(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) Loading @@ -202,7 +221,7 @@ public class DesktopModeHelperTest { eq(R.bool.config_isDesktopModeDevOptionSupported) ); assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isTrue(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isTrue(); } private void resetEnforceDeviceRestriction() throws Exception { Loading Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatus.java +25 −16 Original line number Diff line number Diff line Loading @@ -226,6 +226,7 @@ public class DesktopModeStatus { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } /** * Return {@code true} if desktop mode dev option should be shown on current device */ Loading @@ -239,12 +240,12 @@ public class DesktopModeStatus { */ public static boolean canShowDesktopExperienceDevOption(@NonNull Context context) { return Flags.showDesktopExperienceDevOption() && isInternalDisplayEligibleToHostDesktops(context); && isDeviceEligibleForDesktopMode(context); } /** Returns if desktop mode dev option should be enabled if there is no user override. */ public static boolean shouldDevOptionBeEnabledByDefault(Context context) { return isInternalDisplayEligibleToHostDesktops(context) return isDeviceEligibleForDesktopMode(context) && Flags.enableDesktopWindowingMode(); } Loading @@ -252,10 +253,9 @@ public class DesktopModeStatus { * Return {@code true} if desktop mode is enabled and can be entered on the current device. */ public static boolean canEnterDesktopMode(@NonNull Context context) { return (isInternalDisplayEligibleToHostDesktops(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue() && (isDesktopModeSupported(context) || !enforceDeviceRestrictions()) || isDesktopModeEnabledByDevOption(context)); return (isDeviceEligibleForDesktopMode(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue()) || isDesktopModeEnabledByDevOption(context); } /** Loading Loading @@ -323,25 +323,34 @@ public class DesktopModeStatus { } /** * Return {@code true} if desktop sessions is unrestricted and can be host for the device's * internal display. * Return {@code true} if desktop mode is unrestricted and is supported on the device. */ public static boolean isInternalDisplayEligibleToHostDesktops(@NonNull Context context) { return !enforceDeviceRestrictions() || canInternalDisplayHostDesktops(context) || ( Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionSupported( context)); public static boolean isDeviceEligibleForDesktopMode(@NonNull Context context) { if (!enforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); final boolean desktopModeSupportedByDevOptions = Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionSupported(context); return desktopModeSupported || desktopModeSupportedByDevOptions; } /** * Return {@code true} if the developer option for desktop mode is unrestricted and is supported * in the device. * * Note that, if {@link #isInternalDisplayEligibleToHostDesktops(Context)} is true, then * Note that, if {@link #isDeviceEligibleForDesktopMode(Context)} is true, then * {@link #isDeviceEligibleForDesktopModeDevOption(Context)} is also true. */ private static boolean isDeviceEligibleForDesktopModeDevOption(@NonNull Context context) { return !enforceDeviceRestrictions() || isDesktopModeSupported(context) || isDesktopModeDevOptionSupported(context); if (!enforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); return desktopModeSupported || isDesktopModeDevOptionSupported(context); } /** Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/shared/desktopmode/DesktopModeStatusTest.kt +22 −5 Original line number Diff line number Diff line Loading @@ -157,23 +157,40 @@ class DesktopModeStatusTest : ShellTestCase() { } @Test fun isInternalDisplayEligibleToHostDesktops_configDEModeOn_returnsTrue() { fun isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktop_returnsTrue() { doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isTrue() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isTrue() } @Test fun isDeviceEligibleForDesktopMode_configDEModeOffAndIntDispHostsDesktop_returnsFalse() { doReturn(false).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @Test fun isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktopOff_returnsFalse() { doReturn(true).whenever(mockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)) doReturn(false).whenever(mockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)) assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_WINDOWING_MODE) @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test fun isInternalDisplayEligibleToHostDesktops_supportFlagOff_returnsFalse() { assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isFalse() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test fun isInternalDisplayEligibleToHostDesktops_supportFlagOn_returnsFalse() { assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isFalse() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isFalse() } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) Loading @@ -183,7 +200,7 @@ class DesktopModeStatusTest : ShellTestCase() { eq(R.bool.config_isDesktopModeDevOptionSupported) ) assertThat(DesktopModeStatus.isInternalDisplayEligibleToHostDesktops(mockContext)).isTrue() assertThat(DesktopModeStatus.isDeviceEligibleForDesktopMode(mockContext)).isTrue() } @DisableFlags(Flags.FLAG_SHOW_DESKTOP_EXPERIENCE_DEV_OPTION) Loading
services/core/java/com/android/server/wm/DesktopModeHelper.java +23 −15 Original line number Diff line number Diff line Loading @@ -51,13 +51,8 @@ public final class DesktopModeHelper { } /** * Return {@code true} if the current device can hosts desktop sessions on its internal display. * Return {@code true} if the current device supports desktop mode. */ @VisibleForTesting static boolean canInternalDisplayHostDesktops(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } // TODO(b/337819319): use a companion object instead. private static boolean isDesktopModeSupported(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_isDesktopModeSupported); Loading @@ -67,33 +62,46 @@ public final class DesktopModeHelper { return context.getResources().getBoolean(R.bool.config_isDesktopModeDevOptionSupported); } /** * Return {@code true} if the current device can hosts desktop sessions on its internal display. */ @VisibleForTesting static boolean canInternalDisplayHostDesktops(@NonNull Context context) { return context.getResources().getBoolean(R.bool.config_canInternalDisplayHostDesktops); } /** * Check if Desktop mode should be enabled because the dev option is shown and enabled. */ private static boolean isDesktopModeEnabledByDevOption(@NonNull Context context) { return DesktopModeFlags.isDesktopModeForcedEnabled() && (isDesktopModeDevOptionsSupported( context) || isInternalDisplayEligibleToHostDesktops(context)); context) || isDeviceEligibleForDesktopMode(context)); } @VisibleForTesting static boolean isInternalDisplayEligibleToHostDesktops(@NonNull Context context) { return !shouldEnforceDeviceRestrictions() || canInternalDisplayHostDesktops(context) || ( Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionsSupported( context)); static boolean isDeviceEligibleForDesktopMode(@NonNull Context context) { if (!shouldEnforceDeviceRestrictions()) { return true; } final boolean desktopModeSupported = isDesktopModeSupported(context) && canInternalDisplayHostDesktops(context); final boolean desktopModeSupportedByDevOptions = Flags.enableDesktopModeThroughDevOption() && isDesktopModeDevOptionsSupported(context); return desktopModeSupported || desktopModeSupportedByDevOptions; } /** * Return {@code true} if desktop mode can be entered on the current device. */ static boolean canEnterDesktopMode(@NonNull Context context) { return (isInternalDisplayEligibleToHostDesktops(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue() && (isDesktopModeSupported(context) || !shouldEnforceDeviceRestrictions())) return (isDeviceEligibleForDesktopMode(context) && DesktopModeFlags.ENABLE_DESKTOP_WINDOWING_MODE.isTrue()) || isDesktopModeEnabledByDevOption(context); } /** Returns {@code true} if desktop experience wallpaper is supported on this device. */ public static boolean isDeviceEligibleForDesktopExperienceWallpaper(@NonNull Context context) { return enableConnectedDisplaysWallpaper() && canEnterDesktopMode(context); return enableConnectedDisplaysWallpaper() && isDeviceEligibleForDesktopMode(context); } }
services/tests/wmtests/src/com/android/server/wm/DesktopModeHelperTest.java +24 −5 Original line number Diff line number Diff line Loading @@ -177,22 +177,41 @@ public class DesktopModeHelperTest { } @Test public void isDeviceEligibleForDesktopMode_configDEModeOn_returnsTrue() { public void isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktop_returnsTrue() { doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(true).when(mMockResources) .getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isTrue(); } @Test public void isDeviceEligibleForDesktopMode_configDEModeOffAndIntDispHostsDesktop_returnsFalse() { doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(false).when(mMockResources) .getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @Test public void isDeviceEligibleForDesktopMode_configDEModeOnAndIntDispHostsDesktopOff_returnsFalse() { doReturn(false).when(mMockResources).getBoolean(eq(R.bool.config_isDesktopModeSupported)); doReturn(true).when(mMockResources).getBoolean(eq(R.bool.config_canInternalDisplayHostDesktops)); assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isTrue(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @DisableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test public void isDeviceEligibleForDesktopMode_supportFlagOff_returnsFalse() { assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isFalse(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) @Test public void isDeviceEligibleForDesktopMode_supportFlagOn_returnsFalse() { assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isFalse(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isFalse(); } @EnableFlags(Flags.FLAG_ENABLE_DESKTOP_MODE_THROUGH_DEV_OPTION) Loading @@ -202,7 +221,7 @@ public class DesktopModeHelperTest { eq(R.bool.config_isDesktopModeDevOptionSupported) ); assertThat(DesktopModeHelper.isInternalDisplayEligibleToHostDesktops(mMockContext)).isTrue(); assertThat(DesktopModeHelper.isDeviceEligibleForDesktopMode(mMockContext)).isTrue(); } private void resetEnforceDeviceRestriction() throws Exception { Loading