OSDN Git Service

Apply scroll to windows added to a non-resizeble task that's docked
authorChong Zhang <chz@google.com>
Tue, 12 Jan 2016 01:14:24 +0000 (17:14 -0800)
committerChong Zhang <chz@google.com>
Tue, 12 Jan 2016 01:15:40 +0000 (17:15 -0800)
bug: 26447921
Change-Id: I933e277137fb127a9e961035cf48cba2bef52042

services/core/java/com/android/server/wm/DisplayContent.java
services/core/java/com/android/server/wm/Task.java
services/core/java/com/android/server/wm/TaskStack.java
services/core/java/com/android/server/wm/WindowManagerService.java
services/core/java/com/android/server/wm/WindowState.java

index 51787b0..a9025bd 100644 (file)
@@ -393,7 +393,7 @@ class DisplayContent {
                     }
                     mTouchExcludeRegion.op(mTmpRect, Region.Op.DIFFERENCE);
                 }
-                if (task.isDockedInEffect() && !task.isResizeable()) {
+                if (task.isTwoFingerScrollMode()) {
                     stack.getBounds(mTmpRect);
                     mNonResizeableRegion.op(mTmpRect, Region.Op.UNION);
                     break;
index 47a4936..6bb3e20 100644 (file)
@@ -571,6 +571,10 @@ class Task implements DimLayer.DimLayerUser {
         return inDockedWorkspace() || isResizeableByDockedStack();
     }
 
+    boolean isTwoFingerScrollMode() {
+        return isDockedInEffect() && !isResizeable();
+    }
+
     WindowState getTopVisibleAppMainWindow() {
         final AppWindowToken token = getTopVisibleAppToken();
         return token != null ? token.findMainWindow() : null;
index fc6ad70..fb778ec 100644 (file)
@@ -126,7 +126,7 @@ public class TaskStack implements DimLayer.DimLayerUser {
             Configuration config = configs.get(task.mTaskId);
             if (config != null) {
                 Rect bounds = taskBounds.get(task.mTaskId);
-                if (!task.isResizeable() && task.isDockedInEffect()) {
+                if (task.isTwoFingerScrollMode()) {
                     // This is a non-resizeable task that's docked (or side-by-side to the docked
                     // stack). It might have been scrolled previously, and after the stack resizing,
                     // it might no longer fully cover the stack area.
index aa5cc7f..71cd660 100644 (file)
@@ -1990,6 +1990,10 @@ public class WindowManagerService extends IWindowManager.Stub
                 }
             }
 
+            // If the window is being added to a task that's docked but non-resizeable,
+            // we need to update this new window's scroll position when it's added.
+            win.applyScrollIfNeeded();
+
             if (type == TYPE_DOCK_DIVIDER) {
                 getDefaultDisplayContentLocked().getDockedDividerController().setWindow(win);
             }
index b7fd60f..058fa67 100644 (file)
@@ -1458,15 +1458,24 @@ final class WindowState implements WindowManagerPolicy.WindowState {
     }
 
     boolean inDockedWorkspace() {
-        Task task = getTask();
+        final Task task = getTask();
         return task != null && task.inDockedWorkspace();
     }
 
     boolean isDockedInEffect() {
-        Task task = getTask();
+        final Task task = getTask();
         return task != null && task.isDockedInEffect();
     }
 
+    void applyScrollIfNeeded() {
+        final Task task = getTask();
+        if (task != null && task.isTwoFingerScrollMode()) {
+            task.getDimBounds(mTmpRect);
+            mXOffset = mTmpRect.left;
+            mYOffset = mTmpRect.top;
+        }
+    }
+
     int getTouchableRegion(Region region, int flags) {
         final boolean modal = (flags & (FLAG_NOT_TOUCH_MODAL | FLAG_NOT_FOCUSABLE)) == 0;
         if (modal && mAppToken != null) {