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
This commit is contained in:
Chet Haase
2011-10-11 06:41:59 -07:00
parent f522e095e6
commit 2f2022afa1
4 changed files with 135 additions and 49 deletions

View File

@@ -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;