OSDN Git Service

Merge "Revert commits related to wallpaper cropping" into nyc-dev
authorChong Zhang <chz@google.com>
Fri, 27 May 2016 21:08:40 +0000 (21:08 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 27 May 2016 21:08:41 +0000 (21:08 +0000)
1  2 
services/core/java/com/android/server/wm/WindowStateAnimator.java

@@@ -23,7 -23,6 +23,6 @@@ import static android.view.WindowManage
  import static android.view.WindowManager.LayoutParams.FLAG_SCALED;
  import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
  import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD;
- import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER;
  import static com.android.server.wm.AppWindowAnimator.sDummyAnimation;
  import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_FREEFORM;
  import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ADD_REMOVE;
@@@ -1328,33 -1327,6 +1327,6 @@@ class WindowStateAnimator 
              return;
          }
  
-         // We crop wallpaper windows to the stack bounds of their current target to avoid them
-         // showing behind transparent windows in other stacks in split-screen mode.
-         if (w.getBaseType() == TYPE_WALLPAPER) {
-             final WindowState wallpaperTarget = mWallpaperControllerLocked.getWallpaperTarget();
-             if (wallpaperTarget != null) {
-                 final Task task = wallpaperTarget.getTask();
-                 final WindowStateAnimator winAnimator = wallpaperTarget.mWinAnimator;
-                 // We can only crop the wallpaper using final crop with stack bounds if the target
-                 // is not animating, or if it's animating with clip mode STACK_CLIP_AFTER_ANIM.
-                 // If it's animating with mode STACK_CLIP_NONE, we shouldn't crop either the task
-                 // itself or the wallpaper. If it's animating with STACK_CLIP_BEFORE_ANIM, the crop
-                 // is before the transform on the task itself.
-                 final boolean useFinalCropOnWallpaper = !winAnimator.isAnimationSet()
-                         || winAnimator.resolveStackClip() == STACK_CLIP_AFTER_ANIM;
-                 if (task != null && !task.isFullscreen()
-                         && task.cropWindowsToStackBounds()
-                         && useFinalCropOnWallpaper){
-                     final TaskStack stack = task.mStack;
-                     if (stack != null && !stack.isFullscreen()) {
-                         stack.getDimBounds(mTmpStackBounds);
-                         finalClipRect.set(mTmpStackBounds);
-                     }
-                 }
-             }
-             return;
-         }
          final Task task = w.getTask();
          if (task == null || !task.cropWindowsToStackBounds()) {
              return;
          float extraHScale = (float) 1.0;
          float extraVScale = (float) 1.0;
  
 -        mSurfaceResized = mSurfaceController.setSizeInTransaction(
 -                mTmpSize.width(), mTmpSize.height(), recoveringMemory);
 +        // Once relayout has been called at least once, we need to make sure
 +        // we only resize the client surface during calls to relayout. For
 +        // clients which use indeterminate measure specs (MATCH_PARENT),
 +        // we may try and change their window size without a call to relayout.
 +        // However, this would be unsafe, as the client may be in the middle
 +        // of producing a frame at the old size, having just completed layout
 +        // to find the surface size changed underneath it.
 +        //
 +        // TODO: For N we only apply this fix to the pinned workspace. As we
 +        // aren't observing known issues here outside of PiP resizing. (Typically
 +        // the other windows that use -1 are PopupWindows which aren't likely
 +        // to be rendering while we resize).
 +        if (!w.inPinnedWorkspace() || (!w.mRelayoutCalled || w.mInRelayout)) {
 +            mSurfaceResized = mSurfaceController.setSizeInTransaction(
 +                    mTmpSize.width(), mTmpSize.height(), recoveringMemory);
 +        } else {
 +            mSurfaceResized = false;
 +        }
          mForceScaleUntilResize = mForceScaleUntilResize && !mSurfaceResized;
  
  
          if ((task != null && task.mStack.getForceScaleToCrop()) || mForceScaleUntilResize) {
              int hInsets = w.getAttrs().surfaceInsets.left + w.getAttrs().surfaceInsets.right;
              int vInsets = w.getAttrs().surfaceInsets.top + w.getAttrs().surfaceInsets.bottom;
 +            float surfaceWidth = mSurfaceController.getWidth();
 +            float surfaceHeight = mSurfaceController.getHeight();
              // We want to calculate the scaling based on the content area, not based on
              // the entire surface, so that we scale in sync with windows that don't have insets.
 -            extraHScale = (mTmpClipRect.width() - hInsets) / (float)(mTmpSize.width() - hInsets);
 -            extraVScale = (mTmpClipRect.height() - vInsets) / (float)(mTmpSize.height() - vInsets);
 +            extraHScale = (mTmpClipRect.width() - hInsets) / (float)(surfaceWidth - hInsets);
 +            extraVScale = (mTmpClipRect.height() - vInsets) / (float)(surfaceHeight - vInsets);
  
              // In the case of ForceScaleToCrop we scale entire tasks together,
              // and so we need to scale our offsets relative to the task bounds
              // Since we are scaled to fit in our previously desired crop, we can now
              // expose the whole window in buffer space, and not risk extending
              // past where the system would have cropped us
 -            mTmpClipRect.set(0, 0, mTmpSize.width(), mTmpSize.height());
 +            mTmpClipRect.set(0, 0, (int)surfaceWidth, (int)surfaceHeight);
              mTmpFinalClipRect.setEmpty();
  
              // Various surfaces in the scaled stack may resize at different times.
              // We need to ensure for each surface, that we disable transformation matrix
              // scaling in the same transaction which we resize the surface in.
              // As we are in SCALING_MODE_SCALE_TO_WINDOW, SurfaceFlinger will
-             // then take over the scaling until the new buffer arrives, and things
+             // then take over the scaling until the new buffer arrives, and things 
              // will be seamless.
              mForceScaleUntilResize = true;
          } else {