Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85b7d405 authored by Chris Li's avatar Chris Li Committed by Automerger Merge Worker
Browse files

Merge "Determine whether to support activities in multi window (3/n)" into...

Merge "Determine whether to support activities in multi window (3/n)" into sc-dev am: e5fe75d2 am: 6c0fc6c6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14355985

Change-Id: Ib0d577defe469b30a047aa202a04ef1a262bff2f
parents 366e86f3 6c0fc6c6
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -3517,6 +3517,41 @@
    <!-- True if the device supports split screen as a form of multi-window. -->
    <bool name="config_supportsSplitScreenMultiWindow">true</bool>

    <!-- 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}).
          1: The device always supports non-resizable in multi windowing modes.
    -->
    <integer name="config_supportsNonResizableMultiWindow">0</integer>

    <!-- Whether the device checks the activity min width/height to determine if it can be shown in
         multi windowing modes.
         -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
          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.
    -->
    <integer name="config_respectsActivityMinWidthHeightMultiWindow">0</integer>

    <!-- This value is only used when the device checks activity min width/height to determine if it
         can be shown in multi windowing modes.
         If the activity min width/height is greater than this percentage of the display smallest
         width, it will not be allowed to be shown in multi windowing modes.
         The value should be between [0 - 1].
    -->
    <item name="config_minPercentageMultiWindowSupportWidth" format="float" type="dimen">0.3</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 supports running activities on secondary displays. -->
    <bool name="config_supportsMultiDisplay">true</bool>

+4 −0
Original line number Diff line number Diff line
@@ -392,6 +392,10 @@
  <java-symbol type="bool" name="config_supportsMultiWindow" />
  <java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" />
  <java-symbol type="bool" name="config_supportsMultiDisplay" />
  <java-symbol type="integer" name="config_supportsNonResizableMultiWindow" />
  <java-symbol type="integer" name="config_respectsActivityMinWidthHeightMultiWindow" />
  <java-symbol type="dimen" name="config_minPercentageMultiWindowSupportWidth" />
  <java-symbol type="integer" name="config_largeScreenSmallestScreenWidthDp" />
  <java-symbol type="bool" name="config_noHomeScreen" />
  <java-symbol type="bool" name="config_supportsSystemDecorsOnSecondaryDisplays" />
  <java-symbol type="bool" name="config_supportsInsecureLockScreen" />
+22 −1
Original line number Diff line number Diff line
@@ -2508,7 +2508,28 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     */
    boolean supportsMultiWindow() {
        return mAtmService.mSupportsMultiWindow && !isActivityTypeHome()
                && (isResizeable() || mAtmService.mSupportsNonResizableMultiWindow);
                && (isResizeable() || mAtmService.mDevEnableNonResizableMultiWindow);
    }

    // TODO(b/176061101) replace supportsMultiWindow() after fixing tests.
    boolean supportsMultiWindow2() {
        if (!mAtmService.mSupportsMultiWindow) {
            return false;
        }
        final TaskDisplayArea tda = getDisplayArea();
        if (tda == null) {
            return false;
        }

        if (!isResizeable() && !tda.supportsNonResizableMultiWindow()) {
            // Not support non-resizable in multi window.
            return false;
        }

        final ActivityInfo.WindowLayout windowLayout = info.windowLayout;
        return windowLayout == null
                || tda.supportsActivityMinWidthHeightMultiWindow(windowLayout.minWidth,
                windowLayout.minHeight);
    }

    /**
+57 −2
Original line number Diff line number Diff line
@@ -555,7 +555,50 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    boolean mSupportsPictureInPicture;
    boolean mSupportsMultiDisplay;
    boolean mForceResizableActivities;
    volatile boolean mSupportsNonResizableMultiWindow;

    /** Development option to enable non resizable in multi window. */
    // TODO(b/176061101) change the default value to false.
    boolean mDevEnableNonResizableMultiWindow;

    /**
     * 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}).
     *  1: The device always supports non-resizable in multi windowing modes.
     */
    int mSupportsNonResizableMultiWindow;

    /**
     * Whether the device checks activity min width/height to determine if it can be shown in multi
     * 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}),
     *     the device compares the activity min width/height with the min multi windowing modes
     *     dimensions {@link #mMinPercentageMultiWindowSupportWidth} the device supports to
     *     determine whether 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 #mMinPercentageMultiWindowSupportWidth} the device supports to
     *     determine whether it can be shown in multi windowing modes.
     */
    int mRespectsActivityMinWidthHeightMultiWindow;

    /**
     * This value is only used when the device checks activity min width/height to determine if it
     * can be shown in multi windowing modes.
     * If the activity min width/height is greater than this percentage of the display smallest
     * width, it will not be allowed to be shown in multi windowing modes.
     * The value should be between [0 - 1].
     */
    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<>();

@@ -787,8 +830,16 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        final boolean forceRtl = Settings.Global.getInt(resolver, DEVELOPMENT_FORCE_RTL, 0) != 0;
        final boolean forceResizable = Settings.Global.getInt(
                resolver, DEVELOPMENT_FORCE_RESIZABLE_ACTIVITIES, 0) != 0;
        final boolean supportsNonResizableMultiWindow = Settings.Global.getInt(
        final boolean devEnableNonResizableMultiWindow = Settings.Global.getInt(
                resolver, DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW, 1) != 0;
        final int supportsNonResizableMultiWindow = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_supportsNonResizableMultiWindow);
        final int respectsActivityMinWidthHeightMultiWindow = mContext.getResources().getInteger(
                com.android.internal.R.integer.config_respectsActivityMinWidthHeightMultiWindow);
        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);
@@ -802,7 +853,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {

        synchronized (mGlobalLock) {
            mForceResizableActivities = forceResizable;
            mDevEnableNonResizableMultiWindow = devEnableNonResizableMultiWindow;
            mSupportsNonResizableMultiWindow = supportsNonResizableMultiWindow;
            mRespectsActivityMinWidthHeightMultiWindow = respectsActivityMinWidthHeightMultiWindow;
            mMinPercentageMultiWindowSupportWidth = minPercentageMultiWindowSupportWidth;
            mLargeScreenSmallestScreenWidthDp = largeScreenSmallestScreenWidthDp;
            final boolean multiWindowFormEnabled = freeformWindowManagement
                    || supportsSplitScreenMultiWindow
                    || supportsPictureInPicture
+19 −1
Original line number Diff line number Diff line
@@ -1994,7 +1994,25 @@ class Task extends WindowContainer<WindowContainer> {

    boolean supportsMultiWindow() {
        return mAtmService.mSupportsMultiWindow
                && (isResizeable() || mAtmService.mSupportsNonResizableMultiWindow);
                && (isResizeable() || mAtmService.mDevEnableNonResizableMultiWindow);
    }

    // TODO(b/176061101) replace supportsMultiWindow() after fixing tests.
    boolean supportsMultiWindow2() {
        if (!mAtmService.mSupportsMultiWindow) {
            return false;
        }
        final TaskDisplayArea tda = getDisplayArea();
        if (tda == null) {
            return false;
        }

        if (!isResizeable() && !tda.supportsNonResizableMultiWindow()) {
            // Not support non-resizable in multi window.
            return false;
        }

        return tda.supportsActivityMinWidthHeightMultiWindow(mMinWidth, mMinHeight);
    }

    /**
Loading