Merge "Wrapping console logs."
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 6df2a19..ffd64d4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -64,10 +64,12 @@
                 mSingleCountFirstTaskRect.offset(0, (int) statusBarHeight);
                 mMultipleCountFirstTaskRect = replyData.getParcelable(KEY_MULTIPLE_TASK_STACK_RECT);
                 mMultipleCountFirstTaskRect.offset(0, (int) statusBarHeight);
-                Console.log(Constants.Log.App.RecentsComponent,
-                        "[RecentsComponent|RecentsMessageHandler|handleMessage]",
-                        "singleTaskRect: " + mSingleCountFirstTaskRect +
-                        " multipleTaskRect: " + mMultipleCountFirstTaskRect);
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.RecentsComponent,
+                            "[RecentsComponent|RecentsMessageHandler|handleMessage]",
+                            "singleTaskRect: " + mSingleCountFirstTaskRect +
+                            " multipleTaskRect: " + mMultipleCountFirstTaskRect);
+                }
 
                 // If we had the update the animation rects as a result of onServiceConnected, then
                 // we check for whether we need to toggle the recents here.
@@ -83,9 +85,11 @@
     class RecentsServiceConnection implements ServiceConnection {
         @Override
         public void onServiceConnected(ComponentName className, IBinder service) {
-            Console.log(Constants.Log.App.RecentsComponent,
-                    "[RecentsComponent|ServiceConnection|onServiceConnected]",
-                    "toggleRecents: " + mToggleRecentsUponServiceBound);
+            if (Console.Enabled) {
+                Console.log(Constants.Log.App.RecentsComponent,
+                        "[RecentsComponent|ServiceConnection|onServiceConnected]",
+                        "toggleRecents: " + mToggleRecentsUponServiceBound);
+            }
             mService = new Messenger(service);
             mServiceIsBound = true;
 
@@ -103,8 +107,10 @@
 
         @Override
         public void onServiceDisconnected(ComponentName className) {
-            Console.log(Constants.Log.App.RecentsComponent,
-                    "[RecentsComponent|ServiceConnection|onServiceDisconnected]");
+            if (Console.Enabled) {
+                Console.log(Constants.Log.App.RecentsComponent,
+                        "[RecentsComponent|ServiceConnection|onServiceDisconnected]");
+            }
             mService = null;
             mServiceIsBound = false;
         }
@@ -159,7 +165,9 @@
     }
 
     public void onStart() {
-        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|start]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|start]");
+        }
 
         // Try to create a long-running connection to the recents service
         bindToRecentsService(false);
@@ -167,7 +175,9 @@
 
     /** Shows the recents */
     public void onShowRecents(boolean triggeredFromAltTab, View statusBarView) {
-        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|showRecents]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|showRecents]");
+        }
         mStatusBarView = statusBarView;
         mTriggeredFromAltTab = triggeredFromAltTab;
         if (!mServiceIsBound) {
@@ -186,7 +196,9 @@
 
     /** Hides the recents */
     public void onHideRecents(boolean triggeredFromAltTab) {
-        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|hideRecents]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|hideRecents]");
+        }
         if (mServiceIsBound) {
             // Notify recents to close it
             try {
@@ -202,12 +214,14 @@
 
     /** Toggles the alternate recents activity */
     public void onToggleRecents(View statusBarView) {
-        Console.logStartTracingTime(Constants.Log.App.TimeRecentsStartup,
-                Constants.Log.App.TimeRecentsStartupKey);
-        Console.logStartTracingTime(Constants.Log.App.TimeRecentsLaunchTask,
-                Constants.Log.App.TimeRecentsLaunchKey);
-        Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|toggleRecents]",
-                "serviceIsBound: " + mServiceIsBound);
+        if (Console.Enabled) {
+            Console.logStartTracingTime(Constants.Log.App.TimeRecentsStartup,
+                    Constants.Log.App.TimeRecentsStartupKey);
+            Console.logStartTracingTime(Constants.Log.App.TimeRecentsLaunchTask,
+                    Constants.Log.App.TimeRecentsLaunchKey);
+            Console.log(Constants.Log.App.RecentsComponent, "[RecentsComponent|toggleRecents]",
+                    "serviceIsBound: " + mServiceIsBound);
+        }
         mStatusBarView = statusBarView;
         mTriggeredFromAltTab = false;
         if (!mServiceIsBound) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Console.java b/packages/SystemUI/src/com/android/systemui/recents/Console.java
index c8d97cc..33e05dd 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Console.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Console.java
@@ -42,6 +42,9 @@
     public static final String AnsiCyan = "\u001B[36m";     // ClickEvents
     public static final String AnsiWhite = "\u001B[37m";
 
+    // Console enabled state
+    public static final boolean Enabled = false;
+
     /** Logs a key */
     public static void log(String key) {
         log(true, key, "", AnsiReset);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index de696db..e7119f6 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -80,8 +80,10 @@
         @Override
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
-            Console.log(Constants.Log.App.SystemUIHandshake,
-                    "[RecentsActivity|serviceBroadcast]", action, Console.AnsiRed);
+            if (Console.Enabled) {
+                Console.log(Constants.Log.App.SystemUIHandshake,
+                        "[RecentsActivity|serviceBroadcast]", action, Console.AnsiRed);
+            }
             if (action.equals(RecentsService.ACTION_HIDE_RECENTS_ACTIVITY)) {
                 if (intent.getBooleanExtra(RecentsService.EXTRA_TRIGGERED_FROM_ALT_TAB, false)) {
                     // Dismiss recents, launching the focused task
@@ -164,10 +166,12 @@
                     ssp.unbindSearchAppWidget(mAppWidgetHost, appWidgetId);
                     appWidgetId = -1;
                 }
-                Console.log(Constants.Log.App.SystemUIHandshake,
-                        "[RecentsActivity|onCreate|settings|appWidgetId]",
-                        "Id: " + appWidgetId,
-                        Console.AnsiBlue);
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.SystemUIHandshake,
+                            "[RecentsActivity|onCreate|settings|appWidgetId]",
+                            "Id: " + appWidgetId,
+                            Console.AnsiBlue);
+                }
             }
 
             // If there is no id, then bind a new search app widget
@@ -175,10 +179,12 @@
                 Pair<Integer, AppWidgetProviderInfo> widgetInfo =
                         ssp.bindSearchAppWidget(mAppWidgetHost);
                 if (widgetInfo != null) {
-                    Console.log(Constants.Log.App.SystemUIHandshake,
-                            "[RecentsActivity|onCreate|searchWidget]",
-                            "Id: " + widgetInfo.first + " Info: " + widgetInfo.second,
-                            Console.AnsiBlue);
+                    if (Console.Enabled) {
+                        Console.log(Constants.Log.App.SystemUIHandshake,
+                                "[RecentsActivity|onCreate|searchWidget]",
+                                "Id: " + widgetInfo.first + " Info: " + widgetInfo.second,
+                                Console.AnsiBlue);
+                    }
 
                     // Save the app widget id into the settings
                     config.updateSearchBarAppWidgetId(this, widgetInfo.first);
@@ -194,10 +200,12 @@
             RecentsConfiguration config = RecentsConfiguration.getInstance();
             int appWidgetId = config.searchBarAppWidgetId;
             if (appWidgetId >= 0) {
-                Console.log(Constants.Log.App.SystemUIHandshake,
-                "[RecentsActivity|onCreate|addSearchAppWidgetView]",
-                        "Id: " + appWidgetId,
-                        Console.AnsiBlue);
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.SystemUIHandshake,
+                            "[RecentsActivity|onCreate|addSearchAppWidgetView]",
+                            "Id: " + appWidgetId,
+                            Console.AnsiBlue);
+                }
                 mSearchAppWidgetHostView = mAppWidgetHost.createView(this, appWidgetId,
                         mSearchAppWidgetInfo);
                 Bundle opts = new Bundle();
@@ -230,11 +238,13 @@
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        Console.logDivider(Constants.Log.App.SystemUIHandshake);
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
-                getIntent().getAction() + " visible: " + mVisible, Console.AnsiRed);
-        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
-                Constants.Log.App.TimeRecentsStartupKey, "onCreate");
+        if (Console.Enabled) {
+            Console.logDivider(Constants.Log.App.SystemUIHandshake);
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onCreate]",
+                    getIntent().getAction() + " visible: " + mVisible, Console.AnsiRed);
+            Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
+                    Constants.Log.App.TimeRecentsStartupKey, "onCreate");
+        }
 
         // Initialize the loader and the configuration
         RecentsTaskLoader.initialize(this);
@@ -277,11 +287,13 @@
         // Reset the task launched flag if we encounter an onNewIntent() before onStop()
         mTaskLaunched = false;
 
-        Console.logDivider(Constants.Log.App.SystemUIHandshake);
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onNewIntent]",
-                intent.getAction() + " visible: " + mVisible, Console.AnsiRed);
-        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
-                Constants.Log.App.TimeRecentsStartupKey, "onNewIntent");
+        if (Console.Enabled) {
+            Console.logDivider(Constants.Log.App.SystemUIHandshake);
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onNewIntent]",
+                    intent.getAction() + " visible: " + mVisible, Console.AnsiRed);
+            Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
+                    Constants.Log.App.TimeRecentsStartupKey, "onNewIntent");
+        }
 
         // Initialize the loader and the configuration
         RecentsTaskLoader.initialize(this);
@@ -296,8 +308,10 @@
 
     @Override
     protected void onStart() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStart]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStart]", "",
+                    Console.AnsiRed);
+        }
         super.onStart();
         mAppWidgetHost.startListening();
         mVisible = true;
@@ -305,16 +319,20 @@
 
     @Override
     protected void onResume() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onResume]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onResume]", "",
+                    Console.AnsiRed);
+        }
         super.onResume();
     }
 
     @Override
     public void onAttachedToWindow() {
-        Console.log(Constants.Log.App.SystemUIHandshake,
-                "[RecentsActivity|onAttachedToWindow]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake,
+                    "[RecentsActivity|onAttachedToWindow]", "",
+                    Console.AnsiRed);
+        }
         super.onAttachedToWindow();
 
         // Register the broadcast receiver to handle messages from our service
@@ -334,9 +352,11 @@
 
     @Override
     public void onDetachedFromWindow() {
-        Console.log(Constants.Log.App.SystemUIHandshake,
-                "[RecentsActivity|onDetachedFromWindow]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake,
+                    "[RecentsActivity|onDetachedFromWindow]", "",
+                    Console.AnsiRed);
+        }
         super.onDetachedFromWindow();
 
         // Unregister any broadcast receivers we have registered
@@ -347,15 +367,19 @@
 
     @Override
     protected void onPause() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onPause]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onPause]", "",
+                    Console.AnsiRed);
+        }
         super.onPause();
     }
 
     @Override
     protected void onStop() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStop]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onStop]", "",
+                    Console.AnsiRed);
+        }
         super.onStop();
 
         mAppWidgetHost.stopListening();
@@ -365,8 +389,10 @@
 
     @Override
     protected void onDestroy() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onDestroy]", "",
-                Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsActivity|onDestroy]", "",
+                    Console.AnsiRed);
+        }
         super.onDestroy();
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index 8399551..d899c7b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -95,9 +95,11 @@
                 Configuration.ORIENTATION_LANDSCAPE;
         transposeSearchLayoutWithOrientation =
                 res.getBoolean(R.bool.recents_transpose_search_layout_with_orientation);
-        Console.log(Constants.Log.UI.MeasureAndLayout,
-                "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
-                Console.AnsiGreen);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout,
+                    "[RecentsConfiguration|orientation]", isLandscape ? "Landscape" : "Portrait",
+                    Console.AnsiGreen);
+        }
 
         displayRect.set(0, 0, dm.widthPixels, dm.heightPixels);
         animationPxMovementPerSecond =
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
index 1c04cb1..4bdbb20 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsService.java
@@ -45,8 +45,10 @@
 
     @Override
     public void handleMessage(Message msg) {
-        Console.log(Constants.Log.App.SystemUIHandshake,
-                "[RecentsService|handleMessage]", msg);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake,
+                    "[RecentsService|handleMessage]", msg);
+        }
 
         Context context = mContext.get();
         if (context == null) return;
@@ -139,31 +141,41 @@
 
     @Override
     public void onCreate() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onCreate]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onCreate]");
+        }
         super.onCreate();
     }
 
     @Override
     public IBinder onBind(Intent intent) {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onBind]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onBind]");
+        }
         return mSystemUIMessenger.getBinder();
     }
 
     @Override
     public boolean onUnbind(Intent intent) {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onUnbind]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onUnbind]");
+        }
         return super.onUnbind(intent);
     }
 
     @Override
     public void onRebind(Intent intent) {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onRebind]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onRebind]");
+        }
         super.onRebind(intent);
     }
 
     @Override
     public void onDestroy() {
-        Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onDestroy]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsService|onDestroy]");
+        }
         super.onDestroy();
     }
 
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
index 1c12ac2..4685186 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
@@ -50,7 +50,9 @@
 
     /** Adds a new task to the load queue */
     void addTask(Task t, boolean forceLoad) {
-        Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|addTask]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|addTask]");
+        }
         if (!mQueue.contains(t)) {
             mQueue.add(t);
         }
@@ -67,7 +69,9 @@
      * force reloaded.
      */
     Pair<Task, Boolean> nextTask() {
-        Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|nextTask]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|nextTask]");
+        }
         Task task = mQueue.poll();
         Boolean forceLoadTask = null;
         if (task != null) {
@@ -81,14 +85,18 @@
 
     /** Removes a task from the load queue */
     void removeTask(Task t) {
-        Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|removeTask]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|removeTask]");
+        }
         mQueue.remove(t);
         mForceLoadSet.remove(t.key);
     }
 
     /** Clears all the tasks from the load queue */
     void clearTasks() {
-        Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|clearTasks]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "  [TaskResourceLoadQueue|clearTasks]");
+        }
         mQueue.clear();
         mForceLoadSet.clear();
     }
@@ -131,7 +139,9 @@
 
     /** Restarts the loader thread */
     void start(Context context) {
-        Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|start]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|start]");
+        }
         mContext = context;
         mCancelled = false;
         mSystemServicesProxy = new SystemServicesProxy(context);
@@ -143,7 +153,9 @@
 
     /** Requests the loader thread to stop after the current iteration */
     void stop() {
-        Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|stop]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "[TaskResourceLoader|stop]");
+        }
         // Mark as cancelled for the thread to pick up
         mCancelled = true;
         mSystemServicesProxy = null;
@@ -157,19 +169,25 @@
     @Override
     public void run() {
         while (true) {
-            Console.log(Constants.Log.App.TaskDataLoader,
-                    "[TaskResourceLoader|run|" + Thread.currentThread().getId() + "]");
-            if (mCancelled) {
+            if (Console.Enabled) {
                 Console.log(Constants.Log.App.TaskDataLoader,
-                        "[TaskResourceLoader|cancel|" + Thread.currentThread().getId() + "]");
+                        "[TaskResourceLoader|run|" + Thread.currentThread().getId() + "]");
+            }
+            if (mCancelled) {
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.TaskDataLoader,
+                            "[TaskResourceLoader|cancel|" + Thread.currentThread().getId() + "]");
+                }
                 // We have to unset the context here, since the background thread may be using it
                 // when we call stop()
                 mContext = null;
                 // If we are cancelled, then wait until we are started again
                 synchronized(mLoadThread) {
                     try {
-                        Console.log(Constants.Log.App.TaskDataLoader,
-                                "[TaskResourceLoader|waitOnLoadThreadCancelled]");
+                        if (Console.Enabled) {
+                            Console.log(Constants.Log.App.TaskDataLoader,
+                                    "[TaskResourceLoader|waitOnLoadThreadCancelled]");
+                        }
                         mLoadThread.wait();
                     } catch (InterruptedException ie) {
                         ie.printStackTrace();
@@ -185,10 +203,12 @@
                 if (t != null) {
                     Drawable loadIcon = mApplicationIconCache.get(t.key);
                     Bitmap loadThumbnail = mThumbnailCache.get(t.key);
-                    Console.log(Constants.Log.App.TaskDataLoader,
-                            "  [TaskResourceLoader|load]",
-                            t + " icon: " + loadIcon + " thumbnail: " + loadThumbnail +
-                                    " forceLoad: " + forceLoadTask);
+                    if (Console.Enabled) {
+                        Console.log(Constants.Log.App.TaskDataLoader,
+                                "  [TaskResourceLoader|load]",
+                                t + " icon: " + loadIcon + " thumbnail: " + loadThumbnail +
+                                        " forceLoad: " + forceLoadTask);
+                    }
                     // Load the application icon
                     if (loadIcon == null || forceLoadTask) {
                         ActivityInfo info = ssp.getActivityInfo(t.key.baseIntent.getComponent(),
@@ -196,9 +216,10 @@
                         Drawable icon = ssp.getActivityIcon(info, t.userId);
                         if (!mCancelled) {
                             if (icon != null) {
-                                Console.log(Constants.Log.App.TaskDataLoader,
-                                        "    [TaskResourceLoader|loadIcon]",
-                                        icon);
+                                if (Console.Enabled) {
+                                    Console.log(Constants.Log.App.TaskDataLoader,
+                                            "    [TaskResourceLoader|loadIcon]", icon);
+                                }
                                 loadIcon = icon;
                                 mApplicationIconCache.put(t.key, icon);
                             }
@@ -209,9 +230,10 @@
                         Bitmap thumbnail = ssp.getTaskThumbnail(t.key.id);
                         if (!mCancelled) {
                             if (thumbnail != null) {
-                                Console.log(Constants.Log.App.TaskDataLoader,
-                                        "    [TaskResourceLoader|loadThumbnail]",
-                                        thumbnail);
+                                if (Console.Enabled) {
+                                    Console.log(Constants.Log.App.TaskDataLoader,
+                                            "    [TaskResourceLoader|loadThumbnail]", thumbnail);
+                                }
                                 thumbnail.setHasAlpha(false);
                                 loadThumbnail = thumbnail;
                                 mThumbnailCache.put(t.key, thumbnail);
@@ -239,8 +261,10 @@
                 if (!mCancelled && mLoadQueue.isEmpty()) {
                     synchronized(mLoadQueue) {
                         try {
-                            Console.log(Constants.Log.App.TaskDataLoader,
-                                    "[TaskResourceLoader|waitOnLoadQueue]");
+                            if (Console.Enabled) {
+                                Console.log(Constants.Log.App.TaskDataLoader,
+                                        "[TaskResourceLoader|waitOnLoadQueue]");
+                            }
                             mWaitingOnLoadQueue = true;
                             mLoadQueue.wait();
                             mWaitingOnLoadQueue = false;
@@ -320,9 +344,11 @@
         int thumbnailCacheSize = Constants.DebugFlags.App.DisableBackgroundCache ? 1 :
                 mMaxThumbnailCacheSize;
 
-        Console.log(Constants.Log.App.TaskDataLoader,
-                "[RecentsTaskLoader|init]", "thumbnailCache: " + thumbnailCacheSize +
-                " iconCache: " + iconCacheSize);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader,
+                    "[RecentsTaskLoader|init]", "thumbnailCache: " + thumbnailCacheSize +
+                    " iconCache: " + iconCacheSize);
+        }
 
         // Initialize the proxy, cache and loaders
         mSystemServicesProxy = new SystemServicesProxy(context);
@@ -338,9 +364,11 @@
         mDefaultThumbnail = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
         mDefaultThumbnail.eraseColor(0x00000000);
         mDefaultApplicationIcon = new BitmapDrawable(context.getResources(), icon);
-        Console.log(Constants.Log.App.TaskDataLoader,
-                "[RecentsTaskLoader|defaultBitmaps]",
-                "icon: " + mDefaultApplicationIcon + " thumbnail: " + mDefaultThumbnail, Console.AnsiRed);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader,
+                    "[RecentsTaskLoader|defaultBitmaps]",
+                    "icon: " + mDefaultApplicationIcon + " thumbnail: " + mDefaultThumbnail, Console.AnsiRed);
+        }
     }
 
     /** Initializes the recents task loader */
@@ -368,11 +396,13 @@
         List<ActivityManager.RecentTaskInfo> tasks =
                 ssp.getRecentTasks(25, UserHandle.CURRENT.getIdentifier());
         Collections.reverse(tasks);
-        Console.log(Constants.Log.App.TimeSystemCalls,
-                "[RecentsTaskLoader|getRecentTasks]",
-                "" + (System.currentTimeMillis() - t1) + "ms");
-        Console.log(Constants.Log.App.TaskDataLoader,
-                "[RecentsTaskLoader|tasks]", "" + tasks.size());
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TimeSystemCalls,
+                    "[RecentsTaskLoader|getRecentTasks]",
+                    "" + (System.currentTimeMillis() - t1) + "ms");
+            Console.log(Constants.Log.App.TaskDataLoader,
+                    "[RecentsTaskLoader|tasks]", "" + tasks.size());
+        }
 
         return tasks;
     }
@@ -381,7 +411,9 @@
     SpaceNode reload(Context context, int preloadCount) {
         long t1 = System.currentTimeMillis();
 
-        Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|reload]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|reload]");
+        }
         Resources res = context.getResources();
         ArrayList<Task> tasksToForceLoad = new ArrayList<Task>();
         TaskStack stack = new TaskStack(context);
@@ -419,9 +451,11 @@
 
             // Preload the specified number of apps
             if (i >= (taskCount - preloadCount)) {
-                Console.log(Constants.Log.App.TaskDataLoader,
-                        "[RecentsTaskLoader|preloadTask]",
-                        "i: " + i + " task: " + t.baseIntent.getComponent().getPackageName());
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.TaskDataLoader,
+                            "[RecentsTaskLoader|preloadTask]",
+                            "i: " + i + " task: " + t.baseIntent.getComponent().getPackageName());
+                }
 
                 // Load the icon (if possible and not the foremost task, from the cache)
                 if (!isForemostTask) {
@@ -451,8 +485,10 @@
                     }
                 }
                 if (task.thumbnail == null) {
-                    Console.log(Constants.Log.App.TaskDataLoader,
-                            "[RecentsTaskLoader|loadingTaskThumbnail]");
+                    if (Console.Enabled) {
+                        Console.log(Constants.Log.App.TaskDataLoader,
+                                "[RecentsTaskLoader|loadingTaskThumbnail]");
+                    }
                     task.thumbnail = ssp.getTaskThumbnail(task.key.id);
                     if (task.thumbnail != null) {
                         task.thumbnail.setHasAlpha(false);
@@ -464,13 +500,17 @@
             }
 
             // Add the task to the stack
-            Console.log(Constants.Log.App.TaskDataLoader,
-                "  [RecentsTaskLoader|task]", t.baseIntent.getComponent().getPackageName());
+            if (Console.Enabled) {
+                Console.log(Constants.Log.App.TaskDataLoader,
+                        "  [RecentsTaskLoader|task]", t.baseIntent.getComponent().getPackageName());
+            }
             stack.addTask(task);
         }
-        Console.log(Constants.Log.App.TimeSystemCalls,
-                "[RecentsTaskLoader|getAllTaskTopThumbnail]",
-                "" + (System.currentTimeMillis() - t1) + "ms");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TimeSystemCalls,
+                    "[RecentsTaskLoader|getAllTaskTopThumbnail]",
+                    "" + (System.currentTimeMillis() - t1) + "ms");
+        }
 
         /*
         // Get all the stacks
@@ -505,9 +545,11 @@
         Drawable applicationIcon = mApplicationIconCache.get(t.key);
         Bitmap thumbnail = mThumbnailCache.get(t.key);
 
-        Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|loadTask]",
-                t + " applicationIcon: " + applicationIcon + " thumbnail: " + thumbnail +
-                        " thumbnailCacheSize: " + mThumbnailCache.size());
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|loadTask]",
+                    t + " applicationIcon: " + applicationIcon + " thumbnail: " + thumbnail +
+                            " thumbnailCacheSize: " + mThumbnailCache.size());
+        }
 
         boolean requiresLoad = false;
         if (applicationIcon == null) {
@@ -526,9 +568,11 @@
 
     /** Releases the task resource data back into the pool. */
     public void unloadTaskData(Task t) {
-        Console.log(Constants.Log.App.TaskDataLoader,
-                "[RecentsTaskLoader|unloadTask]", t +
-                " thumbnailCacheSize: " + mThumbnailCache.size());
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader,
+                    "[RecentsTaskLoader|unloadTask]", t +
+                    " thumbnailCacheSize: " + mThumbnailCache.size());
+        }
 
         mLoadQueue.removeTask(t);
         t.notifyTaskDataUnloaded(mDefaultThumbnail, mDefaultApplicationIcon);
@@ -536,8 +580,10 @@
 
     /** Completely removes the resource data from the pool. */
     public void deleteTaskData(Task t, boolean notifyTaskDataUnloaded) {
-        Console.log(Constants.Log.App.TaskDataLoader,
-                "[RecentsTaskLoader|deleteTask]", t);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader,
+                    "[RecentsTaskLoader|deleteTask]", t);
+        }
 
         mLoadQueue.removeTask(t);
         mThumbnailCache.remove(t.key);
@@ -549,7 +595,9 @@
 
     /** Stops the task loader and clears all pending tasks */
     void stopLoader() {
-        Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|stopLoader]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.TaskDataLoader, "[RecentsTaskLoader|stopLoader]");
+        }
         mLoader.stop();
         mLoadQueue.clearTasks();
     }
@@ -570,8 +618,10 @@
      * out of memory.
      */
     void onTrimMemory(int level) {
-        Console.log(Constants.Log.App.Memory, "[RecentsTaskLoader|onTrimMemory]",
-                Console.trimMemoryLevelToString(level));
+        if (Console.Enabled) {
+            Console.log(Constants.Log.App.Memory, "[RecentsTaskLoader|onTrimMemory]",
+                    Console.trimMemoryLevelToString(level));
+        }
 
         switch (level) {
             case ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN:
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
index 59d0ea6..7a3ffb8 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
@@ -106,7 +106,8 @@
                 rti.description = description;
                 if (i % 2 == 0) {
                     rti.taskDescription = new ActivityManager.TaskDescription(description,
-                        Bitmap.createBitmap(mDummyIcon), new Random().nextInt());
+                        Bitmap.createBitmap(mDummyIcon),
+                        0xFF000000 | (0xFFFFFF & new Random().nextInt()));
                 } else {
                     rti.taskDescription = new ActivityManager.TaskDescription();
                 }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
index cad54fa..cad9ce5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java
@@ -110,16 +110,20 @@
                     TaskView tv = (TaskView) stackView.getChildAt(j);
                     Task task = tv.getTask();
                     if (tv.isFocusedTask()) {
-                        Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
-                                "Found focused Task");
+                        if (Console.Enabled) {
+                            Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
+                                    "Found focused Task");
+                        }
                         onTaskLaunched(stackView, tv, stack, task);
                         return true;
                     }
                 }
             }
         }
-        Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
-                "No Tasks focused");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.Focus, "[RecentsView|launchFocusedTask]",
+                    "No Tasks focused");
+        }
         return false;
     }
 
@@ -168,9 +172,11 @@
                 mSearchBar.setVisibility(mHasTasks ? View.VISIBLE : View.GONE);
                 addView(mSearchBar);
 
-                Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsView|setSearchBar]",
-                        "" + (mSearchBar.getVisibility() == View.VISIBLE),
-                        Console.AnsiBlue);
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.App.SystemUIHandshake, "[RecentsView|setSearchBar]",
+                            "" + (mSearchBar.getVisibility() == View.VISIBLE),
+                            Console.AnsiBlue);
+                }
             }
         }
     }
@@ -185,10 +191,12 @@
         int height = MeasureSpec.getSize(heightMeasureSpec);
         int heightMode = MeasureSpec.getMode(heightMeasureSpec);
 
-        Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|measure]",
-                "width: " + width + " height: " + height, Console.AnsiGreen);
-        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
-                Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onMeasure");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|measure]",
+                    "width: " + width + " height: " + height, Console.AnsiGreen);
+            Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
+                    Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onMeasure");
+        }
 
         // Get the search bar bounds and measure the search bar layout
         RecentsConfiguration config = RecentsConfiguration.getInstance();
@@ -227,10 +235,12 @@
      */
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|layout]",
-                new Rect(left, top, right, bottom) + " changed: " + changed, Console.AnsiGreen);
-        Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
-                Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onLayout");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout, "[RecentsView|layout]",
+                    new Rect(left, top, right, bottom) + " changed: " + changed, Console.AnsiGreen);
+            Console.logTraceTime(Constants.Log.App.TimeRecentsStartup,
+                    Constants.Log.App.TimeRecentsStartupKey, "RecentsView.onLayout");
+        }
 
         // Get the search bar bounds so that we lay it out
         RecentsConfiguration config = RecentsConfiguration.getInstance();
@@ -283,15 +293,19 @@
 
     @Override
     protected void dispatchDraw(Canvas canvas) {
-        Console.log(Constants.Log.UI.Draw, "[RecentsView|dispatchDraw]", "",
-                Console.AnsiPurple);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.Draw, "[RecentsView|dispatchDraw]", "",
+                    Console.AnsiPurple);
+        }
         super.dispatchDraw(canvas);
     }
 
     @Override
     public WindowInsets onApplyWindowInsets(WindowInsets insets) {
-        Console.log(Constants.Log.UI.MeasureAndLayout,
-                "[RecentsView|fitSystemWindows]", "insets: " + insets, Console.AnsiGreen);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout,
+                    "[RecentsView|fitSystemWindows]", "insets: " + insets, Console.AnsiGreen);
+        }
 
         // Update the configuration with the latest system insets and trigger a relayout
         RecentsConfiguration config = RecentsConfiguration.getInstance();
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
index c34300c..3ee0545 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/SwipeHelper.java
@@ -178,9 +178,11 @@
     }
 
     public boolean onInterceptTouchEvent(MotionEvent ev) {
-        Console.log(Constants.Log.UI.TouchEvents,
-                "[SwipeHelper|interceptTouchEvent]",
-                Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.TouchEvents,
+                    "[SwipeHelper|interceptTouchEvent]",
+                    Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        }
         final int action = ev.getAction();
 
         switch (action) {
@@ -291,9 +293,11 @@
     }
 
     public boolean onTouchEvent(MotionEvent ev) {
-        Console.log(Constants.Log.UI.TouchEvents,
-                "[SwipeHelper|touchEvent]",
-                Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.TouchEvents,
+                    "[SwipeHelper|touchEvent]",
+                    Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        }
 
         if (!mDragging) {
             if (!onInterceptTouchEvent(ev)) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 0687222..3e418ca 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -113,8 +113,10 @@
         requestSynchronizeStackViewsWithModel(0);
     }
     void requestSynchronizeStackViewsWithModel(int duration) {
-        Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
-                "[TaskStackView|requestSynchronize]", "" + duration + "ms", Console.AnsiYellow);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
+                    "[TaskStackView|requestSynchronize]", "" + duration + "ms", Console.AnsiYellow);
+        }
         if (!mStackViewsDirty) {
             invalidate();
         }
@@ -221,9 +223,11 @@
 
     /** Synchronizes the views with the model */
     void synchronizeStackViewsWithModel() {
-        Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
-                "[TaskStackView|synchronizeViewsWithModel]",
-                "mStackViewsDirty: " + mStackViewsDirty, Console.AnsiYellow);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
+                    "[TaskStackView|synchronizeViewsWithModel]",
+                    "mStackViewsDirty: " + mStackViewsDirty, Console.AnsiYellow);
+        }
         if (mStackViewsDirty) {
             // XXX: Consider using TaskViewTransform pool to prevent allocations
             // XXX: Iterate children views, update transforms and remove all that are not visible
@@ -277,8 +281,10 @@
                 }
             }
 
-            Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
-                    "  [TaskStackView|viewChildren]", "" + getChildCount());
+            if (Console.Enabled) {
+                Console.log(Constants.Log.TaskStack.SynchronizeViewsWithModel,
+                        "  [TaskStackView|viewChildren]", "" + getChildCount());
+            }
 
             mStackViewsAnimationDuration = 0;
             mStackViewsDirty = false;
@@ -445,7 +451,9 @@
 
     /** Focuses the task at the specified index in the stack */
     void focusTask(int taskIndex, boolean scrollToNewPosition) {
-        Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "" + taskIndex);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "" + taskIndex);
+        }
         if (0 <= taskIndex && taskIndex < mStack.getTaskCount()) {
             mFocusedTaskIndex = taskIndex;
 
@@ -455,7 +463,9 @@
             Runnable postScrollRunnable = null;
             if (tv != null) {
                 tv.setFocusedTask();
-                Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "Requesting focus");
+                if (Console.Enabled) {
+                    Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]", "Requesting focus");
+                }
             } else {
                 postScrollRunnable = new Runnable() {
                     @Override
@@ -464,8 +474,10 @@
                         TaskView tv = getChildViewForTask(t);
                         if (tv != null) {
                             tv.setFocusedTask();
-                            Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]",
-                                    "Requesting focus after scroll animation");
+                            if (Console.Enabled) {
+                                Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusTask]",
+                                        "Requesting focus after scroll animation");
+                            }
                         }
                     }
                 };
@@ -487,7 +499,10 @@
 
     /** Focuses the next task in the stack */
     void focusNextTask(boolean forward) {
-        Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusNextTask]", "" + mFocusedTaskIndex);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.Focus, "[TaskStackView|focusNextTask]", "" +
+                    mFocusedTaskIndex);
+        }
 
         // Find the next index to focus
         int numTasks = mStack.getTaskCount();
@@ -503,9 +518,11 @@
 
     /** Enables the hw layers and increments the hw layer requirement ref count */
     void addHwLayersRefCount(String reason) {
-        Console.log(Constants.Log.UI.HwLayers,
-                "[TaskStackView|addHwLayersRefCount] refCount: " +
-                        mHwLayersRefCount + "->" + (mHwLayersRefCount + 1) + " " + reason);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.HwLayers,
+                    "[TaskStackView|addHwLayersRefCount] refCount: " +
+                            mHwLayersRefCount + "->" + (mHwLayersRefCount + 1) + " " + reason);
+        }
         if (mHwLayersRefCount == 0) {
             // Enable hw layers on each of the children
             int childCount = getChildCount();
@@ -520,9 +537,11 @@
     /** Decrements the hw layer requirement ref count and disables the hw layers when we don't
         need them anymore. */
     void decHwLayersRefCount(String reason) {
-        Console.log(Constants.Log.UI.HwLayers,
-                "[TaskStackView|decHwLayersRefCount] refCount: " +
-                        mHwLayersRefCount + "->" + (mHwLayersRefCount - 1) + " " + reason);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.HwLayers,
+                    "[TaskStackView|decHwLayersRefCount] refCount: " +
+                            mHwLayersRefCount + "->" + (mHwLayersRefCount - 1) + " " + reason);
+        }
         mHwLayersRefCount--;
         if (mHwLayersRefCount == 0) {
             // Disable hw layers on each of the children
@@ -562,8 +581,10 @@
 
     @Override
     public void dispatchDraw(Canvas canvas) {
-        Console.log(Constants.Log.UI.Draw, "[TaskStackView|dispatchDraw]", "",
-                Console.AnsiPurple);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.Draw, "[TaskStackView|dispatchDraw]", "",
+                    Console.AnsiPurple);
+        }
         synchronizeStackViewsWithModel();
         super.dispatchDraw(canvas);
     }
@@ -647,9 +668,11 @@
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         int width = MeasureSpec.getSize(widthMeasureSpec);
         int height = MeasureSpec.getSize(heightMeasureSpec);
-        Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|measure]",
-                "width: " + width + " height: " + height +
-                " awaitingFirstLayout: " + mAwaitingFirstLayout, Console.AnsiGreen);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|measure]",
+                    "width: " + width + " height: " + height +
+                            " awaitingFirstLayout: " + mAwaitingFirstLayout, Console.AnsiGreen);
+        }
 
         // Compute our stack/task rects
         RecentsConfiguration config = RecentsConfiguration.getInstance();
@@ -704,8 +727,10 @@
      */
     @Override
     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
-        Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|layout]",
-                "" + new Rect(left, top, right, bottom), Console.AnsiGreen);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.MeasureAndLayout, "[TaskStackView|layout]",
+                    "" + new Rect(left, top, right, bottom), Console.AnsiGreen);
+        }
 
         // Debug logging
         if (Constants.Log.UI.MeasureAndLayout) {
@@ -971,7 +996,9 @@
 
     @Override
     public TaskView createView(Context context) {
-        Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|createPoolView]");
+        if (Console.Enabled) {
+            Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|createPoolView]");
+        }
         return (TaskView) mInflater.inflate(R.layout.recents_task_view, this, false);
     }
 
@@ -979,8 +1006,10 @@
     public void prepareViewToEnterPool(TaskView tv) {
         Task task = tv.getTask();
         tv.resetViewProperties();
-        Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|returnToPool]",
-                tv.getTask() + " tv: " + tv);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|returnToPool]",
+                    tv.getTask() + " tv: " + tv);
+        }
 
         // Report that this tasks's data is no longer being used
         RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
@@ -995,8 +1024,10 @@
 
     @Override
     public void prepareViewToLeavePool(TaskView tv, Task prepareData, boolean isNewView) {
-        Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|leavePool]",
-                "isNewView: " + isNewView);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.ViewPool.PoolCallbacks, "[TaskStackView|leavePool]",
+                    "isNewView: " + isNewView);
+        }
 
         // Setup and attach the view to the window
         Task task = prepareData;
@@ -1018,8 +1049,10 @@
         }
 
         // Add/attach the view to the hierarchy
-        Console.log(Constants.Log.ViewPool.PoolCallbacks, "  [TaskStackView|insertIndex]",
-                "" + insertIndex);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.ViewPool.PoolCallbacks, "  [TaskStackView|insertIndex]",
+                    "" + insertIndex);
+        }
         if (isNewView) {
             addView(tv, insertIndex);
 
@@ -1045,9 +1078,11 @@
 
     @Override
     public void onTaskIconClicked(TaskView tv) {
-        Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Icon]",
-                tv.getTask() + " is currently filtered: " + mStack.hasFilteredTasks(),
-                Console.AnsiCyan);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Icon]",
+                    tv.getTask() + " is currently filtered: " + mStack.hasFilteredTasks(),
+                    Console.AnsiCyan);
+        }
         if (Constants.DebugFlags.App.EnableTaskFiltering) {
             if (mStack.hasFilteredTasks()) {
                 mStack.unfilterTasks();
@@ -1079,8 +1114,10 @@
     public void onClick(View v) {
         TaskView tv = (TaskView) v;
         Task task = tv.getTask();
-        Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Thumbnail]",
-                task + " cb: " + mCb);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.ClickEvents, "[TaskStack|Clicked|Thumbnail]",
+                    task + " cb: " + mCb);
+        }
 
         if (mCb != null) {
             mCb.onTaskLaunched(this, tv, mStack, task);
@@ -1190,9 +1227,11 @@
 
     /** Touch preprocessing for handling below */
     public boolean onInterceptTouchEvent(MotionEvent ev) {
-        Console.log(Constants.Log.UI.TouchEvents,
-                "[TaskStackViewTouchHandler|interceptTouchEvent]",
-                Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.TouchEvents,
+                    "[TaskStackViewTouchHandler|interceptTouchEvent]",
+                    Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        }
 
         // Return early if we have no children
         boolean hasChildren = (mSv.getChildCount() > 0);
@@ -1274,9 +1313,11 @@
 
     /** Handles touch events once we have intercepted them */
     public boolean onTouchEvent(MotionEvent ev) {
-        Console.log(Constants.Log.UI.TouchEvents,
-                "[TaskStackViewTouchHandler|touchEvent]",
-                Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        if (Console.Enabled) {
+            Console.log(Constants.Log.UI.TouchEvents,
+                    "[TaskStackViewTouchHandler|touchEvent]",
+                    Console.motionEventActionToString(ev.getAction()), Console.AnsiBlue);
+        }
 
         // Short circuit if we have no children
         boolean hasChildren = (mSv.getChildCount() > 0);
@@ -1377,12 +1418,14 @@
                             Math.abs((float) velocity / mMaximumVelocity)) *
                             Constants.Values.TaskStackView.TaskStackOverscrollRange);
 
-                    Console.log(Constants.Log.UI.TouchEvents,
-                            "[TaskStackViewTouchHandler|fling]",
-                            "scroll: " + mSv.getStackScroll() + " velocity: " + velocity +
-                                    " maxVelocity: " + mMaximumVelocity +
-                                    " overscrollRange: " + overscrollRange,
-                            Console.AnsiGreen);
+                    if (Console.Enabled) {
+                        Console.log(Constants.Log.UI.TouchEvents,
+                                "[TaskStackViewTouchHandler|fling]",
+                                "scroll: " + mSv.getStackScroll() + " velocity: " + velocity +
+                                        " maxVelocity: " + mMaximumVelocity +
+                                        " overscrollRange: " + overscrollRange,
+                                Console.AnsiGreen);
+                    }
 
                     // Fling scroll
                     mSv.mScroller.fling(0, mSv.getStackScroll(),
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 780f274..16a3f45 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -292,7 +292,6 @@
         float dim = (1f - getScaleX()) / scaleRange;
         dim = mDimInterpolator.getInterpolation(Math.min(dim, 1f));
         mDim = Math.max(0, Math.min(mMaxDim, (int) (dim * 255)));
-        invalidate();
     }
 
     @Override
@@ -406,4 +405,4 @@
         }
         return false;
     }
-}
\ No newline at end of file
+}