Merge "[dev_option] Update 'Desktop mode on secondary toggle' to be 'Freeform windows on secondary diplay'." into main
This commit is contained in:
@@ -12238,11 +12238,11 @@
|
||||
<!-- Default title for the settings panel [CHAR LIMIT=NONE] -->
|
||||
<string name="settings_panel_title">Settings Panel</string>
|
||||
|
||||
<!-- Title for a toggle that enables freeform windowing experiences. Freeform windowing experiences are features involving apps running in resizable windows. [CHAR LIMIT=50] -->
|
||||
<string name="enable_desktop_mode">Enable freeform windowing experiences</string>
|
||||
<!-- Title for a toggle that enables freeform windows. Freeform windows enables users to freely arrange and resize overlapping apps. [CHAR LIMIT=50] -->
|
||||
<string name="enable_desktop_mode">Enable freeform windows</string>
|
||||
|
||||
<!-- Title for a toggle that enables desktop mode on secondary display. [CHAR LIMIT=50] -->
|
||||
<string name="enable_desktop_mode_on_secondary_display">Enable desktop mode on secondary display</string>
|
||||
<!-- Title for a toggle that enables freeform windows on secondary display. Freeform windows enables users to freely arrange and resize overlapping apps. [CHAR LIMIT=50] -->
|
||||
<string name="enable_desktop_mode_on_secondary_display">Enable freeform windows on secondary display</string>
|
||||
|
||||
<!-- UI debug setting: enable non-resizables in multi window [CHAR LIMIT=60] -->
|
||||
<string name="enable_non_resizable_multi_window">Enable non-resizable in multi window</string>
|
||||
@@ -13202,12 +13202,12 @@
|
||||
<!-- The content description for accessibility tools of the customize button. It specifies which screensaver the user is customizing [CHAR LIMIT=NONE] -->
|
||||
<string name="customize_button_description">Customize <xliff:g id="screensaver_name" example="Art Gallery">%1$s</xliff:g></string>
|
||||
|
||||
<!-- Dialog body text used to explain a reboot is required after enabling freeform window support for it to work. Freeform window is when an app runs in a resizable window. [CHAR LIMIT=none] -->
|
||||
<!-- Dialog body text used to explain a reboot is required after enabling freeform window support for it to work. Freeform windows enables users to freely arrange and resize overlapping apps. [CHAR LIMIT=none] -->
|
||||
<string name="reboot_dialog_enable_freeform_support">A reboot is required to enable freeform window support.</string>
|
||||
<!-- Dialog body text used to explain a reboot is required after updating availability of freeform windowing experiences. Freeform windowing experiences are features involving apps running in resizable windows. [CHAR LIMIT=none] -->
|
||||
<string name="reboot_dialog_override_desktop_mode">A reboot is required to update availability of freeform windowing experiences.</string>
|
||||
<!-- Dialog body text used to explain a reboot is required after enabling desktop mode on secondary displays. [CHAR LIMIT=none] -->
|
||||
<string name="reboot_dialog_enable_desktop_mode_on_secondary_display">A reboot is required to enable desktop mode on secondary displays.</string>
|
||||
<!-- Dialog body text used to explain a reboot is required after updating availability of freeform windows. Freeform windows enables users to freely arrange and resize overlapping apps. [CHAR LIMIT=none] -->
|
||||
<string name="reboot_dialog_override_desktop_mode">A reboot is required to update availability of freeform windows.</string>
|
||||
<!-- Dialog body text used to explain a reboot is required after enabling freeform windows on secondary displays. Freeform windows enables users to freely arrange and resize overlapping apps. [CHAR LIMIT=none] -->
|
||||
<string name="reboot_dialog_enable_desktop_mode_on_secondary_display">A reboot is required to enable freeform windows on secondary displays.</string>
|
||||
<!-- Text on the dialog button to reboot the device now [CHAR LIMIT=50] -->
|
||||
<string name="reboot_dialog_reboot_now">Reboot now</string>
|
||||
<!-- Text on the dialog button to reboot the device later [CHAR LIMIT=50] -->
|
||||
|
@@ -67,6 +67,12 @@ public class DesktopModeSecondaryDisplayPreferenceController extends
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
|
||||
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||
// Update freeform window support on device.
|
||||
// DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT setting enables freeform support on device
|
||||
// where it's not present by default.
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT,
|
||||
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||
if (isEnabled && mFragment != null) {
|
||||
RebootConfirmationDialogFragment.show(
|
||||
mFragment, R.string.reboot_dialog_enable_desktop_mode_on_secondary_display,
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.settings.development;
|
||||
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS;
|
||||
|
||||
import static com.android.settings.development.DesktopModeSecondaryDisplayPreferenceController.SETTING_VALUE_OFF;
|
||||
@@ -55,6 +56,7 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
|
||||
|
||||
private static final String ENG_BUILD_TYPE = "eng";
|
||||
private static final String USER_BUILD_TYPE = "user";
|
||||
private static final int SETTING_VALUE_INVALID = -1;
|
||||
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
@@ -102,21 +104,41 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchEnabled_enablesDesktopModeOnSecondaryDisplay() {
|
||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||
mController.onPreferenceChange(mPreference, /* newValue= */ true);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
|
||||
/* def= */ SETTING_VALUE_INVALID);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
|
||||
|
||||
verify(mTransaction).add(any(RebootConfirmationDialogFragment.class), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchDisabled_disablesDesktopModeOnSecondaryDisplay() {
|
||||
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||
public void onPreferenceChange_switchEnabled_enablesFreeformSupport() {
|
||||
mController.onPreferenceChange(mPreference, /* newValue= */ true);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
|
||||
DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, /* def= */ SETTING_VALUE_INVALID);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchDisabled_disablesDesktopModeOnSecondaryDisplay() {
|
||||
mController.onPreferenceChange(mPreference, /* newValue= */ false);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
|
||||
/* def= */ SETTING_VALUE_INVALID);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchDisabled_disablesFreeformSupport() {
|
||||
mController.onPreferenceChange(mPreference, /* newValue= */ false);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, /* def= */ SETTING_VALUE_INVALID);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@@ -145,7 +167,8 @@ public class DesktopModeSecondaryDisplayPreferenceControllerTest {
|
||||
mController.onDeveloperOptionsSwitchDisabled();
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS, -1 /* default */);
|
||||
DEVELOPMENT_FORCE_DESKTOP_MODE_ON_EXTERNAL_DISPLAYS,
|
||||
/* def= */ SETTING_VALUE_INVALID);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
verify(mPreference).setEnabled(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user