diff options
| author | Chet Haase <chet@google.com> | 2011-10-11 06:41:59 -0700 |
|---|---|---|
| committer | Chet Haase <chet@google.com> | 2011-10-18 13:05:28 -0700 |
| commit | 2f2022afa1eb85018368398bd150e9575fc099c9 (patch) | |
| tree | 7cb4e8774f10ec74254e5e77ca11816083a0203d /core/java/android/view | |
| parent | f522e095e69406a5c6039b406237e9b30781a355 (diff) | |
| download | frameworks_base-2f2022afa1eb85018368398bd150e9575fc099c9.zip frameworks_base-2f2022afa1eb85018368398bd150e9575fc099c9.tar.gz frameworks_base-2f2022afa1eb85018368398bd150e9575fc099c9.tar.bz2 | |
Make notification panel delete-all animation smoother
Making the notfication delete-all animation smoother by carefully
choreographing the various parts of it. The problem with the previous
animation was that there was simply too much going on at the
same time, causing things like layout and recreating display-lists
in the middle of animations that became choppy as a result. This
approach swipes all items off quickly, then scrolls the shade up to the
top, making both sets of animations smoother as a result.
Fixes #5431207: Notification delete-all should be smoother
Change-Id: Iefe8ab5d661e05adcd10379dab85227d17904450
Diffstat (limited to 'core/java/android/view')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 7eae739..081e267 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -108,6 +108,7 @@ public final class ViewRootImpl extends Handler implements ViewParent, private static final boolean DEBUG_TRACKBALL = false || LOCAL_LOGV; private static final boolean DEBUG_IMF = false || LOCAL_LOGV; private static final boolean DEBUG_CONFIGURATION = false || LOCAL_LOGV; + private static final boolean DEBUG_FPS = false; private static final boolean WATCH_POINTER = false; /** @@ -274,6 +275,11 @@ public final class ViewRootImpl extends Handler implements ViewParent, private Thread mRenderProfiler; private volatile boolean mRenderProfilingEnabled; + // Variables to track frames per second, enabled via DEBUG_FPS flag + private long mFpsStartTime = -1; + private long mFpsPrevTime = -1; + private int mFpsNumFrames; + /** * see {@link #playSoundEffect(int)} */ @@ -1766,12 +1772,42 @@ public final class ViewRootImpl extends Handler implements ViewParent, } } + /** + * Called from draw() when DEBUG_FPS is enabled + */ + private void trackFPS() { + // Tracks frames per second drawn. First value in a series of draws may be bogus + // because it down not account for the intervening idle time + long nowTime = System.currentTimeMillis(); + if (mFpsStartTime < 0) { + mFpsStartTime = mFpsPrevTime = nowTime; + mFpsNumFrames = 0; + } else { + ++mFpsNumFrames; + String thisHash = Integer.toHexString(System.identityHashCode(this)); + long frameTime = nowTime - mFpsPrevTime; + long totalTime = nowTime - mFpsStartTime; + Log.v(TAG, "0x" + thisHash + "\tFrame time:\t" + frameTime); + mFpsPrevTime = nowTime; + if (totalTime > 1000) { + float fps = (float) mFpsNumFrames * 1000 / totalTime; + Log.v(TAG, "0x" + thisHash + "\tFPS:\t" + fps); + mFpsStartTime = nowTime; + mFpsNumFrames = 0; + } + } + } + private void draw(boolean fullRedrawNeeded) { Surface surface = mSurface; if (surface == null || !surface.isValid()) { return; } + if (DEBUG_FPS) { + trackFPS(); + } + if (!sFirstDrawComplete) { synchronized (sFirstDrawHandlers) { sFirstDrawComplete = true; |
