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

Commit cd13d33e authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Show forced resizable based on top activity

Also don't show it for noDisplay activities.

Bug: 28223489
Change-Id: Idb555b019b5cebdcf16a0cfaa19d64263874735f
parent c875ae74
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_SWITCH;
@@ -822,6 +823,11 @@ final class ActivityRecord {
        return !isHomeActivity() && (isResizeable() || service.mForceResizableActivities);
    }

    boolean isNonResizableOrForced() {
        return !isHomeActivity() && info.resizeMode != RESIZE_MODE_RESIZEABLE
                && info.resizeMode != RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
    }

    boolean supportsPictureInPicture() {
        return !isHomeActivity() && info.resizeMode == RESIZE_MODE_RESIZEABLE_AND_PIPABLE;
    }
+4 −3
Original line number Diff line number Diff line
@@ -3508,6 +3508,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
            return;
        }

        final ActivityRecord topActivity = task.getTopActivity();
        if (!task.canGoInDockedStack() || forceNonResizable) {
            // Display a warning toast that we tried to put a non-dockable task in the docked stack.
            mService.mHandler.sendEmptyMessage(NOTIFY_ACTIVITY_DISMISSING_DOCKED_STACK_MSG);
@@ -3515,9 +3516,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
            // Dismiss docked stack. If task appeared to be in docked stack but is not resizable -
            // we need to move it to top of fullscreen stack, otherwise it will be covered.
            moveTasksToFullscreenStackLocked(DOCKED_STACK_ID, actualStackId == DOCKED_STACK_ID);
        } else if (task.mResizeMode == RESIZE_MODE_FORCE_RESIZEABLE) {
            String packageName = task.getTopActivity() != null
                    ? task.getTopActivity().appInfo.packageName : null;
        } else if (topActivity != null && topActivity.isNonResizableOrForced()
                && !topActivity.noDisplay) {
            String packageName = topActivity.appInfo.packageName;
            mService.mHandler.obtainMessage(NOTIFY_FORCED_RESIZABLE_MSG, task.taskId, 0,
                    packageName).sendToTarget();
        }