Skip to content

Commit 3699174

Browse files
author
Dianne Hackborn
committed
Fix issue #5445966: WindowManager reporting -long on prime when it shouldn't be.
The window manager now uses the app screen dimensions to compute the various configuration properties, as it should. This means that prime is official a "not long" device. Poor prime. It probably feels inadequate now. Because it is. Oh and all that other stuff? Debugging logs. Turned off. And why the heck not, debugging logs are great. Change-Id: Iaaf8ef270d986d34fd046d699ef4c0ecea1981fc
1 parent 99b70f3 commit 3699174

File tree

6 files changed

+43
-23
lines changed

6 files changed

+43
-23
lines changed

core/java/android/view/Display.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@ private void getSizeInternal(Point outSize, boolean doCompat) {
117117
outSize.x = getRawWidth();
118118
outSize.y = getRawHeight();
119119
}
120+
if (false) {
121+
RuntimeException here = new RuntimeException("here");
122+
here.fillInStackTrace();
123+
Slog.v(TAG, "Returning display size: " + outSize, here);
124+
}
120125
if (DEBUG_DISPLAY_SIZE && doCompat) Slog.v(
121126
TAG, "Returning display size: " + outSize);
122127
} catch (RemoteException e) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ void notifyMoveLw(float x, float y) {
274274
final int myPid = Process.myPid();
275275

276276
// Move the surface to the given touch
277-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
277+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
278+
WindowManagerService.TAG, ">>> OPEN TRANSACTION notifyMoveLw");
278279
Surface.openTransaction();
279280
try {
280281
mSurface.setPosition(x - mThumbOffsetX, y - mThumbOffsetY);
@@ -283,7 +284,8 @@ void notifyMoveLw(float x, float y) {
283284
(int)(x - mThumbOffsetX) + "," + (int)(y - mThumbOffsetY) + ")");
284285
} finally {
285286
Surface.closeTransaction();
286-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, "<<< CLOSE TRANSACTION notifyMoveLw");
287+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
288+
WindowManagerService.TAG, "<<< CLOSE TRANSACTION notifyMoveLw");
287289
}
288290

289291
// Tell the affected window

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public ScreenRotationAnimation(Context context, SurfaceSession session,
8181
mOriginalHeight = originalHeight;
8282

8383
if (!inTransaction) {
84-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
84+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
8585
">>> OPEN TRANSACTION ScreenRotationAnimation");
8686
Surface.openTransaction();
8787
}
@@ -117,7 +117,7 @@ public ScreenRotationAnimation(Context context, SurfaceSession session,
117117
mSurface = null;
118118
return;
119119
}
120-
120+
121121
Paint paint = new Paint(0);
122122
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
123123
c.drawBitmap(screenshot, 0, 0, paint);
@@ -127,7 +127,7 @@ public ScreenRotationAnimation(Context context, SurfaceSession session,
127127
} finally {
128128
if (!inTransaction) {
129129
Surface.closeTransaction();
130-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
130+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
131131
"<<< CLOSE TRANSACTION ScreenRotationAnimation");
132132
}
133133

@@ -254,7 +254,7 @@ public boolean dismiss(SurfaceSession session, long maxAnimationDuration,
254254
mEnterAnimation.restrictDuration(maxAnimationDuration);
255255
mEnterAnimation.scaleCurrentDuration(animationScale);
256256

257-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
257+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
258258
">>> OPEN TRANSACTION ScreenRotationAnimation.dismiss");
259259
Surface.openTransaction();
260260

@@ -266,7 +266,7 @@ public boolean dismiss(SurfaceSession session, long maxAnimationDuration,
266266
Slog.w(TAG, "Unable to allocate black surface", e);
267267
} finally {
268268
Surface.closeTransaction();
269-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
269+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
270270
"<<< CLOSE TRANSACTION ScreenRotationAnimation.dismiss");
271271
}
272272

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,8 @@ public boolean performDrag(IWindow window, IBinder dragToken,
278278

279279
// Make the surface visible at the proper location
280280
final Surface surface = mService.mDragState.mSurface;
281-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
281+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
282+
WindowManagerService.TAG, ">>> OPEN TRANSACTION performDrag");
282283
Surface.openTransaction();
283284
try {
284285
surface.setPosition(touchX - thumbCenterX,
@@ -288,7 +289,8 @@ public boolean performDrag(IWindow window, IBinder dragToken,
288289
surface.show();
289290
} finally {
290291
Surface.closeTransaction();
291-
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, "<<< CLOSE TRANSACTION performDrag");
292+
if (WindowManagerService.SHOW_LIGHT_TRANSACTIONS) Slog.i(
293+
WindowManagerService.TAG, "<<< CLOSE TRANSACTION performDrag");
292294
}
293295
}
294296

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

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public class WindowManagerService extends IWindowManager.Stub
169169
static final boolean DEBUG_SCREENSHOT = false;
170170
static final boolean SHOW_SURFACE_ALLOC = false;
171171
static final boolean SHOW_TRANSACTIONS = false;
172+
static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS;
172173
static final boolean HIDE_STACK_CRAWLS = true;
173174

174175
static final boolean PROFILE_ORIENTATION = false;
@@ -2369,7 +2370,7 @@ void setTransparentRegionWindow(Session session, IWindow client, Region region)
23692370
synchronized (mWindowMap) {
23702371
WindowState w = windowForClientLocked(session, client, false);
23712372
if ((w != null) && (w.mSurface != null)) {
2372-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
2373+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
23732374
">>> OPEN TRANSACTION setTransparentRegion");
23742375
Surface.openTransaction();
23752376
try {
@@ -2378,7 +2379,7 @@ void setTransparentRegionWindow(Session session, IWindow client, Region region)
23782379
w.mSurface.setTransparentRegionHint(region);
23792380
} finally {
23802381
Surface.closeTransaction();
2381-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
2382+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
23822383
"<<< CLOSE TRANSACTION setTransparentRegion");
23832384
}
23842385
}
@@ -4905,7 +4906,8 @@ public void showStrictModeViolation(boolean on) {
49054906
}
49064907
}
49074908

4908-
if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION showStrictModeViolation");
4909+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
4910+
">>> OPEN TRANSACTION showStrictModeViolation");
49094911
Surface.openTransaction();
49104912
try {
49114913
if (mStrictModeFlash == null) {
@@ -4914,7 +4916,8 @@ public void showStrictModeViolation(boolean on) {
49144916
mStrictModeFlash.setVisibility(on);
49154917
} finally {
49164918
Surface.closeTransaction();
4917-
if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION showStrictModeViolation");
4919+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
4920+
"<<< CLOSE TRANSACTION showStrictModeViolation");
49184921
}
49194922
}
49204923
}
@@ -5231,7 +5234,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
52315234
mInputManager.setDisplayOrientation(0, rotation);
52325235

52335236
if (!inTransaction) {
5234-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
5237+
if (SHOW_TRANSACTIONS) Slog.i(TAG,
52355238
">>> OPEN TRANSACTION setRotationUnchecked");
52365239
Surface.openTransaction();
52375240
}
@@ -5246,7 +5249,7 @@ public boolean updateRotationUncheckedLocked(boolean inTransaction) {
52465249
} finally {
52475250
if (!inTransaction) {
52485251
Surface.closeTransaction();
5249-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
5252+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
52505253
"<<< CLOSE TRANSACTION setRotationUnchecked");
52515254
}
52525255
}
@@ -5843,6 +5846,10 @@ boolean computeNewConfigurationLocked(Configuration config) {
58435846
final DisplayMetrics dm = mDisplayMetrics;
58445847
mAppDisplayWidth = mPolicy.getNonDecorDisplayWidth(dw, dh, mRotation);
58455848
mAppDisplayHeight = mPolicy.getNonDecorDisplayHeight(dw, dh, mRotation);
5849+
if (false) {
5850+
Slog.i(TAG, "Set app display size: " + mAppDisplayWidth
5851+
+ " x " + mAppDisplayHeight);
5852+
}
58465853
mDisplay.getMetricsWithSize(dm, mAppDisplayWidth, mAppDisplayHeight);
58475854

58485855
mCompatibleScreenScale = CompatibilityInfo.computeCompatibleScaling(dm,
@@ -5860,8 +5867,8 @@ boolean computeNewConfigurationLocked(Configuration config) {
58605867

58615868
// Compute the screen layout size class.
58625869
int screenLayout;
5863-
int longSize = dw;
5864-
int shortSize = dh;
5870+
int longSize = mAppDisplayWidth;
5871+
int shortSize = mAppDisplayHeight;
58655872
if (longSize < shortSize) {
58665873
int tmp = longSize;
58675874
longSize = shortSize;
@@ -6847,7 +6854,7 @@ public void setForcedDisplaySize(int longDimen, int shortDimen) {
68476854

68486855
private void rebuildBlackFrame(boolean inTransaction) {
68496856
if (!inTransaction) {
6850-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
6857+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
68516858
">>> OPEN TRANSACTION rebuildBlackFrame");
68526859
Surface.openTransaction();
68536860
}
@@ -6882,7 +6889,7 @@ private void rebuildBlackFrame(boolean inTransaction) {
68826889
} finally {
68836890
if (!inTransaction) {
68846891
Surface.closeTransaction();
6885-
if (SHOW_TRANSACTIONS) Slog.i(TAG,
6892+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
68866893
"<<< CLOSE TRANSACTION rebuildBlackFrame");
68876894
}
68886895
}
@@ -7354,7 +7361,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
73547361
createWatermark = true;
73557362
}
73567363

7357-
if (SHOW_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");
7364+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
7365+
">>> OPEN TRANSACTION performLayoutAndPlaceSurfaces");
73587366

73597367
Surface.openTransaction();
73607368

@@ -8463,7 +8471,8 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
84638471

84648472
Surface.closeTransaction();
84658473

8466-
if (SHOW_TRANSACTIONS) Slog.i(TAG, "<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
8474+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG,
8475+
"<<< CLOSE TRANSACTION performLayoutAndPlaceSurfaces");
84678476

84688477
if (mWatermark != null) {
84698478
mWatermark.drawIfNeeded();

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
final class WindowState implements WindowManagerPolicy.WindowState {
5858
static final boolean DEBUG_VISIBILITY = WindowManagerService.DEBUG_VISIBILITY;
5959
static final boolean SHOW_TRANSACTIONS = WindowManagerService.SHOW_TRANSACTIONS;
60+
static final boolean SHOW_LIGHT_TRANSACTIONS = WindowManagerService.SHOW_LIGHT_TRANSACTIONS;
6061
static final boolean SHOW_SURFACE_ALLOC = WindowManagerService.SHOW_SURFACE_ALLOC;
6162

6263
final WindowManagerService mService;
@@ -671,7 +672,7 @@ Surface createSurfaceLocked() {
671672
WindowManagerService.TAG, "Got surface: " + mSurface
672673
+ ", set left=" + mFrame.left + " top=" + mFrame.top
673674
+ ", animLayer=" + mAnimLayer);
674-
if (SHOW_TRANSACTIONS) {
675+
if (SHOW_LIGHT_TRANSACTIONS) {
675676
Slog.i(WindowManagerService.TAG, ">>> OPEN TRANSACTION createSurfaceLocked");
676677
WindowManagerService.logSurface(this, "CREATE pos=(" + mFrame.left
677678
+ "," + mFrame.top + ") (" +
@@ -700,7 +701,8 @@ Surface createSurfaceLocked() {
700701
mLastHidden = true;
701702
} finally {
702703
Surface.closeTransaction();
703-
if (SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, "<<< CLOSE TRANSACTION createSurfaceLocked");
704+
if (SHOW_LIGHT_TRANSACTIONS) Slog.i(WindowManagerService.TAG,
705+
"<<< CLOSE TRANSACTION createSurfaceLocked");
704706
}
705707
if (WindowManagerService.localLOGV) Slog.v(
706708
WindowManagerService.TAG, "Created surface " + this);

0 commit comments

Comments
 (0)