Merge "Revert "To make SniffMP3() more concrete so that we can remove false-positve responses from MPEG-PS streams.""
diff --git a/api/current.txt b/api/current.txt
index f8b7bd9..cc6cce9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -2487,12 +2487,15 @@
 
   public static abstract class ActionBar.Tab {
     ctor public ActionBar.Tab();
+    method public abstract java.lang.CharSequence getContentDescription();
     method public abstract android.view.View getCustomView();
     method public abstract android.graphics.drawable.Drawable getIcon();
     method public abstract int getPosition();
     method public abstract java.lang.Object getTag();
     method public abstract java.lang.CharSequence getText();
     method public abstract void select();
+    method public abstract android.app.ActionBar.Tab setContentDescription(int);
+    method public abstract android.app.ActionBar.Tab setContentDescription(java.lang.CharSequence);
     method public abstract android.app.ActionBar.Tab setCustomView(android.view.View);
     method public abstract android.app.ActionBar.Tab setCustomView(int);
     method public abstract android.app.ActionBar.Tab setIcon(android.graphics.drawable.Drawable);
diff --git a/core/java/android/app/ActionBar.java b/core/java/android/app/ActionBar.java
index 7acaec8..46dc5ff 100644
--- a/core/java/android/app/ActionBar.java
+++ b/core/java/android/app/ActionBar.java
@@ -790,6 +790,37 @@
          * Select this tab. Only valid if the tab has been added to the action bar.
          */
         public abstract void select();
+
+        /**
+         * Set a description of this tab's content for use in accessibility support.
+         * If no content description is provided the title will be used.
+         *
+         * @param resId A resource ID referring to the description text
+         * @return The current instance for call chaining
+         * @see #setContentDescription(CharSequence)
+         * @see #getContentDescription()
+         */
+        public abstract Tab setContentDescription(int resId);
+
+        /**
+         * Set a description of this tab's content for use in accessibility support.
+         * If no content description is provided the title will be used.
+         *
+         * @param contentDesc Description of this tab's content
+         * @return The current instance for call chaining
+         * @see #setContentDescription(int)
+         * @see #getContentDescription()
+         */
+        public abstract Tab setContentDescription(CharSequence contentDesc);
+
+        /**
+         * Gets a brief description of this tab's content for use in accessibility support.
+         *
+         * @return Description of this tab's content
+         * @see #setContentDescription(CharSequence)
+         * @see #setContentDescription(int)
+         */
+        public abstract CharSequence getContentDescription();
     }
 
     /**
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index eedf5e2..2e2b3d6 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1575,13 +1575,13 @@
         boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw() ||
                 viewVisibility != View.VISIBLE;
 
-        if (!cancelDraw && !newSurface) {
-            if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
-                for (int i = 0; i < mPendingTransitions.size(); ++i) {
-                    mPendingTransitions.get(i).startChangingAnimations();
-                }
-                mPendingTransitions.clear();
+        if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
+            for (int i = 0; i < mPendingTransitions.size(); ++i) {
+                mPendingTransitions.get(i).startChangingAnimations();
             }
+            mPendingTransitions.clear();
+        }
+        if (!cancelDraw && !newSurface) {
             mFullRedrawNeeded = false;
 
             final long drawStartTime;
@@ -1619,10 +1619,6 @@
                 }
             }
         } else {
-            // If we're not drawing, then we don't need to draw the transitions, either
-            if (mPendingTransitions != null) {
-                mPendingTransitions.clear();
-            }
 
             // We were supposed to report when we are done drawing. Since we canceled the
             // draw, remember it here.
@@ -1632,7 +1628,7 @@
             if (fullRedrawNeeded) {
                 mFullRedrawNeeded = true;
             }
-            
+
             if (viewVisibility == View.VISIBLE) {
                 // Try again
                 scheduleTraversals();
diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java
index 4b08f2d..0cd14d0 100644
--- a/core/java/android/widget/StackView.java
+++ b/core/java/android/widget/StackView.java
@@ -148,14 +148,23 @@
     private int mFramePadding;
     private final Rect stackInvalidateRect = new Rect();
 
+    /**
+     * {@inheritDoc}
+     */
     public StackView(Context context) {
         this(context, null);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public StackView(Context context, AttributeSet attrs) {
         this(context, attrs, com.android.internal.R.attr.stackViewStyle);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     public StackView(Context context, AttributeSet attrs, int defStyleAttr) {
         super(context, attrs, defStyleAttr);
         TypedArray a = context.obtainStyledAttributes(attrs,
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index cfecca5..90d19fd 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -783,6 +783,7 @@
         private Object mTag;
         private Drawable mIcon;
         private CharSequence mText;
+        private CharSequence mContentDesc;
         private int mPosition = -1;
         private View mCustomView;
 
@@ -878,6 +879,25 @@
         public void select() {
             selectTab(this);
         }
+
+        @Override
+        public Tab setContentDescription(int resId) {
+            return setContentDescription(mContext.getResources().getText(resId));
+        }
+
+        @Override
+        public Tab setContentDescription(CharSequence contentDesc) {
+            mContentDesc = contentDesc;
+            if (mPosition >= 0) {
+                mTabScrollView.updateTab(mPosition);
+            }
+            return this;
+        }
+
+        @Override
+        public CharSequence getContentDescription() {
+            return mContentDesc;
+        }
     }
 
     @Override
diff --git a/core/java/com/android/internal/widget/ScrollingTabContainerView.java b/core/java/com/android/internal/widget/ScrollingTabContainerView.java
index 71f9364..5baed75 100644
--- a/core/java/com/android/internal/widget/ScrollingTabContainerView.java
+++ b/core/java/com/android/internal/widget/ScrollingTabContainerView.java
@@ -443,6 +443,8 @@
                     mTextView.setVisibility(GONE);
                     mTextView.setText(null);
                 }
+
+                setContentDescription(tab.getContentDescription());
             }
         }
 
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 62abf20..0de2de95 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -180,7 +180,7 @@
 
     private Runnable mRecreateRunnable = new Runnable() {
         public void run() {
-            updateScreen(mMode, false);
+            updateScreen(mMode, true);
         }
     };
 
@@ -400,7 +400,7 @@
             // then finish and get out
             if (mEnableFallback || mAccountIndex >= mAccounts.length) {
                 if (mUnlockScreen == null) {
-                    Log.w(TAG, "no unlock screen when trying to enable fallback");
+                    if (DEBUG) Log.w(TAG, "no unlock screen when trying to enable fallback");
                 } else if (mUnlockScreen instanceof PatternUnlockScreen) {
                     ((PatternUnlockScreen)mUnlockScreen).setEnableFallback(mEnableFallback);
                 }
@@ -459,7 +459,7 @@
     public void reset() {
         mIsVerifyUnlockOnly = false;
         mForgotPattern = false;
-        updateScreen(getInitialMode(), false);
+        post(mRecreateRunnable);
     }
 
     @Override
@@ -485,9 +485,7 @@
 
     private void recreateLockScreen() {
         if (mLockScreen != null) {
-            if (mLockScreen.getVisibility() == View.VISIBLE) {
-                ((KeyguardScreen) mLockScreen).onPause();
-            }
+            ((KeyguardScreen) mLockScreen).onPause();
             ((KeyguardScreen) mLockScreen).cleanUp();
             removeView(mLockScreen);
         }
@@ -499,9 +497,7 @@
 
     private void recreateUnlockScreen(UnlockMode unlockMode) {
         if (mUnlockScreen != null) {
-            if (mUnlockScreen.getVisibility() == View.VISIBLE) {
-                ((KeyguardScreen) mUnlockScreen).onPause();
-            }
+            ((KeyguardScreen) mUnlockScreen).onPause();
             ((KeyguardScreen) mUnlockScreen).cleanUp();
             removeView(mUnlockScreen);
         }
@@ -611,7 +607,7 @@
     private void updateScreen(Mode mode, boolean force) {
 
         if (DEBUG_CONFIGURATION) Log.v(TAG, "**** UPDATE SCREEN: mode=" + mode
-                + " last mode=" + mMode, new RuntimeException());
+                + " last mode=" + mMode + ", force = " + force, new RuntimeException());
 
         mMode = mode;