Merge "Improve debug printing in activity manager."
diff --git a/api/current.txt b/api/current.txt
index 8473762..e538ab2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -9858,7 +9858,6 @@
     method public final int addChild(android.graphics.drawable.Drawable);
     method public synchronized boolean canConstantState();
     method protected void computeConstantSize();
-    method public final int getCapacity();
     method public int getChangingConfigurations();
     method public final android.graphics.drawable.Drawable getChild(int);
     method public final int getChildCount();
@@ -9874,7 +9873,6 @@
     method public void growArray(int, int);
     method public final boolean isConstantSize();
     method public final boolean isStateful();
-    method public final void mutate();
     method public final void setConstantSize(boolean);
     method public final void setEnterFadeDuration(int);
     method public final void setExitFadeDuration(int);
diff --git a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
index 0c6e59c..728c913 100644
--- a/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
+++ b/packages/SystemUI/src/com/android/systemui/media/RingtonePlayer.java
@@ -31,7 +31,6 @@
 import android.util.Slog;
 
 import com.android.systemui.SystemUI;
-import com.google.android.collect.Maps;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
@@ -50,7 +49,7 @@
     private IAudioService mAudioService;
 
     private final NotificationPlayer mAsyncPlayer = new NotificationPlayer(TAG);
-    private final HashMap<IBinder, Client> mClients = Maps.newHashMap();
+    private final HashMap<IBinder, Client> mClients = new HashMap<IBinder, Client>();
 
     @Override
     public void start() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
index 0f894a1..889e0a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/GestureRecorder.java
@@ -46,7 +46,7 @@
             public MotionEvent event;
             public MotionEventRecord(long when, MotionEvent event) {
                 this.time = when;
-                this.event = event.copy();
+                this.event = MotionEvent.obtain(event);
             }
             String actionName(int action) {
                 switch (action) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
index f3f6a80..b1ccd00 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/Ticker.java
@@ -33,7 +33,6 @@
 import java.util.ArrayList;
 
 import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.util.CharSequences;
 
 import com.android.systemui.R;
 import com.android.systemui.statusbar.StatusBarIconView;
@@ -192,7 +191,7 @@
             if (n.getPackageName().equals(seg.notification.getPackageName())
                     && n.getNotification().icon == seg.notification.getNotification().icon
                     && n.getNotification().iconLevel == seg.notification.getNotification().iconLevel
-                    && CharSequences.equals(seg.notification.getNotification().tickerText,
+                    && charSequencesEqual(seg.notification.getNotification().tickerText,
                         n.getNotification().tickerText)) {
                 return;
             }
@@ -232,6 +231,20 @@
         }
     }
 
+    private static boolean charSequencesEqual(CharSequence a, CharSequence b) {
+        if (a.length() != b.length()) {
+            return false;
+        }
+
+        int length = a.length();
+        for (int i = 0; i < length; i++) {
+            if (a.charAt(i) != b.charAt(i)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     public void removeEntry(StatusBarNotification n) {
         for (int i=mSegments.size()-1; i>=0; i--) {
             Segment seg = mSegments.get(i);
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index 0647296..4a3699c 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -340,7 +340,7 @@
     boolean setStackBoxSize(Rect contentRect) {
         boolean change = false;
         for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) {
-            change |= mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect);
+            change |= mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect, true);
         }
         return change;
     }
diff --git a/services/java/com/android/server/wm/StackBox.java b/services/java/com/android/server/wm/StackBox.java
index 15f5dff..d352464 100644
--- a/services/java/com/android/server/wm/StackBox.java
+++ b/services/java/com/android/server/wm/StackBox.java
@@ -79,6 +79,9 @@
     /** Dirty flag. Something inside this or some descendant of this has changed. */
     boolean layoutNeeded;
 
+    /** True if this StackBox sits below the Status Bar. */
+    boolean mUnderStatusBar;
+
     /** Used to keep from reallocating a temporary Rect for propagating bounds to child boxes */
     Rect mTmpRect = new Rect();
 
@@ -286,14 +289,19 @@
 
     /** If this is a terminal StackBox (contains a TaskStack) set the bounds.
      * @param bounds The rectangle to set the bounds to.
+     * @param underStatusBar True if the StackBox is directly below the Status Bar.
      * @return True if the bounds changed, false otherwise. */
-    boolean setStackBoxSizes(Rect bounds) {
-        boolean change;
+    boolean setStackBoxSizes(Rect bounds, boolean underStatusBar) {
+        boolean change = false;
+        if (mUnderStatusBar != underStatusBar) {
+            change = true;
+            mUnderStatusBar = underStatusBar;
+        }
         if (mStack != null) {
-            change = !mBounds.equals(bounds);
+            change |= !mBounds.equals(bounds);
             if (change) {
                 mBounds.set(bounds);
-                mStack.setBounds(bounds);
+                mStack.setBounds(bounds, underStatusBar);
             }
         } else {
             mTmpRect.set(bounds);
@@ -301,18 +309,18 @@
                 final int height = bounds.height();
                 int firstHeight = (int)(height * mWeight);
                 mTmpRect.bottom = bounds.top + firstHeight;
-                change = mFirst.setStackBoxSizes(mTmpRect);
+                change |= mFirst.setStackBoxSizes(mTmpRect, underStatusBar);
                 mTmpRect.top = mTmpRect.bottom;
                 mTmpRect.bottom = bounds.top + height;
-                change |= mSecond.setStackBoxSizes(mTmpRect);
+                change |= mSecond.setStackBoxSizes(mTmpRect, false);
             } else {
                 final int width = bounds.width();
                 int firstWidth = (int)(width * mWeight);
                 mTmpRect.right = bounds.left + firstWidth;
-                change = mFirst.setStackBoxSizes(mTmpRect);
+                change |= mFirst.setStackBoxSizes(mTmpRect, underStatusBar);
                 mTmpRect.left = mTmpRect.right;
                 mTmpRect.right = bounds.left + width;
-                change |= mSecond.setStackBoxSizes(mTmpRect);
+                change |= mSecond.setStackBoxSizes(mTmpRect, underStatusBar);
             }
         }
         return change;
diff --git a/services/java/com/android/server/wm/TaskStack.java b/services/java/com/android/server/wm/TaskStack.java
index 6fd8745..827958d 100644
--- a/services/java/com/android/server/wm/TaskStack.java
+++ b/services/java/com/android/server/wm/TaskStack.java
@@ -222,7 +222,7 @@
         }
     }
 
-    void setBounds(Rect bounds) {
+    void setBounds(Rect bounds, boolean underStatusBar) {
         mDimLayer.setBounds(bounds);
         mAnimationBackgroundSurface.setBounds(bounds);
 
@@ -236,6 +236,7 @@
                     if (!resizingWindows.contains(win)) {
                         resizingWindows.add(win);
                     }
+                    win.mUnderStatusBar = underStatusBar;
                 }
             }
         }