/** Enables all focus animations. */
 void enableFocusAnimations() {
   boolean wasFocusAnimationsEnabled = mFocusAnimationsEnabled;
   mFocusAnimationsEnabled = true;
   if (mIsFocused && !wasFocusAnimationsEnabled) {
     // Re-notify the header if we were focused and animations were not previously enabled
     mHeaderView.onTaskViewFocusChanged(true, true);
   }
 }
  /** Unsets the focused task explicitly. */
  void unsetFocusedTask() {
    mIsFocused = false;
    if (mFocusAnimationsEnabled) {
      // Un-focus the header bar
      mHeaderView.onTaskViewFocusChanged(false, true);
    }

    // Update the thumbnail alpha with the focus
    mThumbnailView.onFocusChanged(false);
    // Call the callback
    if (mCb != null) {
      mCb.onTaskViewFocusChanged(this, false);
    }
    invalidate();
  }
 /**
  * Sets the focused task explicitly. We need a separate flag because requestFocus() won't happen
  * if the view is not currently visible, or we are in touch state (where we still want to keep
  * track of focus).
  */
 public void setFocusedTask(boolean animateFocusedState) {
   mIsFocused = true;
   if (mFocusAnimationsEnabled) {
     // Focus the header bar
     mHeaderView.onTaskViewFocusChanged(true, animateFocusedState);
   }
   // Update the thumbnail alpha with the focus
   mThumbnailView.onFocusChanged(true);
   // Call the callback
   if (mCb != null) {
     mCb.onTaskViewFocusChanged(this, true);
   }
   // Workaround, we don't always want it focusable in touch mode, but we want the first task
   // to be focused after the enter-recents animation, which can be triggered from either touch
   // or keyboard
   setFocusableInTouchMode(true);
   requestFocus();
   setFocusableInTouchMode(false);
   invalidate();
 }