Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +9 −11 Original line number Diff line number Diff line Loading @@ -184,7 +184,6 @@ public final class ActivityStackSupervisor implements DisplayListener { static final int CONTAINER_CALLBACK_TASK_LIST_EMPTY = FIRST_SUPERVISOR_STACK_MSG + 11; static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12; static final int SHOW_LOCK_TASK_ESCAPE_MESSAGE_MSG = FIRST_SUPERVISOR_STACK_MSG + 13; static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = FIRST_SUPERVISOR_STACK_MSG + 14; private static final String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay"; Loading Loading @@ -2592,6 +2591,11 @@ public final class ActivityStackSupervisor implements DisplayListener { mService.setFocusedActivityLocked(r, "startedActivity"); } updateUserStackLocked(r.userId, targetStack); if (!r.task.mResizeable && isStackDockedInEffect(targetStack.mStackId)) { showNonResizeableDockToast(r.task.taskId); } return ActivityManager.START_SUCCESS; } Loading Loading @@ -3397,7 +3401,7 @@ public final class ActivityStackSupervisor implements DisplayListener { resumeTopActivitiesLocked(); if (!task.mResizeable && isStackDockedInEffect(stackId)) { showNonResizeableDockToast(); showNonResizeableDockToast(taskId); } } Loading Loading @@ -4331,8 +4335,8 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void showNonResizeableDockToast() { mHandler.sendEmptyMessage(SHOW_NON_RESIZEABLE_DOCK_TOAST); private void showNonResizeableDockToast(int taskId) { mWindowManager.scheduleShowNonResizeableDockToast(taskId); } void showLockTaskToast() { Loading Loading @@ -4647,13 +4651,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } } break; case SHOW_NON_RESIZEABLE_DOCK_TOAST: { final Toast toast = Toast.makeText( mService.mContext, mService.mContext.getString(R.string.dock_non_resizeble_text), Toast.LENGTH_LONG); toast.show(); } break; } } } Loading services/core/java/com/android/server/wm/Task.java +45 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,11 @@ import static com.android.server.wm.WindowManagerService.TAG; import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK; import static com.android.server.wm.WindowManagerService.H.SHOW_NON_RESIZEABLE_DOCK_TOAST; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.DOCKED_TOP; import android.app.ActivityManager.StackId; import android.content.res.Configuration; Loading Loading @@ -76,6 +81,11 @@ class Task implements DimLayer.DimLayerUser { // Whether the task is resizeable private boolean mResizeable; // Whether we need to show toast about the app being non-resizeable when it becomes visible. // This flag is set when a non-resizeable task is docked (or side-by-side). It's cleared // after we show the toast. private boolean mShowNonResizeableDockToast; // Whether the task is currently being drag-resized private boolean mDragResizing; Loading @@ -92,6 +102,41 @@ class Task implements DimLayer.DimLayerUser { return mStack.getDisplayContent(); } void setShowNonResizeableDockToast() { mShowNonResizeableDockToast = true; } void scheduleShowNonResizeableDockToastIfNeeded() { if (!mShowNonResizeableDockToast) { return; } final DisplayContent displayContent = mStack.getDisplayContent(); // If docked stack is not yet visible, we don't want to show the toast yet, // since we need the visible rect of the docked task to position the toast. if (displayContent == null || displayContent.getDockedStackLocked() == null) { return; } mShowNonResizeableDockToast = false; final int dockSide = mStack.getDockSide(); int xOffset = 0; int yOffset = 0; if (dockSide != DOCKED_INVALID) { mStack.getBounds(mTmpRect); displayContent.getLogicalDisplayRect(mTmpRect2); if (dockSide == DOCKED_LEFT || dockSide == DOCKED_RIGHT) { xOffset = mTmpRect.centerX() - mTmpRect2.centerX(); } else if (dockSide == DOCKED_TOP) { // We don't adjust for DOCKED_BOTTOM case since it's already at the bottom. yOffset = mTmpRect2.bottom - mTmpRect.bottom; } mService.mH.obtainMessage( SHOW_NON_RESIZEABLE_DOCK_TOAST, xOffset, yOffset).sendToTarget(); } } void addAppToken(int addPos, AppWindowToken wtoken) { final int lastPos = mAppTokens.size(); if (addPos >= lastPos) { Loading services/core/java/com/android/server/wm/TaskStack.java +3 −2 Original line number Diff line number Diff line Loading @@ -658,10 +658,11 @@ public class TaskStack implements DimLayer.DimLayerUser { } /** * For docked workspace provides information which side of the screen was the dock anchored. * For docked workspace (or workspace that's side-by-side to the docked), provides * information which side of the screen was the dock anchored. */ int getDockSide() { if (mStackId != DOCKED_STACK_ID) { if (mStackId != DOCKED_STACK_ID && !StackId.isResizeableByDockedStack(mStackId)) { return DOCKED_INVALID; } if (mDisplayContent == null) { Loading services/core/java/com/android/server/wm/WindowManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -150,8 +150,10 @@ import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy; import android.view.WindowManagerPolicy.PointerEventListener; import android.view.animation.Animation; import android.widget.Toast; import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.R; import com.android.internal.util.FastPrintWriter; import com.android.internal.view.IInputContext; import com.android.internal.view.IInputMethodClient; Loading Loading @@ -4787,6 +4789,17 @@ public class WindowManagerService extends IWindowManager.Stub } } public void scheduleShowNonResizeableDockToast(int taskId) { synchronized (mWindowMap) { Task task = mTaskIdToTask.get(taskId); if (task == null) { if (DEBUG_STACK) Slog.i(TAG, "scheduleShowToast: could not find taskId=" + taskId); return; } task.setShowNonResizeableDockToast(); } } public void getStackBounds(int stackId, Rect bounds) { synchronized (mWindowMap) { final TaskStack stack = mStackIdToStack.get(stackId); Loading Loading @@ -7452,6 +7465,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int RESIZE_TASK = 44; public static final int TWO_FINGER_SCROLL_START = 45; public static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = 46; /** * Used to denote that an integer field in a message will not be used. Loading Loading @@ -8024,6 +8038,17 @@ public class WindowManagerService extends IWindowManager.Stub } } break; case SHOW_NON_RESIZEABLE_DOCK_TOAST: { final Toast toast = Toast.makeText(mContext, mContext.getString(R.string.dock_non_resizeble_text), Toast.LENGTH_LONG); final int gravity = toast.getGravity(); final int xOffset = toast.getXOffset() + msg.arg1; final int yOffset = toast.getYOffset() + msg.arg2; toast.setGravity(gravity, xOffset, yOffset); toast.show(); } break; } if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +5 −0 Original line number Diff line number Diff line Loading @@ -1474,6 +1474,11 @@ class WindowStateAnimator { } mWin.mAppToken.updateReportedVisibilityLocked(); } final Task task = mWin.getTask(); if (task != null) { task.scheduleShowNonResizeableDockToastIfNeeded(); } return true; } return false; Loading Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +9 −11 Original line number Diff line number Diff line Loading @@ -184,7 +184,6 @@ public final class ActivityStackSupervisor implements DisplayListener { static final int CONTAINER_CALLBACK_TASK_LIST_EMPTY = FIRST_SUPERVISOR_STACK_MSG + 11; static final int LAUNCH_TASK_BEHIND_COMPLETE = FIRST_SUPERVISOR_STACK_MSG + 12; static final int SHOW_LOCK_TASK_ESCAPE_MESSAGE_MSG = FIRST_SUPERVISOR_STACK_MSG + 13; static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = FIRST_SUPERVISOR_STACK_MSG + 14; private static final String VIRTUAL_DISPLAY_BASE_NAME = "ActivityViewVirtualDisplay"; Loading Loading @@ -2592,6 +2591,11 @@ public final class ActivityStackSupervisor implements DisplayListener { mService.setFocusedActivityLocked(r, "startedActivity"); } updateUserStackLocked(r.userId, targetStack); if (!r.task.mResizeable && isStackDockedInEffect(targetStack.mStackId)) { showNonResizeableDockToast(r.task.taskId); } return ActivityManager.START_SUCCESS; } Loading Loading @@ -3397,7 +3401,7 @@ public final class ActivityStackSupervisor implements DisplayListener { resumeTopActivitiesLocked(); if (!task.mResizeable && isStackDockedInEffect(stackId)) { showNonResizeableDockToast(); showNonResizeableDockToast(taskId); } } Loading Loading @@ -4331,8 +4335,8 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void showNonResizeableDockToast() { mHandler.sendEmptyMessage(SHOW_NON_RESIZEABLE_DOCK_TOAST); private void showNonResizeableDockToast(int taskId) { mWindowManager.scheduleShowNonResizeableDockToast(taskId); } void showLockTaskToast() { Loading Loading @@ -4647,13 +4651,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } } break; case SHOW_NON_RESIZEABLE_DOCK_TOAST: { final Toast toast = Toast.makeText( mService.mContext, mService.mContext.getString(R.string.dock_non_resizeble_text), Toast.LENGTH_LONG); toast.show(); } break; } } } Loading
services/core/java/com/android/server/wm/Task.java +45 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,11 @@ import static com.android.server.wm.WindowManagerService.TAG; import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK; import static com.android.server.wm.WindowManagerService.H.SHOW_NON_RESIZEABLE_DOCK_TOAST; import static android.view.WindowManager.DOCKED_INVALID; import static android.view.WindowManager.DOCKED_LEFT; import static android.view.WindowManager.DOCKED_RIGHT; import static android.view.WindowManager.DOCKED_TOP; import android.app.ActivityManager.StackId; import android.content.res.Configuration; Loading Loading @@ -76,6 +81,11 @@ class Task implements DimLayer.DimLayerUser { // Whether the task is resizeable private boolean mResizeable; // Whether we need to show toast about the app being non-resizeable when it becomes visible. // This flag is set when a non-resizeable task is docked (or side-by-side). It's cleared // after we show the toast. private boolean mShowNonResizeableDockToast; // Whether the task is currently being drag-resized private boolean mDragResizing; Loading @@ -92,6 +102,41 @@ class Task implements DimLayer.DimLayerUser { return mStack.getDisplayContent(); } void setShowNonResizeableDockToast() { mShowNonResizeableDockToast = true; } void scheduleShowNonResizeableDockToastIfNeeded() { if (!mShowNonResizeableDockToast) { return; } final DisplayContent displayContent = mStack.getDisplayContent(); // If docked stack is not yet visible, we don't want to show the toast yet, // since we need the visible rect of the docked task to position the toast. if (displayContent == null || displayContent.getDockedStackLocked() == null) { return; } mShowNonResizeableDockToast = false; final int dockSide = mStack.getDockSide(); int xOffset = 0; int yOffset = 0; if (dockSide != DOCKED_INVALID) { mStack.getBounds(mTmpRect); displayContent.getLogicalDisplayRect(mTmpRect2); if (dockSide == DOCKED_LEFT || dockSide == DOCKED_RIGHT) { xOffset = mTmpRect.centerX() - mTmpRect2.centerX(); } else if (dockSide == DOCKED_TOP) { // We don't adjust for DOCKED_BOTTOM case since it's already at the bottom. yOffset = mTmpRect2.bottom - mTmpRect.bottom; } mService.mH.obtainMessage( SHOW_NON_RESIZEABLE_DOCK_TOAST, xOffset, yOffset).sendToTarget(); } } void addAppToken(int addPos, AppWindowToken wtoken) { final int lastPos = mAppTokens.size(); if (addPos >= lastPos) { Loading
services/core/java/com/android/server/wm/TaskStack.java +3 −2 Original line number Diff line number Diff line Loading @@ -658,10 +658,11 @@ public class TaskStack implements DimLayer.DimLayerUser { } /** * For docked workspace provides information which side of the screen was the dock anchored. * For docked workspace (or workspace that's side-by-side to the docked), provides * information which side of the screen was the dock anchored. */ int getDockSide() { if (mStackId != DOCKED_STACK_ID) { if (mStackId != DOCKED_STACK_ID && !StackId.isResizeableByDockedStack(mStackId)) { return DOCKED_INVALID; } if (mDisplayContent == null) { Loading
services/core/java/com/android/server/wm/WindowManagerService.java +25 −0 Original line number Diff line number Diff line Loading @@ -150,8 +150,10 @@ import android.view.WindowManagerInternal; import android.view.WindowManagerPolicy; import android.view.WindowManagerPolicy.PointerEventListener; import android.view.animation.Animation; import android.widget.Toast; import com.android.internal.app.IAssistScreenshotReceiver; import com.android.internal.R; import com.android.internal.util.FastPrintWriter; import com.android.internal.view.IInputContext; import com.android.internal.view.IInputMethodClient; Loading Loading @@ -4787,6 +4789,17 @@ public class WindowManagerService extends IWindowManager.Stub } } public void scheduleShowNonResizeableDockToast(int taskId) { synchronized (mWindowMap) { Task task = mTaskIdToTask.get(taskId); if (task == null) { if (DEBUG_STACK) Slog.i(TAG, "scheduleShowToast: could not find taskId=" + taskId); return; } task.setShowNonResizeableDockToast(); } } public void getStackBounds(int stackId, Rect bounds) { synchronized (mWindowMap) { final TaskStack stack = mStackIdToStack.get(stackId); Loading Loading @@ -7452,6 +7465,7 @@ public class WindowManagerService extends IWindowManager.Stub public static final int RESIZE_TASK = 44; public static final int TWO_FINGER_SCROLL_START = 45; public static final int SHOW_NON_RESIZEABLE_DOCK_TOAST = 46; /** * Used to denote that an integer field in a message will not be used. Loading Loading @@ -8024,6 +8038,17 @@ public class WindowManagerService extends IWindowManager.Stub } } break; case SHOW_NON_RESIZEABLE_DOCK_TOAST: { final Toast toast = Toast.makeText(mContext, mContext.getString(R.string.dock_non_resizeble_text), Toast.LENGTH_LONG); final int gravity = toast.getGravity(); final int xOffset = toast.getXOffset() + msg.arg1; final int yOffset = toast.getYOffset() + msg.arg2; toast.setGravity(gravity, xOffset, yOffset); toast.show(); } break; } if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +5 −0 Original line number Diff line number Diff line Loading @@ -1474,6 +1474,11 @@ class WindowStateAnimator { } mWin.mAppToken.updateReportedVisibilityLocked(); } final Task task = mWin.getTask(); if (task != null) { task.scheduleShowNonResizeableDockToastIfNeeded(); } return true; } return false; Loading