Loading core/java/android/app/ActivityManager.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -476,20 +476,28 @@ public class ActivityManager { */ */ public static final int RESIZE_MODE_SYSTEM = 0; public static final int RESIZE_MODE_SYSTEM = 0; /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize is from the window manager (instead of the user) due to a screen * rotation change. * @hide */ public static final int RESIZE_MODE_SYSTEM_SCREEN_ROTATION = 1; /** /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize is initiated by the user (most likely via a drag action on the * that the resize is initiated by the user (most likely via a drag action on the * window's edge or corner). * window's edge or corner). * @hide * @hide */ */ public static final int RESIZE_MODE_USER = 1; public static final int RESIZE_MODE_USER = 2; /** /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize should be performed even if the bounds appears unchanged. * that the resize should be performed even if the bounds appears unchanged. * @hide * @hide */ */ public static final int RESIZE_MODE_FORCED = 2; public static final int RESIZE_MODE_FORCED = 3; /** @hide */ /** @hide */ public int getFrontActivityScreenCompatMode() { public int getFrontActivityScreenCompatMode() { Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +3 −18 Original line number Original line Diff line number Diff line Loading @@ -3110,8 +3110,9 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityRecord r = task.topRunningActivityLocked(null); ActivityRecord r = task.topRunningActivityLocked(null); if (r != null) { if (r != null) { final ActivityStack stack = task.stack; final ActivityStack stack = task.stack; final boolean resizedByUser = resizeMode == RESIZE_MODE_USER; final boolean preserveWindow = !changedStacks && final boolean preserveWindow = resizedByUser && !changedStacks; (resizeMode == RESIZE_MODE_USER || resizeMode == RESIZE_MODE_SYSTEM_SCREEN_ROTATION); kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); // All other activities must be made visible with their correct configuration. // All other activities must be made visible with their correct configuration. ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); Loading Loading @@ -4626,16 +4627,6 @@ public final class ActivityStackSupervisor implements DisplayListener { return mActivityDisplay != null; return mActivityDisplay != null; } } void getBounds(Point outBounds) { synchronized (mService) { if (mActivityDisplay != null) { mActivityDisplay.getBounds(outBounds); } else { outBounds.set(0, 0); } } } // TODO: Make sure every change to ActivityRecord.visible results in a call to this. // TODO: Make sure every change to ActivityRecord.visible results in a call to this. void setVisible(boolean visible) { void setVisible(boolean visible) { if (mVisible != visible) { if (mVisible != visible) { Loading Loading @@ -4807,12 +4798,6 @@ public final class ActivityStackSupervisor implements DisplayListener { mStacks.remove(stack); mStacks.remove(stack); } } void getBounds(Point bounds) { mDisplay.getDisplayInfo(mDisplayInfo); bounds.x = mDisplayInfo.appWidth; bounds.y = mDisplayInfo.appHeight; } void setVisibleBehindActivity(ActivityRecord r) { void setVisibleBehindActivity(ActivityRecord r) { mVisibleBehindActivity = r; mVisibleBehindActivity = r; } } Loading services/core/java/com/android/server/wm/Task.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.server.wm; package com.android.server.wm; import static android.app.ActivityManager.DOCKED_STACK_ID; import static android.app.ActivityManager.DOCKED_STACK_ID; import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION; import static com.android.server.wm.WindowManagerService.TAG; 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_RESIZE; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK; import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID; import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID; import android.content.res.Configuration; import android.content.res.Configuration; Loading Loading @@ -274,7 +276,13 @@ class Task implements DimLayer.DimLayerUser { // this happens, so update the task bounds so it stays in the same place. // this happens, so update the task bounds so it stays in the same place. mTmpRect2.set(mBounds); mTmpRect2.set(mBounds); displayContent.rotateBounds(mRotation, newRotation, mTmpRect2); displayContent.rotateBounds(mRotation, newRotation, mTmpRect2); setBounds(mTmpRect2, mOverrideConfig); if (setBounds(mTmpRect2, mOverrideConfig) != BOUNDS_CHANGE_NONE) { // Post message to inform activity manager of the bounds change simulating // a one-way call. We do this to prevent a deadlock between window manager // lock and activity manager lock been held. mService.mH.sendMessage(mService.mH.obtainMessage( RESIZE_TASK, mTaskId, RESIZE_MODE_SYSTEM_SCREEN_ROTATION, mBounds)); } } } /** Updates the dim layer bounds, recreating it if needed. */ /** Updates the dim layer bounds, recreating it if needed. */ Loading services/core/java/com/android/server/wm/TaskStack.java +11 −4 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.app.ActivityManager.*; import static android.app.ActivityManager.*; import static com.android.server.wm.WindowManagerService.DEBUG_TASK_MOVEMENT; import static com.android.server.wm.WindowManagerService.DEBUG_TASK_MOVEMENT; import static com.android.server.wm.WindowManagerService.H.RESIZE_STACK; import static com.android.server.wm.WindowManagerService.TAG; import static com.android.server.wm.WindowManagerService.TAG; import android.annotation.IntDef; import android.annotation.IntDef; Loading Loading @@ -187,6 +188,9 @@ public class TaskStack implements DimLayer.DimLayerUser { void updateDisplayInfo(Rect bounds) { void updateDisplayInfo(Rect bounds) { if (mDisplayContent != null) { if (mDisplayContent != null) { for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) { mTasks.get(taskNdx).updateDisplayInfo(mDisplayContent); } if (bounds != null) { if (bounds != null) { setBounds(bounds); setBounds(bounds); } else if (mFullscreen) { } else if (mFullscreen) { Loading @@ -195,10 +199,13 @@ public class TaskStack implements DimLayer.DimLayerUser { TmpRect2.set(mBounds); TmpRect2.set(mBounds); mDisplayContent.rotateBounds( mDisplayContent.rotateBounds( mRotation, mDisplayContent.getDisplayInfo().rotation, TmpRect2); mRotation, mDisplayContent.getDisplayInfo().rotation, TmpRect2); setBounds(TmpRect2); if (setBounds(TmpRect2)) { // Post message to inform activity manager of the bounds change simulating // a one-way call. We do this to prevent a deadlock between window manager // lock and activity manager lock been held. mService.mH.sendMessage( mService.mH.obtainMessage(RESIZE_STACK, mStackId, -1, mBounds)); } } for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) { mTasks.get(taskNdx).updateDisplayInfo(mDisplayContent); } } } } } } Loading services/core/java/com/android/server/wm/WindowManagerService.java +19 −2 Original line number Original line Diff line number Diff line Loading @@ -7185,6 +7185,9 @@ public class WindowManagerService extends IWindowManager.Stub public static final int UPDATE_DOCKED_STACK_DIVIDER = 42; public static final int UPDATE_DOCKED_STACK_DIVIDER = 42; public static final int RESIZE_STACK = 43; public static final int RESIZE_TASK = 44; @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Loading Loading @@ -7731,6 +7734,22 @@ public class WindowManagerService extends IWindowManager.Stub } } } } break; break; case RESIZE_TASK: { try { mActivityManager.resizeTask(msg.arg1, (Rect) msg.obj, msg.arg2); } catch (RemoteException e) { // This will not happen since we are in the same process. } } break; case RESIZE_STACK: { try { mActivityManager.resizeStack(msg.arg1, (Rect) msg.obj); } catch (RemoteException e) { // This will not happen since we are in the same process. } } break; } } if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Slog.v(TAG, "handleMessage: exit"); Loading Loading @@ -10059,8 +10078,6 @@ public class WindowManagerService extends IWindowManager.Stub @Override @Override public void saveLastInputMethodWindowForTransition() { public void saveLastInputMethodWindowForTransition() { synchronized (mWindowMap) { synchronized (mWindowMap) { // TODO(multidisplay): Pass in the displayID. DisplayContent displayContent = getDefaultDisplayContentLocked(); if (mInputMethodWindow != null) { if (mInputMethodWindow != null) { mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget); mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget); } } Loading Loading
core/java/android/app/ActivityManager.java +10 −2 Original line number Original line Diff line number Diff line Loading @@ -476,20 +476,28 @@ public class ActivityManager { */ */ public static final int RESIZE_MODE_SYSTEM = 0; public static final int RESIZE_MODE_SYSTEM = 0; /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize is from the window manager (instead of the user) due to a screen * rotation change. * @hide */ public static final int RESIZE_MODE_SYSTEM_SCREEN_ROTATION = 1; /** /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize is initiated by the user (most likely via a drag action on the * that the resize is initiated by the user (most likely via a drag action on the * window's edge or corner). * window's edge or corner). * @hide * @hide */ */ public static final int RESIZE_MODE_USER = 1; public static final int RESIZE_MODE_USER = 2; /** /** * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * Input parameter to {@link android.app.IActivityManager#resizeTask} which indicates * that the resize should be performed even if the bounds appears unchanged. * that the resize should be performed even if the bounds appears unchanged. * @hide * @hide */ */ public static final int RESIZE_MODE_FORCED = 2; public static final int RESIZE_MODE_FORCED = 3; /** @hide */ /** @hide */ public int getFrontActivityScreenCompatMode() { public int getFrontActivityScreenCompatMode() { Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +3 −18 Original line number Original line Diff line number Diff line Loading @@ -3110,8 +3110,9 @@ public final class ActivityStackSupervisor implements DisplayListener { ActivityRecord r = task.topRunningActivityLocked(null); ActivityRecord r = task.topRunningActivityLocked(null); if (r != null) { if (r != null) { final ActivityStack stack = task.stack; final ActivityStack stack = task.stack; final boolean resizedByUser = resizeMode == RESIZE_MODE_USER; final boolean preserveWindow = !changedStacks && final boolean preserveWindow = resizedByUser && !changedStacks; (resizeMode == RESIZE_MODE_USER || resizeMode == RESIZE_MODE_SYSTEM_SCREEN_ROTATION); kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); // All other activities must be made visible with their correct configuration. // All other activities must be made visible with their correct configuration. ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); Loading Loading @@ -4626,16 +4627,6 @@ public final class ActivityStackSupervisor implements DisplayListener { return mActivityDisplay != null; return mActivityDisplay != null; } } void getBounds(Point outBounds) { synchronized (mService) { if (mActivityDisplay != null) { mActivityDisplay.getBounds(outBounds); } else { outBounds.set(0, 0); } } } // TODO: Make sure every change to ActivityRecord.visible results in a call to this. // TODO: Make sure every change to ActivityRecord.visible results in a call to this. void setVisible(boolean visible) { void setVisible(boolean visible) { if (mVisible != visible) { if (mVisible != visible) { Loading Loading @@ -4807,12 +4798,6 @@ public final class ActivityStackSupervisor implements DisplayListener { mStacks.remove(stack); mStacks.remove(stack); } } void getBounds(Point bounds) { mDisplay.getDisplayInfo(mDisplayInfo); bounds.x = mDisplayInfo.appWidth; bounds.y = mDisplayInfo.appHeight; } void setVisibleBehindActivity(ActivityRecord r) { void setVisibleBehindActivity(ActivityRecord r) { mVisibleBehindActivity = r; mVisibleBehindActivity = r; } } Loading
services/core/java/com/android/server/wm/Task.java +9 −1 Original line number Original line Diff line number Diff line Loading @@ -17,9 +17,11 @@ package com.android.server.wm; package com.android.server.wm; import static android.app.ActivityManager.DOCKED_STACK_ID; import static android.app.ActivityManager.DOCKED_STACK_ID; import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION; import static com.android.server.wm.WindowManagerService.TAG; 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_RESIZE; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.DEBUG_STACK; import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK; import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID; import static android.app.ActivityManager.FREEFORM_WORKSPACE_STACK_ID; import android.content.res.Configuration; import android.content.res.Configuration; Loading Loading @@ -274,7 +276,13 @@ class Task implements DimLayer.DimLayerUser { // this happens, so update the task bounds so it stays in the same place. // this happens, so update the task bounds so it stays in the same place. mTmpRect2.set(mBounds); mTmpRect2.set(mBounds); displayContent.rotateBounds(mRotation, newRotation, mTmpRect2); displayContent.rotateBounds(mRotation, newRotation, mTmpRect2); setBounds(mTmpRect2, mOverrideConfig); if (setBounds(mTmpRect2, mOverrideConfig) != BOUNDS_CHANGE_NONE) { // Post message to inform activity manager of the bounds change simulating // a one-way call. We do this to prevent a deadlock between window manager // lock and activity manager lock been held. mService.mH.sendMessage(mService.mH.obtainMessage( RESIZE_TASK, mTaskId, RESIZE_MODE_SYSTEM_SCREEN_ROTATION, mBounds)); } } } /** Updates the dim layer bounds, recreating it if needed. */ /** Updates the dim layer bounds, recreating it if needed. */ Loading
services/core/java/com/android/server/wm/TaskStack.java +11 −4 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.server.wm; import static android.app.ActivityManager.*; import static android.app.ActivityManager.*; import static com.android.server.wm.WindowManagerService.DEBUG_TASK_MOVEMENT; import static com.android.server.wm.WindowManagerService.DEBUG_TASK_MOVEMENT; import static com.android.server.wm.WindowManagerService.H.RESIZE_STACK; import static com.android.server.wm.WindowManagerService.TAG; import static com.android.server.wm.WindowManagerService.TAG; import android.annotation.IntDef; import android.annotation.IntDef; Loading Loading @@ -187,6 +188,9 @@ public class TaskStack implements DimLayer.DimLayerUser { void updateDisplayInfo(Rect bounds) { void updateDisplayInfo(Rect bounds) { if (mDisplayContent != null) { if (mDisplayContent != null) { for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) { mTasks.get(taskNdx).updateDisplayInfo(mDisplayContent); } if (bounds != null) { if (bounds != null) { setBounds(bounds); setBounds(bounds); } else if (mFullscreen) { } else if (mFullscreen) { Loading @@ -195,10 +199,13 @@ public class TaskStack implements DimLayer.DimLayerUser { TmpRect2.set(mBounds); TmpRect2.set(mBounds); mDisplayContent.rotateBounds( mDisplayContent.rotateBounds( mRotation, mDisplayContent.getDisplayInfo().rotation, TmpRect2); mRotation, mDisplayContent.getDisplayInfo().rotation, TmpRect2); setBounds(TmpRect2); if (setBounds(TmpRect2)) { // Post message to inform activity manager of the bounds change simulating // a one-way call. We do this to prevent a deadlock between window manager // lock and activity manager lock been held. mService.mH.sendMessage( mService.mH.obtainMessage(RESIZE_STACK, mStackId, -1, mBounds)); } } for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) { mTasks.get(taskNdx).updateDisplayInfo(mDisplayContent); } } } } } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +19 −2 Original line number Original line Diff line number Diff line Loading @@ -7185,6 +7185,9 @@ public class WindowManagerService extends IWindowManager.Stub public static final int UPDATE_DOCKED_STACK_DIVIDER = 42; public static final int UPDATE_DOCKED_STACK_DIVIDER = 42; public static final int RESIZE_STACK = 43; public static final int RESIZE_TASK = 44; @Override @Override public void handleMessage(Message msg) { public void handleMessage(Message msg) { if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Loading Loading @@ -7731,6 +7734,22 @@ public class WindowManagerService extends IWindowManager.Stub } } } } break; break; case RESIZE_TASK: { try { mActivityManager.resizeTask(msg.arg1, (Rect) msg.obj, msg.arg2); } catch (RemoteException e) { // This will not happen since we are in the same process. } } break; case RESIZE_STACK: { try { mActivityManager.resizeStack(msg.arg1, (Rect) msg.obj); } catch (RemoteException e) { // This will not happen since we are in the same process. } } break; } } if (DEBUG_WINDOW_TRACE) { if (DEBUG_WINDOW_TRACE) { Slog.v(TAG, "handleMessage: exit"); Slog.v(TAG, "handleMessage: exit"); Loading Loading @@ -10059,8 +10078,6 @@ public class WindowManagerService extends IWindowManager.Stub @Override @Override public void saveLastInputMethodWindowForTransition() { public void saveLastInputMethodWindowForTransition() { synchronized (mWindowMap) { synchronized (mWindowMap) { // TODO(multidisplay): Pass in the displayID. DisplayContent displayContent = getDefaultDisplayContentLocked(); if (mInputMethodWindow != null) { if (mInputMethodWindow != null) { mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget); mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget); } } Loading