Allow non-resizable apps in split-screen (3/n)
Update the developer option for enabling non-resizable for multi window (freeform/splitscreen) instead of only freeform Bug: 176061101 Test: manual Test: make RunSettingsRoboTests Change-Id: I56a9d8edca502d9449967f557c075b1408375a8a
This commit is contained in:
@@ -12186,10 +12186,10 @@
|
||||
<string name="force_desktop_mode">Force desktop mode</string>
|
||||
<!-- UI debug setting: force desktop mode summary [CHAR LIMIT=NONE] -->
|
||||
<string name="force_desktop_mode_summary">Force experimental desktop mode on secondary displays</string>
|
||||
<!-- UI debug setting: enable non-resizables in freeform [CHAR LIMIT=60] -->
|
||||
<string name="enable_sizecompat_freeform">Enable freeform sizecompat</string>
|
||||
<!-- UI debug setting: enable non-resizables in freeform summary [CHAR LIMIT=NONE] -->
|
||||
<string name="enable_sizecompat_freeform_summary">Allows sizecompat apps to be in freeform</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>
|
||||
<!-- UI debug setting: enable non-resizables in multi window summary [CHAR LIMIT=NONE] -->
|
||||
<string name="enable_non_resizable_multi_window_summary">Allows non-resizable apps to be in multi window</string>
|
||||
|
||||
<!-- UI debug setting: Force enable "smart dark" UI rendering feature [CHAR LIMIT=60] -->
|
||||
<string name="hwui_force_dark_title">Override force-dark</string>
|
||||
|
@@ -640,9 +640,9 @@
|
||||
android:summary="@string/force_desktop_mode_summary" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="enable_sizecompat_freeform"
|
||||
android:title="@string/enable_sizecompat_freeform"
|
||||
android:summary="@string/enable_sizecompat_freeform_summary" />
|
||||
android:key="enable_non_resizable_multi_window"
|
||||
android:title="@string/enable_non_resizable_multi_window"
|
||||
android:summary="@string/enable_non_resizable_multi_window_summary" />
|
||||
|
||||
<Preference
|
||||
android:key="reset_shortcut_manager_throttling"
|
||||
|
@@ -553,7 +553,7 @@ public class DevelopmentSettingsDashboardFragment extends RestrictedDashboardFra
|
||||
controllers.add(new ResizableActivityPreferenceController(context));
|
||||
controllers.add(new FreeformWindowsPreferenceController(context));
|
||||
controllers.add(new DesktopModePreferenceController(context));
|
||||
controllers.add(new SizeCompatFreeformPreferenceController(context));
|
||||
controllers.add(new NonResizableMultiWindowPreferenceController(context));
|
||||
controllers.add(new ShortcutManagerThrottlingPreferenceController(context));
|
||||
controllers.add(new EnableGnssRawMeasFullTrackingPreferenceController(context));
|
||||
controllers.add(new DefaultLaunchPreferenceController(context, "running_apps"));
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
package com.android.settings.development;
|
||||
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM;
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW;
|
||||
|
||||
import android.content.Context;
|
||||
import android.provider.Settings;
|
||||
@@ -29,32 +29,35 @@ import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
|
||||
|
||||
/**
|
||||
* Preference Controller for whether to allow launching size-compat apps in freeform windows.
|
||||
* Preference Controller for whether to allow launching non-resizable apps in multi window,
|
||||
* such as freeform and splitscreen.
|
||||
*/
|
||||
public class SizeCompatFreeformPreferenceController extends DeveloperOptionsPreferenceController
|
||||
public class NonResizableMultiWindowPreferenceController
|
||||
extends DeveloperOptionsPreferenceController
|
||||
implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
|
||||
|
||||
private static final String ENABLE_SIZECOMPAT_FREEFORM_KEY = "enable_sizecompat_freeform";
|
||||
private static final String ENABLE_NON_RESIZABLE_MULTI_WINDOW_KEY =
|
||||
"enable_non_resizable_multi_window";
|
||||
|
||||
@VisibleForTesting
|
||||
static final int SETTING_VALUE_OFF = 0;
|
||||
@VisibleForTesting
|
||||
static final int SETTING_VALUE_ON = 1;
|
||||
|
||||
public SizeCompatFreeformPreferenceController(Context context) {
|
||||
public NonResizableMultiWindowPreferenceController(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return ENABLE_SIZECOMPAT_FREEFORM_KEY;
|
||||
return ENABLE_NON_RESIZABLE_MULTI_WINDOW_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
final boolean isEnabled = (Boolean) newValue;
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM,
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW,
|
||||
isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
|
||||
return true;
|
||||
}
|
||||
@@ -62,7 +65,7 @@ public class SizeCompatFreeformPreferenceController extends DeveloperOptionsPref
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, SETTING_VALUE_OFF);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@@ -70,7 +73,7 @@ public class SizeCompatFreeformPreferenceController extends DeveloperOptionsPref
|
||||
protected void onDeveloperOptionsSwitchDisabled() {
|
||||
super.onDeveloperOptionsSwitchDisabled();
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, SETTING_VALUE_OFF);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||
((SwitchPreference) mPreference).setChecked(false);
|
||||
}
|
||||
}
|
@@ -16,10 +16,10 @@
|
||||
|
||||
package com.android.settings.development;
|
||||
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM;
|
||||
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW;
|
||||
|
||||
import static com.android.settings.development.SizeCompatFreeformPreferenceController.SETTING_VALUE_OFF;
|
||||
import static com.android.settings.development.SizeCompatFreeformPreferenceController.SETTING_VALUE_ON;
|
||||
import static com.android.settings.development.NonResizableMultiWindowPreferenceController.SETTING_VALUE_OFF;
|
||||
import static com.android.settings.development.NonResizableMultiWindowPreferenceController.SETTING_VALUE_ON;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
public class SizeCompatFreeformPreferenceControllerTest {
|
||||
public class NonResizableMultiWindowPreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
private SwitchPreference mPreference;
|
||||
@@ -49,39 +49,39 @@ public class SizeCompatFreeformPreferenceControllerTest {
|
||||
private PreferenceScreen mScreen;
|
||||
|
||||
private Context mContext;
|
||||
private SizeCompatFreeformPreferenceController mController;
|
||||
private NonResizableMultiWindowPreferenceController mController;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new SizeCompatFreeformPreferenceController(mContext);
|
||||
mController = new NonResizableMultiWindowPreferenceController(mContext);
|
||||
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
|
||||
mController.displayPreference(mScreen);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchEnabled_shouldEnableSizeCompatFreeform() {
|
||||
public void onPreferenceChange_switchEnabled_shouldEnableNonResizableMultiWindow() {
|
||||
mController.onPreferenceChange(mPreference, true /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, -1 /* default */);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, -1 /* default */);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_ON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onPreferenceChange_switchDisabled_shouldDisableSizeCompatFreeform() {
|
||||
public void onPreferenceChange_switchDisabled_shouldDisableNonResizableMultiWindow() {
|
||||
mController.onPreferenceChange(mPreference, false /* new value */);
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, -1 /* default */);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, -1 /* default */);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_settingEnabled_preferenceShouldBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, SETTING_VALUE_ON);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_ON);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class SizeCompatFreeformPreferenceControllerTest {
|
||||
@Test
|
||||
public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, SETTING_VALUE_OFF);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, SETTING_VALUE_OFF);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class SizeCompatFreeformPreferenceControllerTest {
|
||||
mController.onDeveloperOptionsSwitchDisabled();
|
||||
|
||||
final int mode = Settings.Global.getInt(mContext.getContentResolver(),
|
||||
DEVELOPMENT_ENABLE_SIZECOMPAT_FREEFORM, -1 /* default */);
|
||||
DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, -1 /* default */);
|
||||
assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
|
||||
verify(mPreference).setEnabled(false);
|
||||
}
|
Reference in New Issue
Block a user