diff options
9 files changed, 45 insertions, 39 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index c17bbae6f459..1860f433402c 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3342,6 +3342,7 @@ package android.view { field public static final int DISPLAY_IME_POLICY_FALLBACK_DISPLAY = 1; // 0x1 field public static final int DISPLAY_IME_POLICY_HIDE = 2; // 0x2 field public static final int DISPLAY_IME_POLICY_LOCAL = 0; // 0x0 + field public static final int LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP = 600; // 0x258 } public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable { diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index e7cefd60002b..f8636788ee3c 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -817,6 +817,15 @@ public interface WindowManager extends ViewManager { } /** + * If the display {@link Configuration#smallestScreenWidthDp} is greater or equal to this value, + * we will treat it as a large screen device, which will have some multi window features enabled + * by default. + * @hide + */ + @TestApi + int LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP = 600; + + /** * Application level {@link android.content.pm.PackageManager.Property PackageManager * .Property} for an app to inform the system that the app can be opted-in or opted-out * from the compatibility treatment that avoids {@link diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 733e0eacc258..ffb602d93b0f 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3988,7 +3988,7 @@ <!-- Whether the device supports non-resizable activity in multi windowing modes. -1: The device doesn't support non-resizable in multi windowing modes. 0: The device supports non-resizable in multi windowing modes only if this is a large - screen (smallest width >= {@link config_largeScreenSmallestScreenWidthDp}). + screen (smallest width >= {@link WindowManager#LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP}). 1: The device always supports non-resizable in multi windowing modes. --> <integer name="config_supportsNonResizableMultiWindow">0</integer> @@ -3998,9 +3998,9 @@ -1: The device ignores the activity min width/height when determining if it can be shown in multi windowing modes. 0: If this is a small screen (smallest width < - {@link config_largeScreenSmallestScreenWidthDp}), the device compares the activity min - width/height with the min multi windowing modes dimensions the device supports to - determine if the activity can be shown in multi windowing modes + {@link WindowManager#LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP}), the device compares the + activity min width/height with the min multi windowing modes dimensions the device + supports to determine if the activity can be shown in multi windowing modes 1: The device always compare the activity min width/height with the min multi windowing modes dimensions {@link config_minPercentageMultiWindowSupportWidth} the device supports to determine if the activity can be shown in multi windowing modes. @@ -4023,11 +4023,6 @@ --> <item name="config_minPercentageMultiWindowSupportWidth" format="float" type="dimen">0.5</item> - <!-- If the display smallest screen width is greater or equal to this value, we will treat it - as a large screen device, which will have some multi window features enabled by default. - --> - <integer name="config_largeScreenSmallestScreenWidthDp">600</integer> - <!-- True if the device is using legacy split. --> <bool name="config_useLegacySplit">false</bool> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index e2b46d017288..92dc5694ff2c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -405,7 +405,6 @@ <java-symbol type="integer" name="config_respectsActivityMinWidthHeightMultiWindow" /> <java-symbol type="dimen" name="config_minPercentageMultiWindowSupportHeight" /> <java-symbol type="dimen" name="config_minPercentageMultiWindowSupportWidth" /> - <java-symbol type="integer" name="config_largeScreenSmallestScreenWidthDp" /> <java-symbol type="bool" name="config_useLegacySplit" /> <java-symbol type="bool" name="config_noHomeScreen" /> <java-symbol type="bool" name="config_supportsSystemDecorsOnSecondaryDisplays" /> diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 8939f1463eae..9def87c3d77a 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -7937,7 +7937,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } return getTask().getConfiguration().smallestScreenWidthDp - >= mAtmService.mLargeScreenSmallestScreenWidthDp; + >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; } /** diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 7d478b3c7ca5..923ca794e840 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -609,7 +609,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { * Whether the device supports non-resizable in multi windowing modes. * -1: The device doesn't support non-resizable in multi windowing modes. * 0: The device supports non-resizable in multi windowing modes only if this is a large - * screen (smallest width >= {@link #mLargeScreenSmallestScreenWidthDp}). + * screen (smallest width >= {@link WindowManager#LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP}). * 1: The device always supports non-resizable in multi windowing modes. */ int mSupportsNonResizableMultiWindow; @@ -619,7 +619,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { * windowing modes. * -1: The device ignores activity min width/height when determining if it can be shown in multi * windowing modes. - * 0: If it is a small screen (smallest width < {@link #mLargeScreenSmallestScreenWidthDp}), + * 0: If it is a small screen (smallest width < + * {@link WindowManager#LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP}), * the device compares the activity min width/height with the min multi windowing modes * dimensions {@link #mMinPercentageMultiWindowSupportHeight} the device supports to * determine whether the activity can be shown in multi windowing modes @@ -647,13 +648,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { */ float mMinPercentageMultiWindowSupportWidth; - /** - * If the display {@link Configuration#smallestScreenWidthDp} is greater or equal to this value, - * we will treat it as a large screen device, which will have some multi window features enabled - * by default. - */ - int mLargeScreenSmallestScreenWidthDp; - final List<ActivityTaskManagerInternal.ScreenObserver> mScreenObservers = new ArrayList<>(); // VR Vr2d Display Id. @@ -914,8 +908,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { com.android.internal.R.dimen.config_minPercentageMultiWindowSupportHeight); final float minPercentageMultiWindowSupportWidth = mContext.getResources().getFloat( com.android.internal.R.dimen.config_minPercentageMultiWindowSupportWidth); - final int largeScreenSmallestScreenWidthDp = mContext.getResources().getInteger( - com.android.internal.R.integer.config_largeScreenSmallestScreenWidthDp); // Transfer any global setting for forcing RTL layout, into a System Property DisplayProperties.debug_force_rtl(forceRtl); @@ -934,7 +926,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mRespectsActivityMinWidthHeightMultiWindow = respectsActivityMinWidthHeightMultiWindow; mMinPercentageMultiWindowSupportHeight = minPercentageMultiWindowSupportHeight; mMinPercentageMultiWindowSupportWidth = minPercentageMultiWindowSupportWidth; - mLargeScreenSmallestScreenWidthDp = largeScreenSmallestScreenWidthDp; final boolean multiWindowFormEnabled = freeformWindowManagement || supportsSplitScreenMultiWindow || supportsPictureInPicture diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index 3cec3aa6a205..76759ba53f5a 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -49,6 +49,7 @@ import android.util.IntArray; import android.util.Slog; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; +import android.view.WindowManager; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.protolog.common.ProtoLog; @@ -1486,7 +1487,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> { */ private boolean isLargeEnoughForMultiWindow() { return getConfiguration().smallestScreenWidthDp - >= mAtmService.mLargeScreenSmallestScreenWidthDp; + >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; } boolean isTopRootTask(Task rootTask) { diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java index 3dcae91f5c89..0044e2e54b5a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityTaskManagerServiceTests.java @@ -66,6 +66,7 @@ import android.platform.test.annotations.Presubmit; import android.view.Display; import android.view.DisplayInfo; import android.view.IDisplayWindowListener; +import android.view.WindowManager; import androidx.test.filters.MediumTest; @@ -456,13 +457,15 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { mAtm.mSupportsNonResizableMultiWindow = 0; // Supports on large screen. - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; assertTrue(activity.supportsMultiWindow()); assertTrue(task.supportsMultiWindow()); // Not supports on small screen. - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; assertFalse(activity.supportsMultiWindow()); assertFalse(task.supportsMultiWindow()); @@ -475,8 +478,10 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { new ActivityInfo.WindowLayout(0, 0, 0, 0, 0, // This is larger than the min dimensions device support in multi window, // the activity will not be supported in multi window if the device respects - /* minWidth= */(int) (mAtm.mLargeScreenSmallestScreenWidthDp * density), - /* minHeight= */(int) (mAtm.mLargeScreenSmallestScreenWidthDp * density)); + /* minWidth= */ + (int) (WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP * density), + /* minHeight= */ + (int) (WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP * density)); final ActivityRecord activity = new ActivityBuilder(mAtm) .setCreateTask(true) .setWindowLayout(windowLayout) @@ -501,13 +506,15 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { mAtm.mRespectsActivityMinWidthHeightMultiWindow = 0; // Ignore on large screen. - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP; assertTrue(activity.supportsMultiWindow()); assertTrue(task.supportsMultiWindow()); // Check on small screen. - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; assertFalse(activity.supportsMultiWindow()); assertFalse(task.supportsMultiWindow()); @@ -518,7 +525,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { // This is smaller than the min dimensions device support in multi window, // the activity will be supported in multi window final float density = mContext.getResources().getDisplayMetrics().density; - final int supportedWidth = (int) (mAtm.mLargeScreenSmallestScreenWidthDp + final int supportedWidth = (int) (WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP * mAtm.mMinPercentageMultiWindowSupportWidth * density); final ActivityInfo.WindowLayout windowLayout = new ActivityInfo.WindowLayout(0, 0, 0, 0, 0, @@ -531,15 +538,17 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { .build(); final Task task = activity.getTask(); final TaskDisplayArea tda = task.getDisplayArea(); - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; - tda.getConfiguration().screenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; + tda.getConfiguration().screenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; tda.getConfiguration().orientation = ORIENTATION_LANDSCAPE; assertFalse(activity.supportsMultiWindow()); assertFalse(task.supportsMultiWindow()); tda.getConfiguration().screenWidthDp = (int) Math.ceil( - mAtm.mLargeScreenSmallestScreenWidthDp + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP / mAtm.mMinPercentageMultiWindowSupportWidth); assertTrue(activity.supportsMultiWindow()); @@ -551,7 +560,7 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { // This is smaller than the min dimensions device support in multi window, // the activity will be supported in multi window final float density = mContext.getResources().getDisplayMetrics().density; - final int supportedHeight = (int) (mAtm.mLargeScreenSmallestScreenWidthDp + final int supportedHeight = (int) (WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP * mAtm.mMinPercentageMultiWindowSupportHeight * density); final ActivityInfo.WindowLayout windowLayout = new ActivityInfo.WindowLayout(0, 0, 0, 0, 0, @@ -564,15 +573,17 @@ public class ActivityTaskManagerServiceTests extends WindowTestsBase { .build(); final Task task = activity.getTask(); final TaskDisplayArea tda = task.getDisplayArea(); - tda.getConfiguration().smallestScreenWidthDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; - tda.getConfiguration().screenHeightDp = mAtm.mLargeScreenSmallestScreenWidthDp - 1; + tda.getConfiguration().smallestScreenWidthDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; + tda.getConfiguration().screenHeightDp = + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP - 1; tda.getConfiguration().orientation = ORIENTATION_PORTRAIT; assertFalse(activity.supportsMultiWindow()); assertFalse(task.supportsMultiWindow()); tda.getConfiguration().screenHeightDp = (int) Math.ceil( - mAtm.mLargeScreenSmallestScreenWidthDp + WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP / mAtm.mMinPercentageMultiWindowSupportHeight); assertTrue(activity.supportsMultiWindow()); diff --git a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java index f4a266c11679..013c6d50d4e7 100644 --- a/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java +++ b/services/tests/wmtests/src/com/android/server/wm/SystemServicesTestRule.java @@ -545,7 +545,6 @@ public class SystemServicesTestRule implements TestRule { mDevEnableNonResizableMultiWindow = false; mMinPercentageMultiWindowSupportHeight = 0.3f; mMinPercentageMultiWindowSupportWidth = 0.5f; - mLargeScreenSmallestScreenWidthDp = 600; mSupportsNonResizableMultiWindow = 0; mRespectsActivityMinWidthHeightMultiWindow = 0; mForceResizableActivities = false; |