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

Commit df262f5e authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Don't send non-resizeable notification in some cases.

Don't send non-resizeable notification when putting other stacks in
the system in split-screen secondary windowing mode due to us entering
split screen mode since they won't be visible.

Also, added isVisible to containers in the window manager proto.

Change-Id: If83076514c160ad7b2a639e32d6f9fc85e70bd53
Fixes: 70355262
Test: go/wm-smoke and steps from bug.
parent 4d51f445
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -200,6 +200,7 @@ message ScreenRotationAnimationProto {
message WindowContainerProto {
message WindowContainerProto {
  optional ConfigurationContainerProto configuration_container = 1;
  optional ConfigurationContainerProto configuration_container = 1;
  optional int32 orientation = 2;
  optional int32 orientation = 2;
  optional bool visible = 3;
}
}


/* represents ConfigurationContainer */
/* represents ConfigurationContainer */
+3 −1
Original line number Original line Diff line number Diff line
@@ -433,7 +433,9 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> {
                        || !otherStack.affectedBySplitScreenResize()) {
                        || !otherStack.affectedBySplitScreenResize()) {
                    continue;
                    continue;
                }
                }
                otherStack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
                otherStack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY,
                        false /* animate */, false /* showRecents */,
                        false /* sendNonResizeableNotification */);
            }
            }
        } finally {
        } finally {
            mSupervisor.mWindowManager.continueSurfaceLayout();
            mSupervisor.mWindowManager.continueSurfaceLayout();
+2 −1
Original line number Original line Diff line number Diff line
@@ -10567,7 +10567,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                if (toTop) {
                if (toTop) {
                    stack.moveToFront("setTaskWindowingModeSplitScreenPrimary", task);
                    stack.moveToFront("setTaskWindowingModeSplitScreenPrimary", task);
                }
                }
                stack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, animate, showRecents);
                stack.setWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, animate, showRecents,
                        true /* sendNonResizeableNotification */);
                return windowingMode != task.getWindowingMode();
                return windowingMode != task.getWindowingMode();
            } finally {
            } finally {
                Binder.restoreCallingIdentity(ident);
                Binder.restoreCallingIdentity(ident);
+9 −5
Original line number Original line Diff line number Diff line
@@ -483,10 +483,12 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai


    @Override
    @Override
    public void setWindowingMode(int windowingMode) {
    public void setWindowingMode(int windowingMode) {
        setWindowingMode(windowingMode, false /* animate */, true /* showRecents */);
        setWindowingMode(windowingMode, false /* animate */, true /* showRecents */,
                true /* sendNonResizeableNotification */);
    }
    }


    void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents) {
    void setWindowingMode(int preferredWindowingMode, boolean animate, boolean showRecents,
            boolean sendNonResizeableNotification) {
        final int currentMode = getWindowingMode();
        final int currentMode = getWindowingMode();
        final ActivityDisplay display = getDisplay();
        final ActivityDisplay display = getDisplay();
        final TaskRecord topTask = topTask();
        final TaskRecord topTask = topTask();
@@ -505,7 +507,8 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        final boolean alreadyInSplitScreenMode = display.hasSplitScreenPrimaryStack();
        final boolean alreadyInSplitScreenMode = display.hasSplitScreenPrimaryStack();


        // Take any required action due to us not supporting the preferred windowing mode.
        // Take any required action due to us not supporting the preferred windowing mode.
        if (windowingMode != preferredWindowingMode && isActivityTypeStandardOrUndefined()) {
        if (sendNonResizeableNotification
                && windowingMode != preferredWindowingMode && isActivityTypeStandardOrUndefined()) {
            if (alreadyInSplitScreenMode
            if (alreadyInSplitScreenMode
                    && (preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                    && (preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
                    || preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY)) {
                    || preferredWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY)) {
@@ -524,8 +527,9 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        final WindowManagerService wm = mService.mWindowManager;
        final WindowManagerService wm = mService.mWindowManager;
        final ActivityRecord topActivity = getTopActivity();
        final ActivityRecord topActivity = getTopActivity();


        if (windowingMode != WINDOWING_MODE_FULLSCREEN && topActivity != null
        if (sendNonResizeableNotification && windowingMode != WINDOWING_MODE_FULLSCREEN
                && topActivity.isNonResizableOrForcedResizable() && !topActivity.noDisplay) {
                && topActivity != null && topActivity.isNonResizableOrForcedResizable()
                && !topActivity.noDisplay) {
            // Inform the user that they are starting an app that may not work correctly in
            // Inform the user that they are starting an app that may not work correctly in
            // multi-window mode.
            // multi-window mode.
            final String packageName = topActivity.appInfo.packageName;
            final String packageName = topActivity.appInfo.packageName;
+2 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSET;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static com.android.server.wm.proto.WindowContainerProto.CONFIGURATION_CONTAINER;
import static com.android.server.wm.proto.WindowContainerProto.CONFIGURATION_CONTAINER;
import static com.android.server.wm.proto.WindowContainerProto.ORIENTATION;
import static com.android.server.wm.proto.WindowContainerProto.ORIENTATION;
import static com.android.server.wm.proto.WindowContainerProto.VISIBLE;
import static android.view.SurfaceControl.Transaction;
import static android.view.SurfaceControl.Transaction;


import android.annotation.CallSuper;
import android.annotation.CallSuper;
@@ -809,6 +810,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        final long token = proto.start(fieldId);
        final long token = proto.start(fieldId);
        super.writeToProto(proto, CONFIGURATION_CONTAINER, trim);
        super.writeToProto(proto, CONFIGURATION_CONTAINER, trim);
        proto.write(ORIENTATION, mOrientation);
        proto.write(ORIENTATION, mOrientation);
        proto.write(VISIBLE, isVisible());
        proto.end(token);
        proto.end(token);
    }
    }