@@ -91,8 +91,10 @@ class Composer : public Singleton<Composer>
9191
9292 mutable Mutex mLock ;
9393 SortedVector<ComposerState> mStates ;
94+ int mOrientation ;
9495
95- Composer () : Singleton<Composer>() { }
96+ Composer () : Singleton<Composer>(),
97+ mOrientation (ISurfaceComposer::eOrientationUnchanged) { }
9698
9799 void closeGlobalTransactionImpl ();
98100
@@ -119,6 +121,7 @@ class Composer : public Singleton<Composer>
119121 status_t setFreezeTint (
120122 const sp<SurfaceComposerClient>& client, SurfaceID id,
121123 uint32_t tint);
124+ status_t setOrientation (int orientation);
122125
123126 static void closeGlobalTransaction () {
124127 Composer::getInstance ().closeGlobalTransactionImpl ();
@@ -133,14 +136,18 @@ void Composer::closeGlobalTransactionImpl() {
133136 sp<ISurfaceComposer> sm (getComposerService ());
134137
135138 Vector<ComposerState> transaction;
139+ int orientation;
136140
137141 { // scope for the lock
138142 Mutex::Autolock _l (mLock );
139143 transaction = mStates ;
140144 mStates .clear ();
145+
146+ orientation = mOrientation ;
147+ mOrientation = ISurfaceComposer::eOrientationUnchanged;
141148 }
142149
143- sm->setTransactionState (transaction);
150+ sm->setTransactionState (transaction, orientation );
144151}
145152
146153layer_state_t * Composer::getLayerStateLocked (
@@ -260,6 +267,12 @@ status_t Composer::setFreezeTint(const sp<SurfaceComposerClient>& client,
260267 return NO_ERROR;
261268}
262269
270+ status_t Composer::setOrientation (int orientation) {
271+ Mutex::Autolock _l (mLock );
272+ mOrientation = orientation;
273+ return NO_ERROR;
274+ }
275+
263276// ---------------------------------------------------------------------------
264277
265278SurfaceComposerClient::SurfaceComposerClient ()
@@ -427,6 +440,12 @@ status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx,
427440 return getComposer ().setMatrix (this , id, dsdx, dtdx, dsdy, dtdy);
428441}
429442
443+ status_t SurfaceComposerClient::setOrientation (DisplayID dpy,
444+ int orientation, uint32_t flags)
445+ {
446+ return Composer::getInstance ().setOrientation (orientation);
447+ }
448+
430449// ----------------------------------------------------------------------------
431450
432451status_t SurfaceComposerClient::getDisplayInfo (
@@ -491,21 +510,14 @@ ssize_t SurfaceComposerClient::getNumberOfDisplays()
491510
492511status_t SurfaceComposerClient::freezeDisplay (DisplayID dpy, uint32_t flags)
493512{
494- sp<ISurfaceComposer> sm ( getComposerService ());
495- return sm-> freezeDisplay (dpy, flags) ;
513+ // This has been made a no-op because it can cause Gralloc buffer deadlocks.
514+ return NO_ERROR ;
496515}
497516
498517status_t SurfaceComposerClient::unfreezeDisplay (DisplayID dpy, uint32_t flags)
499518{
500- sp<ISurfaceComposer> sm (getComposerService ());
501- return sm->unfreezeDisplay (dpy, flags);
502- }
503-
504- int SurfaceComposerClient::setOrientation (DisplayID dpy,
505- int orientation, uint32_t flags)
506- {
507- sp<ISurfaceComposer> sm (getComposerService ());
508- return sm->setOrientation (dpy, orientation, flags);
519+ // This has been made a no-op because it can cause Gralloc buffer deadlocks.
520+ return NO_ERROR;
509521}
510522
511523// ----------------------------------------------------------------------------
@@ -572,4 +584,3 @@ size_t ScreenshotClient::getSize() const {
572584
573585// ----------------------------------------------------------------------------
574586}; // namespace android
575-
0 commit comments