AI 143320: am: CL 143171 am: CL 142873 fix [1732012] Only show screen rotation animation when triggered by sensor
Original author: mathias
Merged from: //branches/cupcake/...
Original author: android-build
Merged from: //branches/donutburger/...
Automated import of CL 143320
diff --git a/libs/surfaceflinger/OrientationAnimation.h b/libs/surfaceflinger/OrientationAnimation.h
index b170dcb..cafa38d 100644
--- a/libs/surfaceflinger/OrientationAnimation.h
+++ b/libs/surfaceflinger/OrientationAnimation.h
@@ -36,11 +36,11 @@
OrientationAnimation(const sp<SurfaceFlinger>& flinger);
virtual ~OrientationAnimation();
- void onOrientationChanged();
+ void onOrientationChanged(uint32_t type);
void onAnimationFinished();
inline bool run() {
if (LIKELY(mState == DONE))
- return false;
+ return done_impl();
return run_impl();
}
@@ -54,7 +54,18 @@
};
bool run_impl();
- bool done();
+ inline bool done_impl() {
+ if (mFlinger->isFrozen()) {
+ // we are not allowed to draw, but pause a bit to make sure
+ // apps don't end up using the whole CPU, if they depend on
+ // surfaceflinger for synchronization.
+ usleep(8333); // 8.3ms ~ 120fps
+ return true;
+ }
+ return false;
+ }
+
+ bool done();
bool prepare();
bool phase1();
bool phase2();
@@ -64,6 +75,7 @@
sp<MemoryDealer> mTemporaryDealer;
LayerOrientationAnimBase* mLayerOrientationAnim;
int mState;
+ uint32_t mType;
};
// ---------------------------------------------------------------------------