Skip to content

Commit ec19961

Browse files
author
Jean-Baptiste Queru
committed
Merge into jb-mr1-dev
Change-Id: I97ff2551b36a1b590f2d314cabfcf198dd10f404
2 parents 7a7c6aa + 8d0243a commit ec19961

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

core/java/android/view/SurfaceView.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ private void updateWindow(boolean force, boolean redrawNeeded) {
456456
}
457457

458458
if (mWindow == null) {
459+
Display display = getDisplay();
459460
mWindow = new MyWindow(this);
460461
mLayout.type = mWindowType;
461462
mLayout.gravity = Gravity.START|Gravity.TOP;
462463
mSession.addToDisplayWithoutInputChannel(mWindow, mWindow.mSeq, mLayout,
463-
mVisible ? VISIBLE : GONE, Display.DEFAULT_DISPLAY, mContentInsets);
464+
mVisible ? VISIBLE : GONE, display.getDisplayId(), mContentInsets);
464465
}
465466

466467
boolean realSizeChanged;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ public boolean performDrag(IWindow window, IBinder dragToken,
280280
// !!! FIXME: put all this heavy stuff onto the mH looper, as well as
281281
// the actual drag event dispatch stuff in the dragstate
282282

283-
mService.mDragState.register(callingWin.mDisplayContent.getDisplay());
283+
Display display = callingWin.mDisplayContent.getDisplay();
284+
mService.mDragState.register(display);
284285
mService.mInputMonitor.updateInputWindowsLw(true /*force*/);
285286
if (!mService.mInputManager.transferTouchFocus(callingWin.mInputChannel,
286287
mService.mDragState.mServerChannel)) {
@@ -310,6 +311,7 @@ public boolean performDrag(IWindow window, IBinder dragToken,
310311
touchY - thumbCenterY);
311312
surface.setAlpha(.7071f);
312313
surface.setLayer(mService.mDragState.getDragLayerLw());
314+
surface.setLayerStack(display.getLayerStack());
313315
surface.show();
314316
} finally {
315317
Surface.closeTransaction();

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9777,7 +9777,7 @@ private boolean updateFocusedWindowLocked(int mode, boolean updateInputWindows)
97779777
if (moveInputMethodWindowsIfNeededLocked(
97789778
mode != UPDATE_FOCUS_WILL_ASSIGN_LAYERS &&
97799779
mode != UPDATE_FOCUS_WILL_PLACE_SURFACES)) {
9780-
getDefaultDisplayContentLocked().layoutNeeded = true;
9780+
displayContent.layoutNeeded = true;
97819781
}
97829782
if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
97839783
performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
@@ -9791,7 +9791,7 @@ private boolean updateFocusedWindowLocked(int mode, boolean updateInputWindows)
97919791

97929792
if ((focusChanged & WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT) != 0) {
97939793
// The change in focus caused us to need to do a layout. Okay.
9794-
getDefaultDisplayContentLocked().layoutNeeded = true;
9794+
displayContent.layoutNeeded = true;
97959795
if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
97969796
performLayoutLockedInner(displayContent, true /*initial*/, updateInputWindows);
97979797
}
@@ -9814,22 +9814,29 @@ private void finishUpdateFocusedWindowAfterAssignLayersLocked(boolean updateInpu
98149814
}
98159815

98169816
private WindowState computeFocusedWindowLocked() {
9817-
WindowState result = null;
9818-
WindowState win;
9819-
98209817
if (mAnimator.mUniverseBackground != null
98219818
&& mAnimator.mUniverseBackground.mWin.canReceiveKeys()) {
98229819
return mAnimator.mUniverseBackground.mWin;
98239820
}
98249821

9822+
final int displayCount = mDisplayContents.size();
9823+
for (int i = 0; i < displayCount; i++) {
9824+
final DisplayContent displayContent = mDisplayContents.valueAt(i);
9825+
WindowState win = findFocusedWindowLocked(displayContent);
9826+
if (win != null) {
9827+
return win;
9828+
}
9829+
}
9830+
return null;
9831+
}
9832+
9833+
private WindowState findFocusedWindowLocked(DisplayContent displayContent) {
98259834
int nextAppIndex = mAppTokens.size()-1;
9826-
WindowToken nextApp = nextAppIndex >= 0
9827-
? mAppTokens.get(nextAppIndex) : null;
9835+
WindowToken nextApp = nextAppIndex >= 0 ? mAppTokens.get(nextAppIndex) : null;
98289836

9829-
// TODO(multidisplay): IMEs are only supported on the default display.
9830-
WindowList windows = getDefaultWindowListLocked();
9837+
final WindowList windows = displayContent.getWindowList();
98319838
for (int i = windows.size() - 1; i >= 0; i--) {
9832-
win = windows.get(i);
9839+
final WindowState win = windows.get(i);
98339840

98349841
if (localLOGV || DEBUG_FOCUS) Slog.v(
98359842
TAG, "Looking for focus: " + i
@@ -9879,12 +9886,10 @@ private WindowState computeFocusedWindowLocked() {
98799886
if (win.canReceiveKeys()) {
98809887
if (DEBUG_FOCUS) Slog.v(
98819888
TAG, "Found focus @ " + i + " = " + win);
9882-
result = win;
9883-
break;
9889+
return win;
98849890
}
98859891
}
9886-
9887-
return result;
9892+
return null;
98889893
}
98899894

98909895
private void startFreezingDisplayLocked(boolean inTransaction,

0 commit comments

Comments
 (0)