summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJamie Gennis <jgennis@google.com>2011-10-10 15:48:06 -0700
committerJamie Gennis <jgennis@google.com>2011-10-11 13:34:01 -0700
commite2909e121c45d58fe587849b1474c80745fcd2b9 (patch)
tree00ec207d638a9815966e4d7f2c4808dcdd28d9b6 /services
parent99f36683a4f2c218d52922ae7c2a0c0b3f2890ed (diff)
downloadframeworks_base-e2909e121c45d58fe587849b1474c80745fcd2b9.zip
frameworks_base-e2909e121c45d58fe587849b1474c80745fcd2b9.tar.gz
frameworks_base-e2909e121c45d58fe587849b1474c80745fcd2b9.tar.bz2
SurfaceFlinger: update orientation via transactions
This change merges the ISurfaceComposer::setOrientation functionality into ISurfaceComposer::setTransactionState. It enables the window manager to atomically update both the display orientation and the position and size of the windows in a single transaction with SurfaceFlinger. Bug: 5439574 Change-Id: I18a8ccc564d7d760ef8afb2d015ccdb7a7963900
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java39
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp14
-rw-r--r--services/surfaceflinger/SurfaceFlinger.h3
3 files changed, 32 insertions, 24 deletions
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 06a6e98..595c256 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -5230,32 +5230,27 @@ public class WindowManagerService extends IWindowManager.Stub
startFreezingDisplayLocked(inTransaction);
mInputManager.setDisplayOrientation(0, rotation);
- // NOTE: We disable the rotation in the emulator because
- // it doesn't support hardware OpenGL emulation yet.
- if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
- && mScreenRotationAnimation.hasScreenshot()) {
- Surface.freezeDisplay(0);
+ if (!inTransaction) {
+ if (SHOW_TRANSACTIONS) Slog.i(TAG,
+ ">>> OPEN TRANSACTION setRotationUnchecked");
+ Surface.openTransaction();
+ }
+ try {
+ // NOTE: We disable the rotation in the emulator because
+ // it doesn't support hardware OpenGL emulation yet.
+ if (CUSTOM_SCREEN_ROTATION && mScreenRotationAnimation != null
+ && mScreenRotationAnimation.hasScreenshot()) {
+ mScreenRotationAnimation.setRotation(rotation);
+ }
+ Surface.setOrientation(0, rotation);
+ } finally {
if (!inTransaction) {
+ Surface.closeTransaction();
if (SHOW_TRANSACTIONS) Slog.i(TAG,
- ">>> OPEN TRANSACTION setRotationUnchecked");
- Surface.openTransaction();
+ "<<< CLOSE TRANSACTION setRotationUnchecked");
}
- try {
- if (mScreenRotationAnimation != null) {
- mScreenRotationAnimation.setRotation(rotation);
- }
- } finally {
- if (!inTransaction) {
- Surface.closeTransaction();
- if (SHOW_TRANSACTIONS) Slog.i(TAG,
- "<<< CLOSE TRANSACTION setRotationUnchecked");
- }
- }
- Surface.setOrientation(0, rotation);
- Surface.unfreezeDisplay(0);
- } else {
- Surface.setOrientation(0, rotation);
}
+
rebuildBlackFrame(inTransaction);
for (int i=mWindows.size()-1; i>=0; i--) {
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 195ad2e..1441a54 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1234,10 +1234,22 @@ uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags)
}
-void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state) {
+void SurfaceFlinger::setTransactionState(const Vector<ComposerState>& state,
+ int orientation) {
Mutex::Autolock _l(mStateLock);
uint32_t flags = 0;
+ if (mCurrentState.orientation != orientation) {
+ if (uint32_t(orientation)<=eOrientation270 || orientation==42) {
+ mCurrentState.orientation = orientation;
+ flags |= eTransactionNeeded;
+ mResizeTransationPending = true;
+ } else if (orientation != eOrientationUnchanged) {
+ LOGW("setTransactionState: ignoring unrecognized orientation: %d",
+ orientation);
+ }
+ }
+
const size_t count = state.size();
for (size_t i=0 ; i<count ; i++) {
const ComposerState& s(state[i]);
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 1cb9be2..0e642c1 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -167,7 +167,8 @@ public:
virtual sp<IGraphicBufferAlloc> createGraphicBufferAlloc();
virtual sp<IMemoryHeap> getCblk() const;
virtual void bootFinished();
- virtual void setTransactionState(const Vector<ComposerState>& state);
+ virtual void setTransactionState(const Vector<ComposerState>& state,
+ int orientation);
virtual status_t freezeDisplay(DisplayID dpy, uint32_t flags);
virtual status_t unfreezeDisplay(DisplayID dpy, uint32_t flags);
virtual int setOrientation(DisplayID dpy, int orientation, uint32_t flags);