summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/ActivityThread.java3
-rw-r--r--core/java/android/view/ViewRootImpl.java32
-rw-r--r--core/java/android/view/Window.java6
-rw-r--r--core/java/android/view/WindowManagerGlobal.java12
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java7
-rw-r--r--services/core/java/com/android/server/wm/AppWindowToken.java10
-rw-r--r--services/core/java/com/android/server/wm/TaskStack.java10
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java8
8 files changed, 73 insertions, 15 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 4e55c89fa739..2f2fbbea9b90 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -4362,6 +4362,9 @@ public final class ActivityThread {
if (!tmp.onlyLocalRequest) {
try {
ActivityManagerNative.getDefault().activityRelaunched(r.token);
+ if (r.window != null) {
+ r.window.reportActivityRelaunched();
+ }
} catch (RemoteException e) {
// If the system process has died, it's game over for everyone.
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index f8e96d6543c1..633daad8a1ff 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -144,6 +144,9 @@ public final class ViewRootImpl implements ViewParent,
*/
static final int MAX_TRACKBALL_DELAY = 250;
+ private static final int RESIZE_MODE_FREEFORM = 0;
+ private static final int RESIZE_MODE_DOCKED_DIVIDER = 1;
+
static final ThreadLocal<HandlerActionQueue> sRunQueues = new ThreadLocal<HandlerActionQueue>();
static final ArrayList<Runnable> sFirstDrawHandlers = new ArrayList();
@@ -228,8 +231,10 @@ public final class ViewRootImpl implements ViewParent,
boolean mIsAnimating;
private boolean mDragResizing;
+ private int mResizeMode;
private int mCanvasOffsetX;
private int mCanvasOffsetY;
+ private boolean mActivityRelaunched;
CompatibilityInfo.Translator mTranslator;
@@ -1592,12 +1597,17 @@ public final class ViewRootImpl implements ViewParent,
frame.width() < desiredWindowWidth && frame.width() != mWidth)
|| (lp.height == ViewGroup.LayoutParams.WRAP_CONTENT &&
frame.height() < desiredWindowHeight && frame.height() != mHeight));
- windowShouldResize |= mDragResizing;
+ windowShouldResize |= mDragResizing && mResizeMode == RESIZE_MODE_FREEFORM;
// If the backdrop frame doesn't equal to a frame, we are starting a resize operation, so
// force it to be resized.
windowShouldResize |= !mPendingBackDropFrame.equals(mWinFrame);
+ // If the activity was just relaunched, it might have unfrozen the task bounds (while
+ // relaunching), so we need to force a call into window manager to pick up the latest
+ // bounds.
+ windowShouldResize |= mActivityRelaunched;
+
// Determine whether to compute insets.
// If there are no inset listeners remaining then we may still need to compute
// insets in case the old insets were non-empty and must be reset.
@@ -1786,11 +1796,17 @@ public final class ViewRootImpl implements ViewParent,
}
}
- final boolean dragResizing = (relayoutResult
- & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING) != 0;
+ final boolean freeformResizing = (relayoutResult
+ & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_FREEFORM) != 0;
+ final boolean dockedResizing = (relayoutResult
+ & WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
+ final boolean dragResizing = freeformResizing || dockedResizing;
if (mDragResizing != dragResizing) {
if (dragResizing) {
startDragResizing(mPendingBackDropFrame);
+ mResizeMode = freeformResizing
+ ? RESIZE_MODE_FREEFORM
+ : RESIZE_MODE_DOCKED_DIVIDER;
} else {
// We shouldn't come here, but if we come we should end the resize.
endDragResizing();
@@ -2074,6 +2090,7 @@ public final class ViewRootImpl implements ViewParent,
mFirst = false;
mWillDrawSoon = false;
mNewSurfaceNeeded = false;
+ mActivityRelaunched = false;
mViewVisibility = viewVisibility;
mHadWindowFocus = hasWindowFocus;
@@ -7026,6 +7043,15 @@ public final class ViewRootImpl implements ViewParent,
}
/**
+ * Tells this instance that its corresponding activity has just relaunched. In this case, we
+ * need to force a relayout of the window to make sure we get the correct bounds from window
+ * manager.
+ */
+ public void reportActivityRelaunched() {
+ mActivityRelaunched = true;
+ }
+
+ /**
* Class for managing the accessibility interaction connection
* based on the global accessibility state.
*/
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java
index d89369bef170..dfe0cc74670b 100644
--- a/core/java/android/view/Window.java
+++ b/core/java/android/view/Window.java
@@ -2120,4 +2120,10 @@ public abstract class Window {
* @hide
*/
public abstract void onMultiWindowModeChanged();
+
+ /**
+ * Called when the activity just relaunched.
+ * @hide
+ */
+ public abstract void reportActivityRelaunched();
}
diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java
index 8c68e922b951..1530b474c534 100644
--- a/core/java/android/view/WindowManagerGlobal.java
+++ b/core/java/android/view/WindowManagerGlobal.java
@@ -30,6 +30,7 @@ import android.util.AndroidRuntimeException;
import android.util.ArraySet;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
+
import com.android.internal.util.FastPrintWriter;
import java.io.FileDescriptor;
@@ -70,16 +71,23 @@ public final class WindowManagerGlobal {
public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4;
/**
+ * The window is being resized by dragging on the docked divider. The client should render
+ * at (0, 0) and extend its background to the background frame passed into
+ * {@link IWindow#resized}.
+ */
+ public static final int RELAYOUT_RES_DRAG_RESIZING_DOCKED = 0x8;
+
+ /**
* The window is being resized by dragging one of the window corners,
* in this case the surface would be fullscreen-sized. The client should
* render to the actual frame location (instead of (0,curScrollY)).
*/
- public static final int RELAYOUT_RES_DRAG_RESIZING = 0x8;
+ public static final int RELAYOUT_RES_DRAG_RESIZING_FREEFORM = 0x10;
/**
* The window manager has changed the size of the surface from the last call.
*/
- public static final int RELAYOUT_RES_SURFACE_RESIZED = 0x10;
+ public static final int RELAYOUT_RES_SURFACE_RESIZED = 0x20;
/**
* Flag for relayout: the client will be later giving
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index b4c4ef506f46..4670cca0f953 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -684,6 +684,13 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
+ @Override
+ public void reportActivityRelaunched() {
+ if (mDecor != null && mDecor.getViewRootImpl() != null) {
+ mDecor.getViewRootImpl().reportActivityRelaunched();
+ }
+ }
+
private static void clearMenuViews(PanelFeatureState st) {
// This can be called on config changes, so we should make sure
// the views will be reconstructed based on the new orientation, etc.
diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java
index 751f8715a1e1..4624078355db 100644
--- a/services/core/java/com/android/server/wm/AppWindowToken.java
+++ b/services/core/java/com/android/server/wm/AppWindowToken.java
@@ -67,6 +67,7 @@ class AppWindowToken extends WindowToken {
// Whether we're performing an entering animation with a saved surface.
boolean mAnimatingWithSavedSurface;
+
Task mTask;
boolean appFullscreen;
int requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -477,6 +478,15 @@ class AppWindowToken extends WindowToken {
*/
void unfreezeBounds() {
mFrozenBounds.remove();
+ for (int i = windows.size() - 1; i >= 0; i--) {
+ final WindowState win = windows.get(i);
+ win.mLayoutNeeded = true;
+ win.setDisplayLayoutNeeded();
+ if (!service.mResizingWindows.contains(win)) {
+ service.mResizingWindows.add(win);
+ }
+ }
+ service.mWindowPlacerLocked.performSurfacePlacement();
}
@Override
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 632c03376d60..7748c6a8ffb8 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -105,12 +105,6 @@ public class TaskStack implements DimLayer.DimLayerUser {
return mTasks;
}
- void resizeWindows() {
- for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) {
- mTasks.get(taskNdx).resizeWindows();
- }
- }
-
/**
* Set the bounds of the stack and its containing tasks.
* @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
@@ -137,11 +131,11 @@ public class TaskStack implements DimLayer.DimLayerUser {
// it might no longer fully cover the stack area.
// Save the old bounds and re-apply the scroll. This adjusts the bounds to
// fit the new stack bounds.
- task.setBounds(bounds, config);
+ task.resizeLocked(bounds, config, false /* forced */);
task.getBounds(mTmpRect);
task.scrollLocked(mTmpRect);
} else {
- task.setBounds(bounds, config);
+ task.resizeLocked(bounds, config, false /* forced */);
task.setTempInsetBounds(
taskTempInsetBounds != null ? taskTempInsetBounds.get(task.mTaskId)
: null);
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 7d142eca0bb4..bdaa05b2592f 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -2869,7 +2869,12 @@ public class WindowManagerService extends IWindowManager.Stub
result |= WindowManagerGlobal.RELAYOUT_RES_FIRST_TIME;
}
}
- result |= win.isDragResizing() ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING : 0;
+ final boolean freeformResizing = win.isDragResizing()
+ && win.getResizeMode() == WindowState.DRAG_RESIZE_MODE_FREEFORM;
+ final boolean dockedResizing = win.isDragResizing()
+ && win.getResizeMode() == WindowState.DRAG_RESIZE_MODE_DOCKED_DIVIDER;
+ result |= freeformResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_FREEFORM : 0;
+ result |= dockedResizing ? WindowManagerGlobal.RELAYOUT_RES_DRAG_RESIZING_DOCKED : 0;
if (win.isAnimatingWithSavedSurface()) {
// If we're animating with a saved surface now, request client to report draw.
// We still need to know when the real thing is drawn.
@@ -4858,7 +4863,6 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (stack.setBounds(bounds, configs, taskBounds, taskTempInsetBounds)
&& stack.isVisibleLocked()) {
- stack.resizeWindows();
stack.getDisplayContent().layoutNeeded = true;
mWindowPlacerLocked.performSurfacePlacement();
}