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

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

Show toast if app was forced to be resizable

Bug: 27327287
Change-Id: Iaf33f0ba27a6bfb240068b9cf21732b0870f4429
parent 648b9529
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4014,8 +4014,8 @@
    <string name="lock_to_app_unlock_password">Ask for password before unpinning</string>

    <!-- Multi-Window strings -->
    <!-- Warning message when a non-resizeble tasks is docked whose display windows are cropped. -->
    <string name="dock_cropped_windows_text">App is not resizeable, scroll it with two fingers.</string>
    <!-- Warning message when an app that got forced to be resizable gets shown in split-screen -->
    <string name="dock_forced_resizable">App may not work with split-screen.</string>
    <!-- Warning message when we try to dock a non-resizeble tasks and launch it in fullscreen instead. -->
    <string name="dock_non_resizeble_failed_to_dock_text">App does not support split-screen.</string>

+1 −1
Original line number Diff line number Diff line
@@ -609,7 +609,7 @@
  <java-symbol type="string" name="display_manager_overlay_display_name" />
  <java-symbol type="string" name="display_manager_overlay_display_secure_suffix" />
  <java-symbol type="string" name="display_manager_overlay_display_title" />
  <java-symbol type="string" name="dock_cropped_windows_text" />
  <java-symbol type="string" name="dock_forced_resizable" />
  <java-symbol type="string" name="dock_non_resizeble_failed_to_dock_text" />
  <java-symbol type="string" name="double_tap_toast" />
  <java-symbol type="string" name="durationDays" />
+3 −2
Original line number Diff line number Diff line
@@ -119,6 +119,7 @@ import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.pm.ActivityInfo.FLAG_SHOW_FOR_ALL_USERS;
import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.Trace.TRACE_TAG_ACTIVITY_MANAGER;
@@ -3252,9 +3253,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
            return;
        }

        if (!task.canGoInDockedStack() || task.inCropWindowsResizeMode()) {
        if (!task.canGoInDockedStack() || task.mResizeMode == RESIZE_MODE_FORCE_RESIZEABLE) {
            // Display warning toast if we tried to put a non-dockable task in the docked stack or
            // the task is running in cropped window mode.
            // the task was forced to be resizable by the system.
            mWindowManager.scheduleShowNonResizeableDockToast(task.taskId);
        }
    }
+3 −8
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_UNRESIZEABLE;
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION;
@@ -134,12 +135,6 @@ class Task implements DimLayer.DimLayerUser {

        mShowNonResizeableDockToast = false;

        if (isResizeable()) {
            Slog.wtf(TAG,
                    "Trying to show non-resizeable toast when task is resizeable task=" + this);
            return;
        }

        if (mResizeMode == RESIZE_MODE_UNRESIZEABLE) {
            final String text =
                    mService.mContext.getString(R.string.dock_non_resizeble_failed_to_dock_text);
@@ -148,7 +143,7 @@ class Task implements DimLayer.DimLayerUser {
        }

        final int dockSide = mStack.getDockSide();
        if (!inCropWindowsResizeMode() || dockSide == DOCKED_INVALID) {
        if (mResizeMode != RESIZE_MODE_FORCE_RESIZEABLE || dockSide == DOCKED_INVALID) {
            return;
        }

@@ -176,7 +171,7 @@ class Task implements DimLayer.DimLayerUser {
            yOffset = mTmpRect2.bottom - mTmpRect.bottom;
        }
        final String text =
                mService.mContext.getString(R.string.dock_cropped_windows_text);
                mService.mContext.getString(R.string.dock_forced_resizable);
        mService.mH.obtainMessage(SHOW_NON_RESIZEABLE_DOCK_TOAST,
                xOffset, yOffset, text).sendToTarget();
    }
+1 −1
Original line number Diff line number Diff line
@@ -8189,7 +8189,7 @@ public class WindowManagerService extends IWindowManager.Stub
                break;
                case SHOW_NON_RESIZEABLE_DOCK_TOAST: {
                    final Toast toast = Toast.makeText(
                            mContext, (String) msg.obj, Toast.LENGTH_LONG);
                            mContext, (String) msg.obj, Toast.LENGTH_SHORT);
                    final int gravity = toast.getGravity();
                    final int xOffset = toast.getXOffset() + msg.arg1;
                    final int yOffset = toast.getYOffset() + msg.arg2;