Skip to content

Commit 5a052a4

Browse files
author
Dianne Hackborn
committed
Fix issue #6955586: No navigation bar in landscape on tablets
The window manager was telling the activity manager to evaluate the new configuration when first initializing the display, before actually setting mDisplay, so it failed creating that first config. Change-Id: I6e94fcf55b0587ccf15a5fd7ecbe2c9a0c201b96
1 parent abac0cd commit 5a052a4

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

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

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5868,7 +5868,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
58685868
}
58695869
}
58705870

5871-
rebuildBlackFrame();
5871+
rebuildBlackFrameLocked();
58725872

58735873
final WindowList windows = displayContent.getWindowList();
58745874
for (int i = windows.size() - 1; i >= 0; i--) {
@@ -6885,6 +6885,8 @@ public void displayReady() {
68856885
displayReady(Display.DEFAULT_DISPLAY);
68866886

68876887
synchronized(mWindowMap) {
6888+
readForcedDisplaySizeAndDensityLocked(getDefaultDisplayContent());
6889+
68886890
WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
68896891
mDisplay = wm.getDefaultDisplay();
68906892
mIsTouchDevice = mContext.getPackageManager().hasSystemFeature(
@@ -6906,6 +6908,11 @@ public void displayReady() {
69066908
mPolicy.setInitialDisplaySize(mDisplay, displayContent.mInitialDisplayWidth,
69076909
displayContent.mInitialDisplayHeight, displayContent.mInitialDisplayDensity);
69086910
}
6911+
6912+
try {
6913+
mActivityManager.updateConfiguration(null);
6914+
} catch (RemoteException e) {
6915+
}
69096916
}
69106917

69116918
public void displayReady(int displayId) {
@@ -6924,15 +6931,6 @@ public void displayReady(int displayId) {
69246931
displayContent.mBaseDisplayDensity = displayContent.mInitialDisplayDensity;
69256932
}
69266933
}
6927-
6928-
try {
6929-
mActivityManager.updateConfiguration(null);
6930-
} catch (RemoteException e) {
6931-
}
6932-
6933-
synchronized (mWindowMap) {
6934-
readForcedDisplaySizeAndDensityLocked(getDisplayContent(displayId));
6935-
}
69366934
}
69376935

69386936
public void systemReady() {
@@ -7561,7 +7559,7 @@ public void setForcedDisplaySize(int displayId, int longDimen, int shortDimen) {
75617559
}
75627560
}
75637561

7564-
private void rebuildBlackFrame() {
7562+
private void rebuildBlackFrameLocked() {
75657563
if (mBlackFrame != null) {
75667564
mBlackFrame.kill();
75677565
mBlackFrame = null;
@@ -7573,6 +7571,13 @@ private void rebuildBlackFrame() {
75737571
int initW, initH, baseW, baseH;
75747572
final boolean rotated = (mRotation == Surface.ROTATION_90
75757573
|| mRotation == Surface.ROTATION_270);
7574+
if (DEBUG_BOOT) {
7575+
Slog.i(TAG, "BLACK FRAME: rotated=" + rotated + " init="
7576+
+ displayContent.mInitialDisplayWidth + "x"
7577+
+ displayContent.mInitialDisplayHeight + " base="
7578+
+ displayContent.mBaseDisplayWidth + "x"
7579+
+ displayContent.mBaseDisplayHeight);
7580+
}
75767581
if (rotated) {
75777582
initW = displayContent.mInitialDisplayHeight;
75787583
initH = displayContent.mInitialDisplayWidth;
@@ -7634,7 +7639,7 @@ private void readForcedDisplaySizeAndDensityLocked(final DisplayContent displayC
76347639
}
76357640
}
76367641
if (changed) {
7637-
reconfigureDisplayLocked(displayContent);
7642+
rebuildBlackFrameLocked();
76387643
}
76397644
}
76407645

@@ -7663,7 +7668,7 @@ public void setForcedDisplayDensity(int displayId, int density) {
76637668
final DisplayContent displayContent = getDisplayContent(displayId);
76647669
setForcedDisplayDensityLocked(displayContent, density);
76657670
Settings.Secure.putString(mContext.getContentResolver(),
7666-
Settings.Secure.DISPLAY_SIZE_FORCED, Integer.toString(density));
7671+
Settings.Secure.DISPLAY_DENSITY_FORCED, Integer.toString(density));
76677672
}
76687673
}
76697674

@@ -7706,7 +7711,7 @@ private void reconfigureDisplayLocked(DisplayContent displayContent) {
77067711
mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION);
77077712
}
77087713

7709-
rebuildBlackFrame();
7714+
rebuildBlackFrameLocked();
77107715

77117716
performLayoutAndPlaceSurfacesLocked();
77127717
}

0 commit comments

Comments
 (0)