Skip to content

Commit 706708d

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Small step towards supporting multiple displays" into jb-mr1-dev
2 parents 527d14d + 6881a10 commit 706708d

17 files changed

+81
-44
lines changed

core/java/android/service/wallpaper/WallpaperService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import android.os.RemoteException;
4141
import android.util.Log;
4242
import android.util.LogPrinter;
43+
import android.view.Display;
4344
import android.view.Gravity;
4445
import android.view.IWindowSession;
4546
import android.view.InputChannel;
@@ -612,8 +613,8 @@ void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNee
612613
mLayout.windowAnimations =
613614
com.android.internal.R.style.Animation_Wallpaper;
614615
mInputChannel = new InputChannel();
615-
if (mSession.add(mWindow, mWindow.mSeq, mLayout, View.VISIBLE, mContentInsets,
616-
mInputChannel) < 0) {
616+
if (mSession.addToDisplay(mWindow, mWindow.mSeq, mLayout, View.VISIBLE,
617+
Display.DEFAULT_DISPLAY, mContentInsets, mInputChannel) < 0) {
617618
Log.w(TAG, "Failed to add window while updating wallpaper surface.");
618619
return;
619620
}

core/java/android/view/IWindowManager.aidl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import android.graphics.Bitmap;
2525
import android.graphics.Point;
2626
import android.graphics.Rect;
2727
import android.os.IRemoteCallback;
28-
import android.view.DisplayInfo;
2928
import android.view.IApplicationToken;
3029
import android.view.IOnKeyguardExitResult;
3130
import android.view.IRotationWatcher;

core/java/android/view/IWindowSession.aidl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ interface IWindowSession {
3737
int add(IWindow window, int seq, in WindowManager.LayoutParams attrs,
3838
in int viewVisibility, out Rect outContentInsets,
3939
out InputChannel outInputChannel);
40+
int addToDisplay(IWindow window, int seq, in WindowManager.LayoutParams attrs,
41+
in int viewVisibility, in int layerStackId, out Rect outContentInsets,
42+
out InputChannel outInputChannel);
4043
int addWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
4144
in int viewVisibility, out Rect outContentInsets);
45+
int addToDisplayWithoutInputChannel(IWindow window, int seq, in WindowManager.LayoutParams attrs,
46+
in int viewVisibility, in int layerStackId, out Rect outContentInsets);
4247
void remove(IWindow window);
4348

4449
/**

core/java/android/view/Surface.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,28 +248,28 @@ public OutOfResourcesException(String name) {
248248

249249
/** create a surface @hide */
250250
public Surface(SurfaceSession s,
251-
int pid, int display, int w, int h, int format, int flags)
251+
int pid, int displayId, int w, int h, int format, int flags)
252252
throws OutOfResourcesException {
253253
checkHeadless();
254254

255255
if (DEBUG_RELEASE) {
256256
mCreationStack = new Exception();
257257
}
258258
mCanvas = new CompatibleCanvas();
259-
init(s,pid,null,display,w,h,format,flags);
259+
init(s,pid,null,displayId,w,h,format,flags);
260260
}
261261

262262
/** create a surface with a name @hide */
263263
public Surface(SurfaceSession s,
264-
int pid, String name, int display, int w, int h, int format, int flags)
264+
int pid, String name, int displayId, int w, int h, int format, int flags)
265265
throws OutOfResourcesException {
266266
checkHeadless();
267267

268268
if (DEBUG_RELEASE) {
269269
mCreationStack = new Exception();
270270
}
271271
mCanvas = new CompatibleCanvas();
272-
init(s,pid,name,display,w,h,format,flags);
272+
init(s,pid,name,displayId,w,h,format,flags);
273273
mName = name;
274274
}
275275

@@ -508,7 +508,7 @@ protected void finalize() throws Throwable {
508508
}
509509

510510
private native void init(SurfaceSession s,
511-
int pid, String name, int display, int w, int h, int format, int flags)
511+
int pid, String name, int displayId, int w, int h, int format, int flags)
512512
throws OutOfResourcesException;
513513

514514
private native void init(Parcel source);

core/java/android/view/SurfaceView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ private void updateWindow(boolean force, boolean redrawNeeded) {
459459
mWindow = new MyWindow(this);
460460
mLayout.type = mWindowType;
461461
mLayout.gravity = Gravity.START|Gravity.TOP;
462-
mSession.addWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
463-
mVisible ? VISIBLE : GONE, mContentInsets);
462+
mSession.addToDisplayWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
463+
mVisible ? VISIBLE : GONE, Display.DEFAULT_DISPLAY, mContentInsets);
464464
}
465465

466466
boolean realSizeChanged;

core/java/android/view/ViewRootImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ public void setView(View view, WindowManager.LayoutParams attrs, View panelParen
544544
mOrigWindowType = mWindowAttributes.type;
545545
mAttachInfo.mRecomputeGlobalAttributes = true;
546546
collectViewAttributes();
547-
res = sWindowSession.add(mWindow, mSeq, mWindowAttributes,
548-
getHostVisibility(), mAttachInfo.mContentInsets,
549-
mInputChannel);
547+
res = sWindowSession.addToDisplay(mWindow, mSeq, mWindowAttributes,
548+
getHostVisibility(), Display.DEFAULT_DISPLAY,
549+
mAttachInfo.mContentInsets, mInputChannel);
550550
} catch (RemoteException e) {
551551
mAdded = false;
552552
mView = null;

services/java/com/android/server/wm/BlackFrame.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.graphics.PixelFormat;
2323
import android.graphics.Rect;
2424
import android.util.Slog;
25+
import android.view.Display;
2526
import android.view.Surface;
2627
import android.view.SurfaceSession;
2728

@@ -44,11 +45,11 @@ class BlackSurface {
4445
int h = b-t;
4546
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
4647
surface = new WindowStateAnimator.SurfaceTrace(session, 0, "BlackSurface("
47-
+ l + ", " + t + ")",
48-
-1, w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
48+
+ l + ", " + t + ")", Display.DEFAULT_DISPLAY,
49+
w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
4950
} else {
50-
surface = new Surface(session, 0, "BlackSurface",
51-
-1, w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
51+
surface = new Surface(session, 0, "BlackSurface", Display.DEFAULT_DISPLAY,
52+
w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
5253
}
5354
surface.setAlpha(1);
5455
surface.setLayer(layer);

services/java/com/android/server/wm/DimAnimator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ class DimAnimator {
3939

4040
int mLastDimWidth, mLastDimHeight;
4141

42-
DimAnimator (SurfaceSession session) {
42+
DimAnimator (SurfaceSession session, final int displayId) {
4343
if (mDimSurface == null) {
4444
try {
4545
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
4646
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
4747
"DimAnimator",
48-
-1, 16, 16, PixelFormat.OPAQUE,
48+
displayId, 16, 16, PixelFormat.OPAQUE,
4949
Surface.FX_SURFACE_DIM);
5050
} else {
5151
mDimSurface = new Surface(session, 0,
5252
"DimAnimator",
53-
-1, 16, 16, PixelFormat.OPAQUE,
53+
displayId, 16, 16, PixelFormat.OPAQUE,
5454
Surface.FX_SURFACE_DIM);
5555
}
5656
if (WindowManagerService.SHOW_TRANSACTIONS ||

services/java/com/android/server/wm/DimSurface.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ class DimSurface {
3030
int mLayer = -1;
3131
int mLastDimWidth, mLastDimHeight;
3232

33-
DimSurface(SurfaceSession session) {
33+
DimSurface(SurfaceSession session, final int displayId) {
3434
if (mDimSurface == null) {
3535
try {
3636
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
3737
mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
3838
"DimSurface",
39-
-1, 16, 16, PixelFormat.OPAQUE,
39+
displayId, 16, 16, PixelFormat.OPAQUE,
4040
Surface.FX_SURFACE_DIM);
4141
} else {
4242
mDimSurface = new Surface(session, 0,
4343
"DimSurface",
44-
-1, 16, 16, PixelFormat.OPAQUE,
44+
displayId, 16, 16, PixelFormat.OPAQUE,
4545
Surface.FX_SURFACE_DIM);
4646
}
4747
if (WindowManagerService.SHOW_TRANSACTIONS ||

services/java/com/android/server/wm/ScreenRotationAnimation.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import android.graphics.PixelFormat;
2626
import android.graphics.Rect;
2727
import android.util.Slog;
28+
import android.view.Display;
2829
import android.view.Surface;
2930
import android.view.SurfaceSession;
3031
import android.view.animation.Animation;
@@ -212,10 +213,12 @@ public ScreenRotationAnimation(Context context, SurfaceSession session,
212213
try {
213214
try {
214215
if (WindowManagerService.DEBUG_SURFACE_TRACE) {
215-
mSurface = new SurfaceTrace(session, 0, "FreezeSurface", -1, mWidth, mHeight,
216+
mSurface = new SurfaceTrace(session, 0, "FreezeSurface", Display.DEFAULT_DISPLAY,
217+
mWidth, mHeight,
216218
PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
217219
} else {
218-
mSurface = new Surface(session, 0, "FreezeSurface", -1, mWidth, mHeight,
220+
mSurface = new Surface(session, 0, "FreezeSurface", Display.DEFAULT_DISPLAY,
221+
mWidth, mHeight,
219222
PixelFormat.OPAQUE, Surface.FX_SURFACE_SCREENSHOT | Surface.HIDDEN);
220223
}
221224
if (!mSurface.isValid()) {

0 commit comments

Comments
 (0)