Merge "Clean up displayId and layerStack usage." into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6715d1effa
@@ -24,7 +24,6 @@ import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
import android.view.CompatibilityInfoHolder;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
|
||||
@@ -388,8 +388,8 @@ public class Surface implements Parcelable {
|
||||
/** Free all server-side state associated with this surface and
|
||||
* release this object's reference. @hide */
|
||||
public native void destroy();
|
||||
|
||||
private native Canvas lockCanvasNative(Rect dirty);
|
||||
|
||||
private native Canvas lockCanvasNative(Rect dirty) throws OutOfResourcesException;
|
||||
|
||||
/**
|
||||
* set the orientation of the given display.
|
||||
@@ -497,10 +497,10 @@ public class Surface implements Parcelable {
|
||||
}
|
||||
|
||||
private native void init(SurfaceSession s,
|
||||
int pid, String name, int displayId, int w, int h, int format, int flags)
|
||||
int pid, String name, int layerStack, int w, int h, int format, int flags)
|
||||
throws OutOfResourcesException;
|
||||
|
||||
private native void init(Parcel source);
|
||||
private native void init(Parcel source) throws OutOfResourcesException;
|
||||
|
||||
private native void initFromSurfaceTexture(SurfaceTexture surfaceTexture);
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import android.graphics.Matrix;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.Rect;
|
||||
import android.util.Slog;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.SurfaceSession;
|
||||
|
||||
@@ -36,7 +35,7 @@ public class BlackFrame {
|
||||
final int layer;
|
||||
final Surface surface;
|
||||
|
||||
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b)
|
||||
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b, int layerStack)
|
||||
throws Surface.OutOfResourcesException {
|
||||
left = l;
|
||||
top = t;
|
||||
@@ -45,10 +44,10 @@ public class BlackFrame {
|
||||
int h = b-t;
|
||||
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
|
||||
surface = new WindowStateAnimator.SurfaceTrace(session, 0, "BlackSurface("
|
||||
+ l + ", " + t + ")", Display.DEFAULT_DISPLAY,
|
||||
+ l + ", " + t + ")", layerStack,
|
||||
w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
|
||||
} else {
|
||||
surface = new Surface(session, 0, "BlackSurface", Display.DEFAULT_DISPLAY,
|
||||
surface = new Surface(session, 0, "BlackSurface", layerStack,
|
||||
w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
|
||||
}
|
||||
surface.setAlpha(1);
|
||||
@@ -104,7 +103,7 @@ public class BlackFrame {
|
||||
}
|
||||
|
||||
public BlackFrame(SurfaceSession session, Rect outer, Rect inner,
|
||||
int layer) throws Surface.OutOfResourcesException {
|
||||
int layer, final int layerStack) throws Surface.OutOfResourcesException {
|
||||
boolean success = false;
|
||||
|
||||
mOuterRect = new Rect(outer);
|
||||
@@ -112,19 +111,19 @@ public class BlackFrame {
|
||||
try {
|
||||
if (outer.top < inner.top) {
|
||||
mBlackSurfaces[0] = new BlackSurface(session, layer,
|
||||
outer.left, outer.top, inner.right, inner.top);
|
||||
outer.left, outer.top, inner.right, inner.top, layerStack);
|
||||
}
|
||||
if (outer.left < inner.left) {
|
||||
mBlackSurfaces[1] = new BlackSurface(session, layer,
|
||||
outer.left, inner.top, inner.left, outer.bottom);
|
||||
outer.left, inner.top, inner.left, outer.bottom, layerStack);
|
||||
}
|
||||
if (outer.bottom > inner.bottom) {
|
||||
mBlackSurfaces[2] = new BlackSurface(session, layer,
|
||||
inner.left, inner.bottom, outer.right, outer.bottom);
|
||||
inner.left, inner.bottom, outer.right, outer.bottom, layerStack);
|
||||
}
|
||||
if (outer.right > inner.right) {
|
||||
mBlackSurfaces[3] = new BlackSurface(session, layer,
|
||||
inner.right, outer.top, outer.right, inner.bottom);
|
||||
inner.right, outer.top, outer.right, inner.bottom, layerStack);
|
||||
}
|
||||
success = true;
|
||||
} finally {
|
||||
|
||||
@@ -39,18 +39,18 @@ class DimAnimator {
|
||||
|
||||
int mLastDimWidth, mLastDimHeight;
|
||||
|
||||
DimAnimator (SurfaceSession session, final int displayId) {
|
||||
DimAnimator (SurfaceSession session, final int layerStack) {
|
||||
if (mDimSurface == null) {
|
||||
try {
|
||||
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
|
||||
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
|
||||
"DimAnimator",
|
||||
displayId, 16, 16, PixelFormat.OPAQUE,
|
||||
layerStack, 16, 16, PixelFormat.OPAQUE,
|
||||
Surface.FX_SURFACE_DIM);
|
||||
} else {
|
||||
mDimSurface = new Surface(session, 0,
|
||||
"DimAnimator",
|
||||
displayId, 16, 16, PixelFormat.OPAQUE,
|
||||
layerStack, 16, 16, PixelFormat.OPAQUE,
|
||||
Surface.FX_SURFACE_DIM);
|
||||
}
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS ||
|
||||
|
||||
@@ -30,18 +30,18 @@ class DimSurface {
|
||||
int mLayer = -1;
|
||||
int mLastDimWidth, mLastDimHeight;
|
||||
|
||||
DimSurface(SurfaceSession session, final int displayId) {
|
||||
DimSurface(SurfaceSession session, final int layerStack) {
|
||||
if (mDimSurface == null) {
|
||||
try {
|
||||
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
|
||||
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
|
||||
"DimSurface",
|
||||
displayId, 16, 16, PixelFormat.OPAQUE,
|
||||
layerStack, 16, 16, PixelFormat.OPAQUE,
|
||||
Surface.FX_SURFACE_DIM);
|
||||
} else {
|
||||
mDimSurface = new Surface(session, 0,
|
||||
"DimSurface",
|
||||
displayId, 16, 16, PixelFormat.OPAQUE,
|
||||
layerStack, 16, 16, PixelFormat.OPAQUE,
|
||||
Surface.FX_SURFACE_DIM);
|
||||
}
|
||||
if (WindowManagerService.SHOW_TRANSACTIONS ||
|
||||
|
||||
@@ -16,10 +16,9 @@
|
||||
|
||||
package com.android.server.wm;
|
||||
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
|
||||
import com.android.server.display.DisplayManagerService;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -60,13 +59,13 @@ class DisplayContent {
|
||||
int mBaseDisplayWidth = 0;
|
||||
int mBaseDisplayHeight = 0;
|
||||
int mBaseDisplayDensity = 0;
|
||||
final DisplayManagerService mDisplayManager;
|
||||
final DisplayInfo mDisplayInfo = new DisplayInfo();
|
||||
final Display mDisplay;
|
||||
|
||||
DisplayContent(DisplayManagerService displayManager, final int displayId) {
|
||||
mDisplayManager = displayManager;
|
||||
mDisplayId = displayId;
|
||||
displayManager.getDisplayInfo(displayId, mDisplayInfo);
|
||||
DisplayContent(Display display) {
|
||||
mDisplay = display;
|
||||
mDisplayId = display.getDisplayId();
|
||||
display.getDisplayInfo(mDisplayInfo);
|
||||
}
|
||||
|
||||
int getDisplayId() {
|
||||
@@ -77,6 +76,10 @@ class DisplayContent {
|
||||
return mWindows;
|
||||
}
|
||||
|
||||
Display getDisplay() {
|
||||
return mDisplay;
|
||||
}
|
||||
|
||||
DisplayInfo getDisplayInfo() {
|
||||
return mDisplayInfo;
|
||||
}
|
||||
|
||||
@@ -477,6 +477,7 @@ class ScreenRotationAnimation {
|
||||
mRotateFrameAnimation.scaleCurrentDuration(animationScale);
|
||||
}
|
||||
|
||||
final int layerStack = mDisplay.getLayerStack();
|
||||
if (USE_CUSTOM_BLACK_FRAME && mCustomBlackFrame == null) {
|
||||
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS || DEBUG_STATE) Slog.i(
|
||||
WindowManagerService.TAG,
|
||||
@@ -495,7 +496,8 @@ class ScreenRotationAnimation {
|
||||
Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
|
||||
mOriginalWidth*2, mOriginalHeight*2);
|
||||
Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
|
||||
mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3);
|
||||
mCustomBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 3,
|
||||
layerStack);
|
||||
mCustomBlackFrame.setMatrix(mFrameInitialMatrix);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
@@ -525,7 +527,8 @@ class ScreenRotationAnimation {
|
||||
Rect outer = new Rect(-mOriginalWidth*1, -mOriginalHeight*1,
|
||||
mOriginalWidth*2, mOriginalHeight*2);
|
||||
Rect inner = new Rect(0, 0, mOriginalWidth, mOriginalHeight);
|
||||
mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2);
|
||||
mExitingBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER + 2,
|
||||
layerStack);
|
||||
mExitingBlackFrame.setMatrix(mFrameInitialMatrix);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
@@ -547,7 +550,8 @@ class ScreenRotationAnimation {
|
||||
Rect outer = new Rect(-finalWidth*1, -finalHeight*1,
|
||||
finalWidth*2, finalHeight*2);
|
||||
Rect inner = new Rect(0, 0, finalWidth, finalHeight);
|
||||
mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER);
|
||||
mEnteringBlackFrame = new BlackFrame(session, outer, inner, FREEZE_LAYER,
|
||||
layerStack);
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
Slog.w(TAG, "Unable to allocate black surface", e);
|
||||
} finally {
|
||||
|
||||
@@ -103,6 +103,8 @@ public class WindowAnimator {
|
||||
/** Do not modify unless holding mService.mWindowMap or this and mAnimToLayout in that order */
|
||||
final AnimatorToLayoutParams mAnimToLayout = new AnimatorToLayoutParams();
|
||||
|
||||
boolean mInitialized = false;
|
||||
|
||||
WindowAnimator(final WindowManagerService service) {
|
||||
mService = service;
|
||||
mContext = service.mContext;
|
||||
@@ -121,10 +123,13 @@ public class WindowAnimator {
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void initializeLocked(final int layerStack) {
|
||||
mWindowAnimationBackgroundSurface =
|
||||
new DimSurface(mService.mFxSession, Display.DEFAULT_DISPLAY);
|
||||
mDimAnimator = new DimAnimator(mService.mFxSession, Display.DEFAULT_DISPLAY);
|
||||
new DimSurface(mService.mFxSession, layerStack);
|
||||
mDimAnimator = new DimAnimator(mService.mFxSession, layerStack);
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
/** Locked on mAnimToLayout */
|
||||
@@ -563,6 +568,9 @@ public class WindowAnimator {
|
||||
// TODO(cmautner): Change the following comment when no longer locked on mWindowMap */
|
||||
/** Locked on mService.mWindowMap and this. */
|
||||
private void animateLocked() {
|
||||
if (!mInitialized) {
|
||||
return;
|
||||
}
|
||||
for (int i = mWinAnimatorLists.size() - 1; i >= 0; i--) {
|
||||
animateLocked(mWinAnimatorLists.get(i));
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Region;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.os.BatteryStats;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
@@ -540,7 +541,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
final ArrayList<AppWindowToken> mOpeningApps = new ArrayList<AppWindowToken>();
|
||||
final ArrayList<AppWindowToken> mClosingApps = new ArrayList<AppWindowToken>();
|
||||
|
||||
Display mDisplay;
|
||||
Display mDefaultDisplay;
|
||||
|
||||
boolean mIsTouchDevice;
|
||||
|
||||
@@ -606,7 +607,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
float mAnimatorDurationScale = 1.0f;
|
||||
|
||||
final InputManagerService mInputManager;
|
||||
final DisplayManagerService mDisplayManager;
|
||||
final DisplayManagerService mDisplayManagerService;
|
||||
final DisplayManager mDisplayManager;
|
||||
|
||||
// Who is holding the screen on.
|
||||
Session mHoldingScreenOn;
|
||||
@@ -844,17 +846,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
private final WindowManagerPolicy mPolicy;
|
||||
private final WindowManagerService mService;
|
||||
private final Context mContext;
|
||||
private final PowerManagerService mPM;
|
||||
boolean mRunning = false;
|
||||
|
||||
public PolicyThread(WindowManagerPolicy policy,
|
||||
WindowManagerService service, Context context,
|
||||
PowerManagerService pm) {
|
||||
WindowManagerService service, Context context) {
|
||||
super("WindowManagerPolicy");
|
||||
mPolicy = policy;
|
||||
mService = service;
|
||||
mContext = context;
|
||||
mPM = pm;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -895,7 +894,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mOnlyCore = onlyCore;
|
||||
mLimitedAlphaCompositing = context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_sf_limitedAlpha);
|
||||
mDisplayManager = displayManager;
|
||||
mDisplayManagerService = displayManager;
|
||||
mDisplayManager = DisplayManager.getInstance();
|
||||
mHeadless = displayManager.isHeadless();
|
||||
|
||||
mPowerManager = pm;
|
||||
@@ -931,7 +931,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mFxSession = new SurfaceSession();
|
||||
mAnimator = new WindowAnimator(this);
|
||||
|
||||
PolicyThread thr = new PolicyThread(mPolicy, this, context, pm);
|
||||
PolicyThread thr = new PolicyThread(mPolicy, this, context);
|
||||
thr.start();
|
||||
|
||||
synchronized (thr) {
|
||||
@@ -1238,7 +1238,6 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
/**
|
||||
* Dig through the WindowStates and find the one that the Input Method will target.
|
||||
* @param willMove
|
||||
* @param windows TODO(cmautner):
|
||||
* @return The index+1 in mWindows of the discovered target.
|
||||
*/
|
||||
int findDesiredInputMethodWindowIndexLocked(boolean willMove) {
|
||||
@@ -2164,7 +2163,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
long origId;
|
||||
|
||||
synchronized(mWindowMap) {
|
||||
if (mDisplay == null) {
|
||||
if (mDefaultDisplay == null) {
|
||||
throw new IllegalStateException("Display has not been initialialized");
|
||||
}
|
||||
|
||||
@@ -3076,6 +3075,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Binder.restoreCallingIdentity(origId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWindowCompatibilityScale(IBinder windowToken) {
|
||||
if (!checkCallingPermission(android.Manifest.permission.RETRIEVE_WINDOW_INFO,
|
||||
"getWindowCompatibilityScale()")) {
|
||||
@@ -3807,7 +3807,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
Configuration config = null;
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
|
||||
|
||||
synchronized(mWindowMap) {
|
||||
config = updateOrientationFromAppTokensLocked(currentConfig,
|
||||
freezeThisOneIfNeeded);
|
||||
@@ -3848,7 +3848,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -3859,7 +3859,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
* setNewConfiguration() TO TELL THE WINDOW MANAGER IT CAN UNFREEZE THE
|
||||
* SCREEN. This will typically be done for you if you call
|
||||
* sendNewConfiguration().
|
||||
*
|
||||
*
|
||||
* The orientation is computed from non-application windows first. If none of
|
||||
* the non-application windows specify orientation, the orientation is computed from
|
||||
* application tokens.
|
||||
@@ -5064,7 +5064,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
private boolean shouldAllowDisableKeyguard()
|
||||
{
|
||||
// We fail safe and prevent disabling keyguard in the unlikely event this gets
|
||||
// We fail safe and prevent disabling keyguard in the unlikely event this gets
|
||||
// called before DevicePolicyManagerService has started.
|
||||
if (mAllowDisableKeyguard == ALLOW_DISABLE_UNKNOWN) {
|
||||
DevicePolicyManager dpm = (DevicePolicyManager) mContext.getSystemService(
|
||||
@@ -5546,7 +5546,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Surface.openTransaction();
|
||||
try {
|
||||
if (mStrictModeFlash == null) {
|
||||
mStrictModeFlash = new StrictModeFlash(mDisplay, mFxSession);
|
||||
mStrictModeFlash = new StrictModeFlash(mDefaultDisplay, mFxSession);
|
||||
}
|
||||
mStrictModeFlash.setVisibility(on);
|
||||
} finally {
|
||||
@@ -5659,7 +5659,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
// The screenshot API does not apply the current screen rotation.
|
||||
rot = mDisplay.getRotation();
|
||||
rot = mDefaultDisplay.getRotation();
|
||||
int fw = frame.width();
|
||||
int fh = frame.height();
|
||||
|
||||
@@ -6574,7 +6574,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
boolean computeScreenConfigurationLocked(Configuration config) {
|
||||
if (mDisplay == null) {
|
||||
if (mDefaultDisplay == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -6630,7 +6630,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
displayInfo.appHeight = appHeight;
|
||||
displayInfo.getLogicalMetrics(mRealDisplayMetrics, null);
|
||||
displayInfo.getAppMetrics(mDisplayMetrics, null);
|
||||
mDisplayManager.setDisplayInfo(displayContent.getDisplayId(), displayInfo);
|
||||
mDisplayManagerService.setDisplayInfo(displayContent.getDisplayId(), displayInfo);
|
||||
|
||||
mAnimator.setDisplayDimensions(dw, dh, appWidth, appHeight);
|
||||
}
|
||||
@@ -6781,7 +6781,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
try {
|
||||
if (mDragState == null) {
|
||||
Surface surface = new Surface(session, callerPid, "drag surface",
|
||||
Display.DEFAULT_DISPLAY,
|
||||
mDefaultDisplay.getLayerStack(),
|
||||
width, height, PixelFormat.TRANSLUCENT, Surface.HIDDEN);
|
||||
if (SHOW_TRANSACTIONS) Slog.i(TAG, " DRAG "
|
||||
+ surface + ": CREATE");
|
||||
@@ -6939,30 +6939,33 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
public void displayReady() {
|
||||
displayReady(Display.DEFAULT_DISPLAY);
|
||||
WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
final Display display = wm.getDefaultDisplay();
|
||||
displayReady(display.getDisplayId());
|
||||
|
||||
synchronized(mWindowMap) {
|
||||
readForcedDisplaySizeAndDensityLocked(getDefaultDisplayContent());
|
||||
|
||||
WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
|
||||
mDisplay = wm.getDefaultDisplay();
|
||||
mDefaultDisplay = display;
|
||||
mIsTouchDevice = mContext.getPackageManager().hasSystemFeature(
|
||||
PackageManager.FEATURE_TOUCHSCREEN);
|
||||
|
||||
mAnimator.initializeLocked(display.getLayerStack());
|
||||
|
||||
final DisplayInfo displayInfo = getDefaultDisplayInfo();
|
||||
mAnimator.setDisplayDimensions(displayInfo.logicalWidth, displayInfo.logicalHeight,
|
||||
displayInfo.appWidth, displayInfo.appHeight);
|
||||
|
||||
DisplayDeviceInfo info = new DisplayDeviceInfo();
|
||||
mDisplayManager.getDefaultExternalDisplayDeviceInfo(info);
|
||||
mDisplayManagerService.getDefaultExternalDisplayDeviceInfo(info);
|
||||
|
||||
final DisplayContent displayContent = getDefaultDisplayContent();
|
||||
mInputManager.setDisplaySize(Display.DEFAULT_DISPLAY,
|
||||
mInputManager.setDisplaySize(displayContent.getDisplayId(),
|
||||
displayContent.mInitialDisplayWidth, displayContent.mInitialDisplayHeight,
|
||||
info.width, info.height);
|
||||
mInputManager.setDisplayOrientation(Display.DEFAULT_DISPLAY,
|
||||
mDisplay.getRotation(), Surface.ROTATION_0);
|
||||
mPolicy.setInitialDisplaySize(mDisplay, displayContent.mInitialDisplayWidth,
|
||||
mInputManager.setDisplayOrientation(displayContent.getDisplayId(),
|
||||
mDefaultDisplay.getRotation(), Surface.ROTATION_0);
|
||||
mPolicy.setInitialDisplaySize(mDefaultDisplay, displayContent.mInitialDisplayWidth,
|
||||
displayContent.mInitialDisplayHeight, displayContent.mInitialDisplayDensity);
|
||||
}
|
||||
|
||||
@@ -6979,7 +6982,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
synchronized(displayContent.mDisplaySizeLock) {
|
||||
// Bootstrap the default logical display from the display manager.
|
||||
displayInfo = displayContent.getDisplayInfo();
|
||||
mDisplayManager.getDisplayInfo(displayId, displayInfo);
|
||||
mDisplayManagerService.getDisplayInfo(displayId, displayInfo);
|
||||
displayContent.mInitialDisplayWidth = displayInfo.logicalWidth;
|
||||
displayContent.mInitialDisplayHeight = displayInfo.logicalHeight;
|
||||
displayContent.mInitialDisplayDensity = displayInfo.logicalDensityDpi;
|
||||
@@ -7620,7 +7623,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Rect outer = new Rect(0, 0, initW, initH);
|
||||
Rect inner = new Rect(0, 0, baseW, baseH);
|
||||
try {
|
||||
mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER);
|
||||
mBlackFrame = new BlackFrame(mFxSession, outer, inner, MASK_LAYER,
|
||||
mDefaultDisplay.getLayerStack());
|
||||
} catch (Surface.OutOfResourcesException e) {
|
||||
}
|
||||
}
|
||||
@@ -7719,7 +7723,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
private void reconfigureDisplayLocked(DisplayContent displayContent) {
|
||||
mPolicy.setInitialDisplaySize(mDisplay, displayContent.mBaseDisplayWidth,
|
||||
mPolicy.setInitialDisplaySize(mDefaultDisplay, displayContent.mBaseDisplayWidth,
|
||||
displayContent.mBaseDisplayHeight, displayContent.mBaseDisplayDensity);
|
||||
|
||||
mLayoutNeeded = true;
|
||||
@@ -7944,7 +7948,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDisplay == null) {
|
||||
if (mDefaultDisplay == null) {
|
||||
// Not yet initialized, nothing to do.
|
||||
return;
|
||||
}
|
||||
@@ -8408,7 +8412,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mNextAppTransitionThumbnail.getHeight());
|
||||
try {
|
||||
Surface surface = new Surface(mFxSession, Process.myPid(),
|
||||
"thumbnail anim", Display.DEFAULT_DISPLAY,
|
||||
"thumbnail anim", mDefaultDisplay.getLayerStack(),
|
||||
dirty.width(), dirty.height(),
|
||||
PixelFormat.TRANSLUCENT, Surface.HIDDEN);
|
||||
topOpeningApp.mAppAnimator.thumbnail = surface;
|
||||
@@ -8676,7 +8680,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
Slog.v(TAG, "performLayoutAndPlaceSurfacesLockedInner: entry. Called by "
|
||||
+ Debug.getCallers(3));
|
||||
}
|
||||
if (mDisplay == null) {
|
||||
if (mDefaultDisplay == null) {
|
||||
Slog.i(TAG, "skipping performLayoutAndPlaceSurfacesLockedInner with no mDisplay");
|
||||
return;
|
||||
}
|
||||
@@ -9587,7 +9591,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDisplay == null || !mPolicy.isScreenOnFully()) {
|
||||
if (mDefaultDisplay == null || !mPolicy.isScreenOnFully()) {
|
||||
// No need to freeze the screen before the system is ready or if
|
||||
// the screen is off.
|
||||
return;
|
||||
@@ -9620,9 +9624,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
// TODO(multidisplay): rotation on main screen only.
|
||||
DisplayInfo displayInfo = getDefaultDisplayContent().getDisplayInfo();
|
||||
mAnimator.mScreenRotationAnimation = new ScreenRotationAnimation(mContext, mDisplay,
|
||||
mFxSession, inTransaction, displayInfo.logicalWidth, displayInfo.logicalHeight,
|
||||
mDisplay.getRotation());
|
||||
mAnimator.mScreenRotationAnimation = new ScreenRotationAnimation(mContext,
|
||||
mDefaultDisplay, mFxSession, inTransaction, displayInfo.logicalWidth,
|
||||
displayInfo.logicalHeight, mDefaultDisplay.getRotation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9733,7 +9737,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (line != null) {
|
||||
String[] toks = line.split("%");
|
||||
if (toks != null && toks.length > 0) {
|
||||
mWatermark = new Watermark(mDisplay, mRealDisplayMetrics, mFxSession, toks);
|
||||
mWatermark =
|
||||
new Watermark(mDefaultDisplay, mRealDisplayMetrics, mFxSession, toks);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
@@ -10101,7 +10106,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
pw.println();
|
||||
if (mDisplay != null) {
|
||||
if (mDefaultDisplay != null) {
|
||||
DisplayContentsIterator dCIterator = new DisplayContentsIterator();
|
||||
while (dCIterator.hasNext()) {
|
||||
dCIterator.next().dump(pw);
|
||||
@@ -10428,7 +10433,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
public DisplayContent getDisplayContent(final int displayId) {
|
||||
DisplayContent displayContent = mDisplayContents.get(displayId);
|
||||
if (displayContent == null) {
|
||||
displayContent = new DisplayContent(mDisplayManager, displayId);
|
||||
displayContent = new DisplayContent(mDisplayManager.getRealDisplay(displayId));
|
||||
mDisplayContents.put(displayId, displayContent);
|
||||
}
|
||||
return displayContent;
|
||||
@@ -10497,7 +10502,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
} else {
|
||||
mWindowListIndex++;
|
||||
if (mWindowListIndex >= mWindowList.size() && mDisplayContentsIterator.hasNext()) {
|
||||
if (mWindowListIndex >= mWindowList.size()
|
||||
&& mDisplayContentsIterator.hasNext()) {
|
||||
mDisplayContent = mDisplayContentsIterator.next();
|
||||
mWindowList = mDisplayContent.getWindowList();
|
||||
mWindowListIndex = 0;
|
||||
@@ -10515,7 +10521,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
|
||||
public DisplayContent getDefaultDisplayContent() {
|
||||
return getDisplayContent(Display.DEFAULT_DISPLAY);
|
||||
final int displayId = mDefaultDisplay == null
|
||||
? Display.DEFAULT_DISPLAY : mDefaultDisplay.getDisplayId();
|
||||
return getDisplayContent(displayId);
|
||||
}
|
||||
|
||||
public WindowList getDefaultWindowList() {
|
||||
|
||||
@@ -148,6 +148,8 @@ class WindowStateAnimator {
|
||||
int mAttrFlags;
|
||||
int mAttrType;
|
||||
|
||||
final int mLayerStack;
|
||||
|
||||
public WindowStateAnimator(final WindowState win) {
|
||||
final WindowManagerService service = win.mService;
|
||||
|
||||
@@ -167,6 +169,7 @@ class WindowStateAnimator {
|
||||
mAttrFlags = win.mAttrs.flags;
|
||||
mAttrType = win.mAttrs.type;
|
||||
mIsWallpaper = win.mIsWallpaper;
|
||||
mLayerStack = win.mDisplayContent.getDisplay().getLayerStack();
|
||||
}
|
||||
|
||||
public void setAnimation(Animation anim) {
|
||||
@@ -651,12 +654,12 @@ class WindowStateAnimator {
|
||||
mSurface = new SurfaceTrace(
|
||||
mSession.mSurfaceSession, mSession.mPid,
|
||||
attrs.getTitle().toString(),
|
||||
mWin.mDisplayContent.getDisplayId(), w, h, format, flags);
|
||||
mLayerStack, w, h, format, flags);
|
||||
} else {
|
||||
mSurface = new Surface(
|
||||
mSession.mSurfaceSession, mSession.mPid,
|
||||
attrs.getTitle().toString(),
|
||||
mWin.mDisplayContent.getDisplayId(), w, h, format, flags);
|
||||
mLayerStack, w, h, format, flags);
|
||||
}
|
||||
mWin.mHasSurface = true;
|
||||
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG,
|
||||
|
||||
Reference in New Issue
Block a user