Small perf tweaks.
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index e7119f6..befe8b4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -313,7 +313,13 @@
                     Console.AnsiRed);
         }
         super.onStart();
-        mAppWidgetHost.startListening();
+
+        // Start listening for widget package changes if there is one bound
+        RecentsConfiguration config = RecentsConfiguration.getInstance();
+        if (config.searchBarAppWidgetId >= 0) {
+            mAppWidgetHost.startListening();
+        }
+
         mVisible = true;
     }
 
@@ -382,7 +388,12 @@
         }
         super.onStop();
 
-        mAppWidgetHost.stopListening();
+        // Stop listening for widget package changes if there was one bound
+        RecentsConfiguration config = RecentsConfiguration.getInstance();
+        if (config.searchBarAppWidgetId >= 0) {
+            mAppWidgetHost.stopListening();
+        }
+
         mVisible = false;
         mTaskLaunched = false;
     }
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index d899c7b..03f7e36 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -16,11 +16,13 @@
 
 package com.android.systemui.recents;
 
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.graphics.Rect;
+import android.provider.Settings;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 import android.view.animation.AnimationUtils;
@@ -68,6 +70,8 @@
     public boolean launchedFromAltTab;
     public boolean launchedWithThumbnailAnimation;
 
+    public boolean developerOptionsEnabled;
+
     /** Private constructor */
     private RecentsConfiguration() {}
 
@@ -140,6 +144,11 @@
         defaultBezierInterpolator = AnimationUtils.loadInterpolator(context,
                         com.android.internal.R.interpolator.fast_out_slow_in);
 
+        // Check if the developer options are enabled
+        ContentResolver cr = context.getContentResolver();
+        developerOptionsEnabled = Settings.Global.getInt(cr,
+                Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
+
         // Update the search widget id
         SharedPreferences settings = context.getSharedPreferences(context.getPackageName(), 0);
         searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);
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 60c442a..2b08b19 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -1113,6 +1113,11 @@
     }
 
     @Override
+    public void onTaskFocused(TaskView tv) {
+        // Do nothing
+    }
+
+    @Override
     public void onTaskDismissed(TaskView tv) {
         Task task = tv.getTask();
         // Remove the task from the view
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 b423a3c..8575661 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -18,15 +18,14 @@
 
 import android.animation.TimeInterpolator;
 import android.animation.ValueAnimator;
-import android.content.ContentResolver;
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Outline;
+import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.RectF;
-import android.provider.Settings;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
@@ -45,6 +44,7 @@
     interface TaskViewCallbacks {
         public void onTaskIconClicked(TaskView tv);
         public void onTaskAppInfoClicked(TaskView tv);
+        public void onTaskFocused(TaskView tv);
         public void onTaskDismissed(TaskView tv);
 
         // public void onTaskViewReboundToTask(TaskView tv, Task t);
@@ -227,7 +227,7 @@
         mBarView.setAlpha(0f);
         mBarView.animate()
                 .alpha(1f)
-                .setStartDelay(250)
+                .setStartDelay(300)
                 .setInterpolator(config.defaultBezierInterpolator)
                 .setDuration(config.taskBarEnterAnimDuration)
                 .withLayer()
@@ -345,6 +345,8 @@
     public void setFocusedTask() {
         mIsFocused = true;
         requestFocus();
+        invalidate();
+        mCb.onTaskFocused(this);
     }
 
     /**
@@ -355,6 +357,7 @@
         super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
         if (!gainFocus) {
             mIsFocused = false;
+            invalidate();
         }
     }
 
@@ -383,10 +386,8 @@
             mBarView.mApplicationIcon.setOnClickListener(this);
             mBarView.mDismissButton.setOnClickListener(this);
             if (Constants.DebugFlags.App.EnableDevAppInfoOnLongPress) {
-                ContentResolver cr = getContext().getContentResolver();
-                boolean devOptsEnabled = Settings.Global.getInt(cr,
-                        Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
-                if (devOptsEnabled) {
+                RecentsConfiguration config = RecentsConfiguration.getInstance();
+                if (config.developerOptionsEnabled) {
                     mBarView.mApplicationIcon.setOnLongClickListener(this);
                 }
             }