Minor cleanups.
- Replace HashSet with ArrayList.
- Check for Watermark and SurfaceSession initialization once, not every
time through layout.
- Move watermark rendering into animation.
- Add surface operation debugging.
Change-Id: I4b7e7c0b8d89d43c67a42753832f90b8632d4f5d
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index fa009eb..00fd7d8 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -23,7 +23,6 @@
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.HashSet;
/**
* Singleton class that carries out the animations and Surface operations in a separate task
@@ -36,8 +35,7 @@
final Context mContext;
final WindowManagerPolicy mPolicy;
- HashSet<WindowStateAnimator> mWinAnimators = new HashSet<WindowStateAnimator>();
- HashSet<WindowStateAnimator> mFinished = new HashSet<WindowStateAnimator>();
+ ArrayList<WindowStateAnimator> mWinAnimators = new ArrayList<WindowStateAnimator>();
boolean mAnimating;
boolean mTokenMayBeDrawn;
@@ -449,16 +447,9 @@
mScreenRotationAnimation.updateSurfaces();
}
- mFinished.clear();
- for (final WindowStateAnimator winAnimator : mWinAnimators) {
- if (winAnimator.mSurface == null) {
- mFinished.add(winAnimator);
- } else {
- winAnimator.prepareSurfaceLocked(true);
- }
- }
- for (final WindowStateAnimator winAnimator : mFinished) {
- mWinAnimators.remove(winAnimator);
+ final int N = mWinAnimators.size();
+ for (int i = 0; i < N; i++) {
+ mWinAnimators.get(i).prepareSurfaceLocked(true);
}
if (mDimParams != null) {
@@ -477,6 +468,10 @@
mService.mBlackFrame.clearMatrix();
}
}
+
+ if (mService.mWatermark != null) {
+ mService.mWatermark.drawIfNeeded();
+ }
} catch (RuntimeException e) {
Log.wtf(TAG, "Unhandled exception in Window Manager", e);
} finally {