diff options
| author | Jeff Brown <jeffbrown@google.com> | 2012-09-07 16:00:12 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-07 16:00:13 -0700 |
| commit | 7017e48380ab0c1be033594bb2a9331898ad5be8 (patch) | |
| tree | 1e24e747937706deb96ac1770f71a9c4cb6ebc65 /services/java/com/android/server/display/DisplayDevice.java | |
| parent | cd620591b764cd999f18878985444fba01d5b710 (diff) | |
| parent | cbad976b2a36a0895ca94510d5208a86f66cf596 (diff) | |
| download | frameworks_base-7017e48380ab0c1be033594bb2a9331898ad5be8.zip frameworks_base-7017e48380ab0c1be033594bb2a9331898ad5be8.tar.gz frameworks_base-7017e48380ab0c1be033594bb2a9331898ad5be8.tar.bz2 | |
Merge "Add support for Wifi display." into jb-mr1-dev
Diffstat (limited to 'services/java/com/android/server/display/DisplayDevice.java')
| -rw-r--r-- | services/java/com/android/server/display/DisplayDevice.java | 58 |
1 files changed, 32 insertions, 26 deletions
diff --git a/services/java/com/android/server/display/DisplayDevice.java b/services/java/com/android/server/display/DisplayDevice.java index bdc87f9..995c553 100644 --- a/services/java/com/android/server/display/DisplayDevice.java +++ b/services/java/com/android/server/display/DisplayDevice.java @@ -17,7 +17,6 @@ package com.android.server.display; import android.graphics.Rect; -import android.graphics.SurfaceTexture; import android.os.IBinder; import android.view.Surface; @@ -41,9 +40,9 @@ abstract class DisplayDevice { private Rect mCurrentLayerStackRect; private Rect mCurrentDisplayRect; - // The display device does own its surface texture, but it should only set it + // The display device owns its surface, but it should only set it // within a transaction from performTraversalInTransactionLocked. - private SurfaceTexture mCurrentSurfaceTexture; + private Surface mCurrentSurface; public DisplayDevice(DisplayAdapter displayAdapter, IBinder displayToken) { mDisplayAdapter = displayAdapter; @@ -109,11 +108,10 @@ abstract class DisplayDevice { * Sets the display layer stack while in a transaction. */ public final void setLayerStackInTransactionLocked(int layerStack) { - if (mCurrentLayerStack == layerStack) { - return; + if (mCurrentLayerStack != layerStack) { + mCurrentLayerStack = layerStack; + Surface.setDisplayLayerStack(mDisplayToken, layerStack); } - mCurrentLayerStack = layerStack; - Surface.setDisplayLayerStack(mDisplayToken, layerStack); } /** @@ -126,28 +124,35 @@ abstract class DisplayDevice { * mapped to. displayRect is specified post-orientation, that is * it uses the orientation seen by the end-user */ - public final void setProjectionInTransactionLocked(int orientation, Rect layerStackRect, Rect displayRect) { - mCurrentOrientation = orientation; - if (mCurrentLayerStackRect == null) { - mCurrentLayerStackRect = new Rect(); + public final void setProjectionInTransactionLocked(int orientation, + Rect layerStackRect, Rect displayRect) { + if (mCurrentOrientation != orientation + || mCurrentLayerStackRect == null + || !mCurrentLayerStackRect.equals(layerStackRect) + || mCurrentDisplayRect == null + || !mCurrentDisplayRect.equals(displayRect)) { + mCurrentOrientation = orientation; + if (mCurrentLayerStackRect == null) { + mCurrentLayerStackRect = new Rect(); + } + mCurrentLayerStackRect.set(layerStackRect); + if (mCurrentDisplayRect == null) { + mCurrentDisplayRect = new Rect(); + } + mCurrentDisplayRect.set(displayRect); + Surface.setDisplayProjection(mDisplayToken, + orientation, layerStackRect, displayRect); } - mCurrentLayerStackRect.set(layerStackRect); - if (mCurrentDisplayRect == null) { - mCurrentDisplayRect = new Rect(); - } - mCurrentDisplayRect.set(displayRect); - Surface.setDisplayProjection(mDisplayToken, orientation, layerStackRect, displayRect); } /** - * Sets the surface texture while in a transaction. + * Sets the display surface while in a transaction. */ - public final void setSurfaceTextureInTransactionLocked(SurfaceTexture surfaceTexture) { - if (mCurrentSurfaceTexture == surfaceTexture) { - return; + public final void setSurfaceInTransactionLocked(Surface surface) { + if (mCurrentSurface != surface) { + mCurrentSurface = surface; + Surface.setDisplaySurface(mDisplayToken, surface); } - mCurrentSurfaceTexture = surfaceTexture; - Surface.setDisplaySurface(mDisplayToken, surfaceTexture); } /** @@ -156,10 +161,11 @@ abstract class DisplayDevice { */ public void dumpLocked(PrintWriter pw) { pw.println("mAdapter=" + mDisplayAdapter.getName()); + pw.println("mDisplayToken=" + mDisplayToken); pw.println("mCurrentLayerStack=" + mCurrentLayerStack); pw.println("mCurrentOrientation=" + mCurrentOrientation); - pw.println("mCurrentViewport=" + mCurrentLayerStackRect); - pw.println("mCurrentFrame=" + mCurrentDisplayRect); - pw.println("mCurrentSurfaceTexture=" + mCurrentSurfaceTexture); + pw.println("mCurrentLayerStackRect=" + mCurrentLayerStackRect); + pw.println("mCurrentDisplayRect=" + mCurrentDisplayRect); + pw.println("mCurrentSurface=" + mCurrentSurface); } } |
