Merge "Introduce multiple displays with DisplayContent." into jb-mr1-dev

This commit is contained in:
Craig Mautner
2012-08-02 09:20:14 -07:00
committed by Android (Google) Code Review
15 changed files with 822 additions and 479 deletions

View File

@@ -38,6 +38,7 @@ import android.os.RemoteException;
import android.os.ServiceManager; import android.os.ServiceManager;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.util.AndroidException; import android.util.AndroidException;
import android.view.Display;
import android.view.IWindowManager; import android.view.IWindowManager;
import java.io.BufferedReader; import java.io.BufferedReader;
@@ -1117,9 +1118,10 @@ public class Am {
try { try {
if (m >= 0 && n >= 0) { if (m >= 0 && n >= 0) {
wm.setForcedDisplaySize(m, n); // TODO(multidisplay): For now Configuration only applies to main screen.
wm.setForcedDisplaySize(Display.DEFAULT_DISPLAY, m, n);
} else { } else {
wm.clearForcedDisplaySize(); wm.clearForcedDisplaySize(Display.DEFAULT_DISPLAY);
} }
} catch (RemoteException e) { } catch (RemoteException e) {
} }

View File

@@ -57,8 +57,8 @@ interface IWindowManager
in IInputContext inputContext); in IInputContext inputContext);
boolean inputMethodClientHasFocus(IInputMethodClient client); boolean inputMethodClientHasFocus(IInputMethodClient client);
void setForcedDisplaySize(int longDimen, int shortDimen); void setForcedDisplaySize(int displayId, int longDimen, int shortDimen);
void clearForcedDisplaySize(); void clearForcedDisplaySize(int displayId);
// Is the device configured to have a full system bar for larger screens? // Is the device configured to have a full system bar for larger screens?
boolean hasSystemNavBar(); boolean hasSystemNavBar();
@@ -184,7 +184,7 @@ interface IWindowManager
/** /**
* Create a screenshot of the applications currently displayed. * Create a screenshot of the applications currently displayed.
*/ */
Bitmap screenshotApplications(IBinder appToken, int maxWidth, int maxHeight); Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth, int maxHeight);
/** /**
* Called by the status bar to notify Views of changes to System UI visiblity. * Called by the status bar to notify Views of changes to System UI visiblity.

View File

@@ -42,6 +42,7 @@ import android.util.DisplayMetrics;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.util.Slog; import android.util.Slog;
import android.view.Display;
import android.view.WindowManager; import android.view.WindowManager;
import com.android.internal.os.BinderInternal; import com.android.internal.os.BinderInternal;

View File

@@ -59,6 +59,7 @@ import android.os.UserId;
import android.util.EventLog; import android.util.EventLog;
import android.util.Log; import android.util.Log;
import android.util.Slog; import android.util.Slog;
import android.view.Display;
import android.view.WindowManagerPolicy; import android.view.WindowManagerPolicy;
import java.io.IOException; import java.io.IOException;
@@ -919,7 +920,8 @@ final class ActivityStack {
} }
if (w > 0) { if (w > 0) {
return mService.mWindowManager.screenshotApplications(who.appToken, w, h); return mService.mWindowManager.screenshotApplications(who.appToken,
Display.DEFAULT_DISPLAY, w, h);
} }
return null; return null;
} }

View File

@@ -24,6 +24,7 @@ import com.android.server.wm.WindowManagerService;
import android.graphics.Point; import android.graphics.Point;
import android.util.Slog; import android.util.Slog;
import android.view.Display;
/** /**
* Activity manager code dealing with processes. * Activity manager code dealing with processes.
@@ -146,7 +147,7 @@ class ProcessList {
void applyDisplaySize(WindowManagerService wm) { void applyDisplaySize(WindowManagerService wm) {
if (!mHaveDisplaySize) { if (!mHaveDisplaySize) {
Point p = new Point(); Point p = new Point();
wm.getInitialDisplaySize(p); wm.getInitialDisplaySize(Display.DEFAULT_DISPLAY, p);
if (p.x != 0 && p.y != 0) { if (p.x != 0 && p.y != 0) {
updateOomLevels(p.x, p.y, true); updateOomLevels(p.x, p.y, true);
mHaveDisplaySize = true; mHaveDisplaySize = true;

View File

@@ -87,12 +87,16 @@ public final class InputWindowHandle {
// Window input features. // Window input features.
public int inputFeatures; public int inputFeatures;
// Display this input is on.
public final int displayId;
private native void nativeDispose(); private native void nativeDispose();
public InputWindowHandle(InputApplicationHandle inputApplicationHandle, public InputWindowHandle(InputApplicationHandle inputApplicationHandle,
Object windowState) { Object windowState, int displayId) {
this.inputApplicationHandle = inputApplicationHandle; this.inputApplicationHandle = inputApplicationHandle;
this.windowState = windowState; this.windowState = windowState;
this.displayId = displayId;
} }
@Override @Override

View File

@@ -0,0 +1,103 @@
/*
* Copyright (C) 2012 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.server.wm;
import android.view.DisplayInfo;
import java.io.PrintWriter;
import java.util.ArrayList;
class DisplayContentList extends ArrayList<DisplayContent> {
}
/**
* Utility class for keeping track of the WindowStates and other pertinent contents of a
* particular Display.
*
* IMPORTANT: No method from this class should ever be used without holding
* WindowManagerService.mWindowMap.
*/
class DisplayContent {
/** Unique identifier of this stack. */
private final int mDisplayId;
/** Z-ordered (bottom-most first) list of all Window objects. Assigned to an element
* from mDisplayWindows; */
private WindowList mWindows = new WindowList();
// This protects the following display size properties, so that
// getDisplaySize() doesn't need to acquire the global lock. This is
// needed because the window manager sometimes needs to use ActivityThread
// while it has its global state locked (for example to load animation
// resources), but the ActivityThread also needs get the current display
// size sometimes when it has its package lock held.
//
// These will only be modified with both mWindowMap and mDisplaySizeLock
// held (in that order) so the window manager doesn't need to acquire this
// lock when needing these values in its normal operation.
final Object mDisplaySizeLock = new Object();
int mInitialDisplayWidth = 0;
int mInitialDisplayHeight = 0;
int mBaseDisplayWidth = 0;
int mBaseDisplayHeight = 0;
final DisplayInfo mDisplayInfo = new DisplayInfo();
DisplayContent(final int displayId) {
mDisplayId = displayId;
}
int getDisplayId() {
return mDisplayId;
}
WindowList getWindowList() {
return mWindows;
}
DisplayInfo getDisplayInfo() {
return mDisplayInfo;
}
public void dump(PrintWriter pw) {
pw.print(" Display: mDisplayId="); pw.println(mDisplayId);
pw.print(" init="); pw.print(mInitialDisplayWidth); pw.print("x");
pw.print(mInitialDisplayHeight);
if (mInitialDisplayWidth != mBaseDisplayWidth
|| mInitialDisplayHeight != mBaseDisplayHeight) {
pw.print(" base=");
pw.print(mBaseDisplayWidth); pw.print("x"); pw.print(mBaseDisplayHeight);
}
if (mInitialDisplayWidth != mDisplayInfo.logicalWidth
|| mInitialDisplayHeight != mDisplayInfo.logicalHeight) {
pw.print(" init="); pw.print(mInitialDisplayWidth);
pw.print("x"); pw.print(mInitialDisplayHeight);
}
pw.print(" cur=");
pw.print(mDisplayInfo.logicalWidth);
pw.print("x"); pw.print(mDisplayInfo.logicalHeight);
pw.print(" app=");
pw.print(mDisplayInfo.appWidth);
pw.print("x"); pw.print(mDisplayInfo.appHeight);
pw.print(" rng="); pw.print(mDisplayInfo.smallestNominalAppWidth);
pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight);
pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth);
pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight);
pw.println();
}
}

View File

@@ -29,6 +29,7 @@ import android.os.Message;
import android.os.Process; import android.os.Process;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Slog; import android.util.Slog;
import android.view.DisplayInfo;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.InputChannel; import android.view.InputChannel;
import android.view.Surface; import android.view.Surface;
@@ -58,6 +59,7 @@ class DragState {
WindowState mTargetWindow; WindowState mTargetWindow;
ArrayList<WindowState> mNotifiedWindows; ArrayList<WindowState> mNotifiedWindows;
boolean mDragInProgress; boolean mDragInProgress;
DisplayContent mDisplayContent;
private final Region mTmpRegion = new Region(); private final Region mTmpRegion = new Region();
@@ -69,6 +71,12 @@ class DragState {
mFlags = flags; mFlags = flags;
mLocalWin = localWin; mLocalWin = localWin;
mNotifiedWindows = new ArrayList<WindowState>(); mNotifiedWindows = new ArrayList<WindowState>();
WindowState win = service.mWindowMap.get(token);
if (win != null) {
mDisplayContent = win.mDisplayContent;
} else {
Slog.e(WindowManagerService.TAG, "No window associated with token");
}
} }
void reset() { void reset() {
@@ -101,7 +109,8 @@ class DragState {
mDragApplicationHandle.dispatchingTimeoutNanos = mDragApplicationHandle.dispatchingTimeoutNanos =
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS; WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null); mDragWindowHandle = new InputWindowHandle(mDragApplicationHandle, null,
mDisplayContent.getDisplayId());
mDragWindowHandle.name = "drag"; mDragWindowHandle.name = "drag";
mDragWindowHandle.inputChannel = mServerChannel; mDragWindowHandle.inputChannel = mServerChannel;
mDragWindowHandle.layer = getDragLayerLw(); mDragWindowHandle.layer = getDragLayerLw();
@@ -125,8 +134,9 @@ class DragState {
// The drag window covers the entire display // The drag window covers the entire display
mDragWindowHandle.frameLeft = 0; mDragWindowHandle.frameLeft = 0;
mDragWindowHandle.frameTop = 0; mDragWindowHandle.frameTop = 0;
mDragWindowHandle.frameRight = mService.mDisplayInfo.logicalWidth; DisplayInfo displayInfo = mDisplayContent.getDisplayInfo();
mDragWindowHandle.frameBottom = mService.mDisplayInfo.logicalHeight; mDragWindowHandle.frameRight = displayInfo.logicalWidth;
mDragWindowHandle.frameBottom = displayInfo.logicalHeight;
// Pause rotations before a drag. // Pause rotations before a drag.
if (WindowManagerService.DEBUG_ORIENTATION) { if (WindowManagerService.DEBUG_ORIENTATION) {
@@ -179,9 +189,10 @@ class DragState {
Slog.d(WindowManagerService.TAG, "broadcasting DRAG_STARTED at (" + touchX + ", " + touchY + ")"); Slog.d(WindowManagerService.TAG, "broadcasting DRAG_STARTED at (" + touchX + ", " + touchY + ")");
} }
final int N = mService.mWindows.size(); final WindowList windows = mDisplayContent.getWindowList();
final int N = windows.size();
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
sendDragStartedLw(mService.mWindows.get(i), touchX, touchY, mDataDescription); sendDragStartedLw(windows.get(i), touchX, touchY, mDataDescription);
} }
} }
@@ -380,7 +391,8 @@ class DragState {
WindowState touchedWin = null; WindowState touchedWin = null;
final int x = (int) xf; final int x = (int) xf;
final int y = (int) yf; final int y = (int) yf;
final ArrayList<WindowState> windows = mService.mWindows;
final WindowList windows = mDisplayContent.getWindowList();
final int N = windows.size(); final int N = windows.size();
for (int i = N - 1; i >= 0; i--) { for (int i = N - 1; i >= 0; i--) {
WindowState child = windows.get(i); WindowState child = windows.get(i);

View File

@@ -22,6 +22,7 @@ import com.android.server.input.InputWindowHandle;
import android.os.Looper; import android.os.Looper;
import android.os.Process; import android.os.Process;
import android.util.Slog; import android.util.Slog;
import android.view.Display;
import android.view.InputChannel; import android.view.InputChannel;
import android.view.InputEventReceiver; import android.view.InputEventReceiver;
import android.view.InputQueue; import android.view.InputQueue;
@@ -56,7 +57,7 @@ public final class FakeWindowImpl implements WindowManagerPolicy.FakeWindow {
mApplicationHandle.dispatchingTimeoutNanos = mApplicationHandle.dispatchingTimeoutNanos =
WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS; WindowManagerService.DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS;
mWindowHandle = new InputWindowHandle(mApplicationHandle, null); mWindowHandle = new InputWindowHandle(mApplicationHandle, null, Display.DEFAULT_DISPLAY);
mWindowHandle.name = name; mWindowHandle.name = name;
mWindowHandle.inputChannel = mServerChannel; mWindowHandle.inputChannel = mServerChannel;
mWindowLayer = getLayerLw(windowType); mWindowLayer = getLayerLw(windowType);

View File

@@ -201,7 +201,6 @@ final class InputMonitor implements InputManagerService.Callbacks {
// As an optimization, we could try to prune the list of windows but this turns // As an optimization, we could try to prune the list of windows but this turns
// out to be difficult because only the native code knows for sure which window // out to be difficult because only the native code knows for sure which window
// currently has touch focus. // currently has touch focus.
final ArrayList<WindowState> windows = mService.mWindows;
final WindowStateAnimator universeBackground = mService.mAnimator.mUniverseBackground; final WindowStateAnimator universeBackground = mService.mAnimator.mUniverseBackground;
final int aboveUniverseLayer = mService.mAnimator.mAboveUniverseLayer; final int aboveUniverseLayer = mService.mAnimator.mAboveUniverseLayer;
boolean addedUniverse = false; boolean addedUniverse = false;
@@ -226,8 +225,9 @@ final class InputMonitor implements InputManagerService.Callbacks {
addInputWindowHandleLw(mService.mFakeWindows.get(i).mWindowHandle); addInputWindowHandleLw(mService.mFakeWindows.get(i).mWindowHandle);
} }
final int N = windows.size(); // TODO(multidisplay): Input only occurs on the default display.
for (int i = N - 1; i >= 0; i--) { final WindowList windows = mService.getDefaultWindowList();
for (int i = windows.size() - 1; i >= 0; i--) {
final WindowState child = windows.get(i); final WindowState child = windows.get(i);
final InputChannel inputChannel = child.mInputChannel; final InputChannel inputChannel = child.mInputChannel;
final InputWindowHandle inputWindowHandle = child.mInputWindowHandle; final InputWindowHandle inputWindowHandle = child.mInputWindowHandle;

View File

@@ -39,7 +39,7 @@ public class WindowAnimator {
final Context mContext; final Context mContext;
final WindowManagerPolicy mPolicy; final WindowManagerPolicy mPolicy;
ArrayList<WindowStateAnimator> mWinAnimators = new ArrayList<WindowStateAnimator>(); ArrayList<WinAnimatorList> mWinAnimatorLists = new ArrayList<WinAnimatorList>();
boolean mAnimating; boolean mAnimating;
@@ -158,7 +158,8 @@ public class WindowAnimator {
mWallpaperTokens = new ArrayList<WindowToken>(layoutToAnim.mWallpaperTokens); mWallpaperTokens = new ArrayList<WindowToken>(layoutToAnim.mWallpaperTokens);
} }
mWinAnimators = new ArrayList<WindowStateAnimator>(layoutToAnim.mWinAnimators); mWinAnimatorLists =
new ArrayList<WinAnimatorList>(layoutToAnim.mWinAnimatorLists);
mWallpaperTarget = layoutToAnim.mWallpaperTarget; mWallpaperTarget = layoutToAnim.mWallpaperTarget;
mWpAppAnimator = mWallpaperTarget == null mWpAppAnimator = mWallpaperTarget == null
? null : mWallpaperTarget.mAppToken == null ? null : mWallpaperTarget.mAppToken == null
@@ -267,7 +268,7 @@ public class WindowAnimator {
} }
} }
private void updateWindowsLocked() { private void updateWindowsLocked(final WinAnimatorList winAnimatorList) {
++mAnimTransactionSequence; ++mAnimTransactionSequence;
ArrayList<WindowStateAnimator> unForceHiding = null; ArrayList<WindowStateAnimator> unForceHiding = null;
@@ -280,8 +281,8 @@ public class WindowAnimator {
final int KEYGUARD_ANIMATING_OUT = 3; final int KEYGUARD_ANIMATING_OUT = 3;
int forceHiding = KEYGUARD_NOT_SHOWN; int forceHiding = KEYGUARD_NOT_SHOWN;
for (int i = mWinAnimators.size() - 1; i >= 0; i--) { for (int i = winAnimatorList.size() - 1; i >= 0; i--) {
WindowStateAnimator winAnimator = mWinAnimators.get(i); WindowStateAnimator winAnimator = winAnimatorList.get(i);
WindowState win = winAnimator.mWin; WindowState win = winAnimator.mWin;
final int flags = winAnimator.mAttrFlags; final int flags = winAnimator.mAttrFlags;
@@ -418,13 +419,13 @@ public class WindowAnimator {
} }
} }
private void updateWallpaperLocked() { private void updateWallpaperLocked(final WinAnimatorList winAnimatorList) {
WindowStateAnimator windowAnimationBackground = null; WindowStateAnimator windowAnimationBackground = null;
int windowAnimationBackgroundColor = 0; int windowAnimationBackgroundColor = 0;
WindowState detachedWallpaper = null; WindowState detachedWallpaper = null;
for (int i = mWinAnimators.size() - 1; i >= 0; i--) { for (int i = winAnimatorList.size() - 1; i >= 0; i--) {
WindowStateAnimator winAnimator = mWinAnimators.get(i); WindowStateAnimator winAnimator = winAnimatorList.get(i);
if (winAnimator.mSurface == null) { if (winAnimator.mSurface == null) {
continue; continue;
} }
@@ -489,11 +490,11 @@ public class WindowAnimator {
// don't cause the wallpaper to suddenly disappear. // don't cause the wallpaper to suddenly disappear.
int animLayer = windowAnimationBackground.mAnimLayer; int animLayer = windowAnimationBackground.mAnimLayer;
WindowState win = windowAnimationBackground.mWin; WindowState win = windowAnimationBackground.mWin;
if (windowAnimationBackground != null && mWallpaperTarget == win if (mWallpaperTarget == win
|| mLowerWallpaperTarget == win || mUpperWallpaperTarget == win) { || mLowerWallpaperTarget == win || mUpperWallpaperTarget == win) {
final int N = mWinAnimators.size(); final int N = winAnimatorList.size();
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
WindowStateAnimator winAnimator = mWinAnimators.get(i); WindowStateAnimator winAnimator = winAnimatorList.get(i);
if (winAnimator.mIsWallpaper) { if (winAnimator.mIsWallpaper) {
animLayer = winAnimator.mAnimLayer; animLayer = winAnimator.mAnimLayer;
break; break;
@@ -548,9 +549,9 @@ public class WindowAnimator {
} }
} }
private void performAnimationsLocked() { private void performAnimationsLocked(final WinAnimatorList winAnimatorList) {
updateWindowsLocked(); updateWindowsLocked(winAnimatorList);
updateWallpaperLocked(); updateWallpaperLocked(winAnimatorList);
if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) { if ((mPendingLayoutChanges & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) {
mPendingActions |= WALLPAPER_ACTION_PENDING; mPendingActions |= WALLPAPER_ACTION_PENDING;
@@ -562,6 +563,12 @@ public class WindowAnimator {
// TODO(cmautner): Change the following comment when no longer locked on mWindowMap */ // TODO(cmautner): Change the following comment when no longer locked on mWindowMap */
/** Locked on mService.mWindowMap and this. */ /** Locked on mService.mWindowMap and this. */
private void animateLocked() { private void animateLocked() {
for (int i = mWinAnimatorLists.size() - 1; i >= 0; i--) {
animateLocked(mWinAnimatorLists.get(i));
}
}
private void animateLocked(final WinAnimatorList winAnimatorList) {
mPendingLayoutChanges = 0; mPendingLayoutChanges = 0;
mCurrentTime = SystemClock.uptimeMillis(); mCurrentTime = SystemClock.uptimeMillis();
mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE; mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE;
@@ -577,7 +584,7 @@ public class WindowAnimator {
try { try {
updateWindowsAppsAndRotationAnimationsLocked(); updateWindowsAppsAndRotationAnimationsLocked();
performAnimationsLocked(); performAnimationsLocked(winAnimatorList);
// THIRD LOOP: Update the surfaces of all windows. // THIRD LOOP: Update the surfaces of all windows.
@@ -585,9 +592,9 @@ public class WindowAnimator {
mScreenRotationAnimation.updateSurfaces(); mScreenRotationAnimation.updateSurfaces();
} }
final int N = mWinAnimators.size(); final int N = winAnimatorList.size();
for (int i = 0; i < N; i++) { for (int i = 0; i < N; i++) {
mWinAnimators.get(i).prepareSurfaceLocked(true); winAnimatorList.get(i).prepareSurfaceLocked(true);
} }
if (mDimParams != null) { if (mDimParams != null) {

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,7 @@ import android.graphics.Region;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Slog; import android.util.Slog;
import android.view.DisplayInfo;
import android.view.Gravity; import android.view.Gravity;
import android.view.IApplicationToken; import android.view.IApplicationToken;
import android.view.IWindow; import android.view.IWindow;
@@ -47,6 +48,9 @@ import android.view.WindowManagerPolicy;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
class WindowList extends ArrayList<WindowState> {
}
/** /**
* A window in the window manager. * A window in the window manager.
*/ */
@@ -251,18 +255,18 @@ final class WindowState implements WindowManagerPolicy.WindowState {
boolean mHasSurface = false; boolean mHasSurface = false;
int mDisplayId; DisplayContent mDisplayContent;
WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token, WindowState(WindowManagerService service, Session s, IWindow c, WindowToken token,
WindowState attachedWindow, int seq, WindowManager.LayoutParams a, WindowState attachedWindow, int seq, WindowManager.LayoutParams a,
int viewVisibility, int displayId) { int viewVisibility, final DisplayContent displayContent) {
mService = service; mService = service;
mSession = s; mSession = s;
mClient = c; mClient = c;
mToken = token; mToken = token;
mAttrs.copyFrom(a); mAttrs.copyFrom(a);
mViewVisibility = viewVisibility; mViewVisibility = viewVisibility;
mDisplayId = displayId; mDisplayContent = displayContent;
mPolicy = mService.mPolicy; mPolicy = mService.mPolicy;
mContext = mService.mContext; mContext = mService.mContext;
DeathRecipient deathRecipient = new DeathRecipient(); DeathRecipient deathRecipient = new DeathRecipient();
@@ -346,7 +350,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
mYOffset = 0; mYOffset = 0;
mLayer = 0; mLayer = 0;
mInputWindowHandle = new InputWindowHandle( mInputWindowHandle = new InputWindowHandle(
mAppToken != null ? mAppToken.mInputApplicationHandle : null, this); mAppToken != null ? mAppToken.mInputApplicationHandle : null, this,
displayContent.getDisplayId());
} }
void attach() { void attach() {
@@ -482,8 +487,9 @@ final class WindowState implements WindowManagerPolicy.WindowState {
} }
if (mIsWallpaper && (fw != frame.width() || fh != frame.height())) { if (mIsWallpaper && (fw != frame.width() || fh != frame.height())) {
mService.updateWallpaperOffsetLocked(this, final DisplayInfo displayInfo = mDisplayContent.getDisplayInfo();
mService.mDisplayInfo.appWidth, mService.mDisplayInfo.appHeight, false); mService.updateWallpaperOffsetLocked(this, displayInfo.appWidth, displayInfo.appHeight,
false);
} }
if (WindowManagerService.localLOGV) { if (WindowManagerService.localLOGV) {
@@ -547,6 +553,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
public boolean getNeedsMenuLw(WindowManagerPolicy.WindowState bottom) { public boolean getNeedsMenuLw(WindowManagerPolicy.WindowState bottom) {
int index = -1; int index = -1;
WindowState ws = this; WindowState ws = this;
WindowList windows = getWindowList();
while (true) { while (true) {
if ((ws.mAttrs.privateFlags if ((ws.mAttrs.privateFlags
& WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY) != 0) { & WindowManager.LayoutParams.PRIVATE_FLAG_SET_NEEDS_MENU_KEY) != 0) {
@@ -561,13 +568,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
// look behind it. // look behind it.
// First, we may need to determine the starting position. // First, we may need to determine the starting position.
if (index < 0) { if (index < 0) {
index = mService.mWindows.indexOf(ws); index = windows.indexOf(ws);
} }
index--; index--;
if (index < 0) { if (index < 0) {
return false; return false;
} }
ws = mService.mWindows.get(index); ws = windows.get(index);
} }
} }
@@ -991,8 +998,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
} }
} }
WindowList getWindowList() {
return mDisplayContent.getWindowList();
}
void dump(PrintWriter pw, String prefix, boolean dumpAll) { void dump(PrintWriter pw, String prefix, boolean dumpAll) {
pw.print(prefix); pw.print("mSession="); pw.print(mSession); pw.print(prefix); pw.print("mDisplayId="); pw.print(mDisplayContent.getDisplayId());
pw.print(" mSession="); pw.print(mSession);
pw.print(" mClient="); pw.println(mClient.asBinder()); pw.print(" mClient="); pw.println(mClient.asBinder());
pw.print(prefix); pw.print("mAttrs="); pw.println(mAttrs); pw.print(prefix); pw.print("mAttrs="); pw.println(mAttrs);
pw.print(prefix); pw.print("Requested w="); pw.print(mRequestedWidth); pw.print(prefix); pw.print("Requested w="); pw.print(mRequestedWidth);

View File

@@ -16,6 +16,7 @@ import android.graphics.Rect;
import android.graphics.Region; import android.graphics.Region;
import android.os.Debug; import android.os.Debug;
import android.util.Slog; import android.util.Slog;
import android.view.DisplayInfo;
import android.view.Surface; import android.view.Surface;
import android.view.SurfaceSession; import android.view.SurfaceSession;
import android.view.WindowManager; import android.view.WindowManager;
@@ -30,6 +31,9 @@ import com.android.server.wm.WindowManagerService.H;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
class WinAnimatorList extends ArrayList<WindowStateAnimator> {
}
/** /**
* Keep track of animations and surface operations for a single WindowState. * Keep track of animations and surface operations for a single WindowState.
**/ **/
@@ -151,8 +155,9 @@ class WindowStateAnimator {
mAnimator = service.mAnimator; mAnimator = service.mAnimator;
mPolicy = service.mPolicy; mPolicy = service.mPolicy;
mContext = service.mContext; mContext = service.mContext;
mAnimDw = service.mDisplayInfo.appWidth; final DisplayInfo displayInfo = win.mDisplayContent.getDisplayInfo();
mAnimDh = service.mDisplayInfo.appHeight; mAnimDw = displayInfo.appWidth;
mAnimDh = displayInfo.appHeight;
mWin = win; mWin = win;
mAttachedWinAnimator = win.mAttachedWindow == null mAttachedWinAnimator = win.mAttachedWindow == null
@@ -248,8 +253,9 @@ class WindowStateAnimator {
" scale=" + mService.mWindowAnimationScale); " scale=" + mService.mWindowAnimationScale);
mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(), mAnimation.initialize(mWin.mFrame.width(), mWin.mFrame.height(),
mAnimDw, mAnimDh); mAnimDw, mAnimDh);
mAnimDw = mService.mDisplayInfo.appWidth; final DisplayInfo displayInfo = mWin.mDisplayContent.getDisplayInfo();
mAnimDh = mService.mDisplayInfo.appHeight; mAnimDw = displayInfo.appWidth;
mAnimDh = displayInfo.appHeight;
mAnimation.setStartTime(currentTime); mAnimation.setStartTime(currentTime);
mLocalAnimating = true; mLocalAnimating = true;
mAnimating = true; mAnimating = true;
@@ -646,12 +652,12 @@ class WindowStateAnimator {
mSurface = new SurfaceTrace( mSurface = new SurfaceTrace(
mSession.mSurfaceSession, mSession.mPid, mSession.mSurfaceSession, mSession.mPid,
attrs.getTitle().toString(), attrs.getTitle().toString(),
mWin.mDisplayId, w, h, format, flags); mWin.mDisplayContent.getDisplayId(), w, h, format, flags);
} else { } else {
mSurface = new Surface( mSurface = new Surface(
mSession.mSurfaceSession, mSession.mPid, mSession.mSurfaceSession, mSession.mPid,
attrs.getTitle().toString(), attrs.getTitle().toString(),
mWin.mDisplayId, w, h, format, flags); mWin.mDisplayContent.getDisplayId(), w, h, format, flags);
} }
mWin.mHasSurface = true; mWin.mHasSurface = true;
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG, if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
@@ -1101,8 +1107,9 @@ class WindowStateAnimator {
mAnimator.mPendingLayoutChanges |= mAnimator.mPendingLayoutChanges |=
WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER; WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
if ((w.mAttrs.flags & LayoutParams.FLAG_DIM_BEHIND) != 0) { if ((w.mAttrs.flags & LayoutParams.FLAG_DIM_BEHIND) != 0) {
final DisplayInfo displayInfo = mWin.mDisplayContent.getDisplayInfo();
mService.startDimming(this, w.mExiting ? 0 : w.mAttrs.dimAmount, mService.startDimming(this, w.mExiting ? 0 : w.mAttrs.dimAmount,
mService.mDisplayInfo.appWidth, mService.mDisplayInfo.appHeight); displayInfo.appWidth, displayInfo.appHeight);
} }
} catch (RuntimeException e) { } catch (RuntimeException e) {
// If something goes wrong with the surface (such // If something goes wrong with the surface (such

View File

@@ -92,7 +92,7 @@ public class BridgeWindowManager implements IWindowManager {
} }
@Override @Override
public void clearForcedDisplaySize() throws RemoteException { public void clearForcedDisplaySize(int displayId) throws RemoteException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@@ -262,7 +262,8 @@ public class BridgeWindowManager implements IWindowManager {
} }
@Override @Override
public Bitmap screenshotApplications(IBinder arg0, int arg1, int arg2) throws RemoteException { public Bitmap screenshotApplications(IBinder arg0, int displayId, int arg1, int arg2)
throws RemoteException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return null; return null;
} }
@@ -324,7 +325,7 @@ public class BridgeWindowManager implements IWindowManager {
} }
@Override @Override
public void setForcedDisplaySize(int arg0, int arg1) throws RemoteException { public void setForcedDisplaySize(int displayId, int arg0, int arg1) throws RemoteException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }