Merge "Yet more debugging for 10858941." into klp-dev
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index fe91b6c..1987d04 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -226,7 +226,7 @@
     static final boolean DEBUG_RESULTS = localLOGV || false;
     static final boolean DEBUG_SERVICE = localLOGV || false;
     static final boolean DEBUG_SERVICE_EXECUTING = localLOGV || false;
-    static final boolean DEBUG_STACK = localLOGV || false;
+    static final boolean DEBUG_STACK = localLOGV || true;
     static final boolean DEBUG_SWITCH = localLOGV || false;
     static final boolean DEBUG_TASKS = localLOGV || false;
     static final boolean DEBUG_THUMBNAILS = localLOGV || false;
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index 2798104..afa4f78 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -24,6 +24,7 @@
 import android.app.ActivityManager.StackBoxInfo;
 import android.graphics.Rect;
 import android.graphics.Region;
+import android.os.Debug;
 import android.util.Slog;
 import android.view.Display;
 import android.view.DisplayInfo;
@@ -322,7 +323,8 @@
      * @return true if a change was made, false otherwise.
      */
     boolean moveHomeStackBox(boolean toTop) {
-        if (DEBUG_STACK) Slog.d(TAG, "moveHomeStackBox: toTop=" + toTop);
+        if (DEBUG_STACK) Slog.d(TAG, "moveHomeStackBox: toTop=" + toTop + " Callers=" +
+                Debug.getCallers(4));
         switch (mStackBoxes.size()) {
             case 0: throw new RuntimeException("moveHomeStackBox: No home StackBox!");
             case 1: return false; // Only the home StackBox exists.
diff --git a/services/java/com/android/server/wm/FocusedStackFrame.java b/services/java/com/android/server/wm/FocusedStackFrame.java
index 365b277..cc48b86 100644
--- a/services/java/com/android/server/wm/FocusedStackFrame.java
+++ b/services/java/com/android/server/wm/FocusedStackFrame.java
@@ -63,7 +63,7 @@
     }
 
     private void draw(Rect bounds, int color) {
-        if (DEBUG_STACK) Slog.i(TAG, "draw: bounds=" + bounds.toShortString() +
+        if (false && DEBUG_STACK) Slog.i(TAG, "draw: bounds=" + bounds.toShortString() +
                 " color=" + Integer.toHexString(color));
         mTmpDrawRect.set(bounds);
         Canvas c = null;
@@ -100,7 +100,7 @@
     }
 
     private void positionSurface(Rect bounds) {
-        if (DEBUG_STACK) Slog.i(TAG, "positionSurface: bounds=" + bounds.toShortString());
+        if (false && DEBUG_STACK) Slog.i(TAG, "positionSurface: bounds=" + bounds.toShortString());
         mSurfaceControl.setSize(bounds.width(), bounds.height());
         mSurfaceControl.setPosition(bounds.left, bounds.top);
     }
@@ -108,7 +108,7 @@
     // Note: caller responsible for being inside
     // Surface.openTransaction() / closeTransaction()
     public void setVisibility(boolean on) {
-        if (DEBUG_STACK) Slog.i(TAG, "setVisibility: on=" + on +
+        if (false && DEBUG_STACK) Slog.i(TAG, "setVisibility: on=" + on +
                 " mLastBounds=" + mLastBounds.toShortString() +
                 " mBounds=" + mBounds.toShortString());
         if (mSurfaceControl == null) {
@@ -132,7 +132,7 @@
     }
 
     public void setBounds(Rect bounds) {
-        if (DEBUG_STACK) Slog.i(TAG, "setBounds: bounds=" + bounds);
+        if (false && DEBUG_STACK) Slog.i(TAG, "setBounds: bounds=" + bounds);
         mBounds.set(bounds);
     }
 
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index 9bbaf60..0e0d098 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -187,7 +187,7 @@
     static final boolean DEBUG_SURFACE_TRACE = false;
     static final boolean DEBUG_WINDOW_TRACE = false;
     static final boolean DEBUG_TASK_MOVEMENT = false;
-    static final boolean DEBUG_STACK = false;
+    static final boolean DEBUG_STACK = true;
     static final boolean SHOW_SURFACE_ALLOC = false;
     static final boolean SHOW_TRANSACTIONS = false;
     static final boolean SHOW_LIGHT_TRANSACTIONS = false || SHOW_TRANSACTIONS;
@@ -2367,10 +2367,10 @@
         }
 
         if (localLOGV || DEBUG_FOCUS || DEBUG_FOCUS_LIGHT && win==mCurrentFocus) Slog.v(
-            TAG, "Remove " + win + " client="
-            + Integer.toHexString(System.identityHashCode(win.mClient.asBinder()))
-            + ", surface=" + win.mWinAnimator.mSurfaceControl,
-            new RuntimeException("here").fillInStackTrace());
+                TAG, "Remove " + win + " client="
+                + Integer.toHexString(System.identityHashCode(win.mClient.asBinder()))
+                + ", surface=" + win.mWinAnimator.mSurfaceControl + " Callers="
+                + Debug.getCallers(4));
 
         final long origId = Binder.clearCallingIdentity();