Merge "Import translations. DO NOT MERGE" into jb-mr1-dev
diff --git a/res/xml/security_settings_biometric_weak.xml b/res/xml/security_settings_biometric_weak.xml
index 590eb95..c95596b 100644
--- a/res/xml/security_settings_biometric_weak.xml
+++ b/res/xml/security_settings_biometric_weak.xml
@@ -27,18 +27,6 @@
             android:persistent="false"/>
 
         <PreferenceScreen
-           android:key="choose_lockscreen_status_widget"
-           android:title="@string/choose_lockscreen_status_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
-        <PreferenceScreen
-           android:key="choose_user_selected_lockscreen_widget"
-           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
-        <PreferenceScreen
             android:key="biometric_weak_improve_matching"
             android:title="@string/biometric_weak_improve_matching_title"/>
 
@@ -68,6 +56,18 @@
             android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
 
         <PreferenceScreen
+           android:key="choose_lockscreen_status_widget"
+           android:title="@string/choose_lockscreen_status_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
+           android:key="choose_user_selected_lockscreen_widget"
+           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
             android:fragment="com.android.settings.OwnerInfoSettings"
             android:key="owner_info_settings"
             android:title="@string/owner_info_settings_title"
diff --git a/res/xml/security_settings_password.xml b/res/xml/security_settings_password.xml
index 5f8425c..a9973fd 100644
--- a/res/xml/security_settings_password.xml
+++ b/res/xml/security_settings_password.xml
@@ -26,18 +26,6 @@
             android:summary="@string/unlock_set_unlock_mode_password"
             android:persistent="false"/>
 
-        <PreferenceScreen
-           android:key="choose_lockscreen_status_widget"
-           android:title="@string/choose_lockscreen_status_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
-        <PreferenceScreen
-           android:key="choose_user_selected_lockscreen_widget"
-           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
         <ListPreference
             android:key="lock_after_timeout"
             android:title="@string/lock_after_timeout"
@@ -51,6 +39,18 @@
             android:title="@string/lockpattern_settings_enable_power_button_instantly_locks"/>
 
         <PreferenceScreen
+           android:key="choose_lockscreen_status_widget"
+           android:title="@string/choose_lockscreen_status_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
+           android:key="choose_user_selected_lockscreen_widget"
+           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
             android:fragment="com.android.settings.OwnerInfoSettings"
             android:key="owner_info_settings"
             android:title="@string/owner_info_settings_title"
diff --git a/res/xml/security_settings_pattern.xml b/res/xml/security_settings_pattern.xml
index f8f2ee7..47fa1cc 100644
--- a/res/xml/security_settings_pattern.xml
+++ b/res/xml/security_settings_pattern.xml
@@ -26,18 +26,6 @@
             android:summary="@string/unlock_set_unlock_mode_pattern"
             android:persistent="false"/>
 
-        <PreferenceScreen
-           android:key="choose_lockscreen_status_widget"
-           android:title="@string/choose_lockscreen_status_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
-        <PreferenceScreen
-           android:key="choose_user_selected_lockscreen_widget"
-           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
         <CheckBoxPreference
             android:key="visiblepattern"
             android:title="@string/lockpattern_settings_enable_visible_pattern_title"/>
@@ -59,6 +47,18 @@
             android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
 
         <PreferenceScreen
+           android:key="choose_lockscreen_status_widget"
+           android:title="@string/choose_lockscreen_status_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
+           android:key="choose_user_selected_lockscreen_widget"
+           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
             android:fragment="com.android.settings.OwnerInfoSettings"
             android:key="owner_info_settings"
             android:title="@string/owner_info_settings_title"
diff --git a/res/xml/security_settings_pin.xml b/res/xml/security_settings_pin.xml
index 8f5cdc2..a019125 100644
--- a/res/xml/security_settings_pin.xml
+++ b/res/xml/security_settings_pin.xml
@@ -26,18 +26,6 @@
             android:summary="@string/unlock_set_unlock_mode_pin"
             android:persistent="false"/>
 
-        <PreferenceScreen
-           android:key="choose_lockscreen_status_widget"
-           android:title="@string/choose_lockscreen_status_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
-        <PreferenceScreen
-           android:key="choose_user_selected_lockscreen_widget"
-           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
-           android:summary=""
-           android:persistent="false"/>
-
         <ListPreference
             android:key="lock_after_timeout"
             android:title="@string/lock_after_timeout"
@@ -55,6 +43,18 @@
             android:title="@string/lockpattern_settings_enable_tactile_feedback_title"/>
 
         <PreferenceScreen
+           android:key="choose_lockscreen_status_widget"
+           android:title="@string/choose_lockscreen_status_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
+           android:key="choose_user_selected_lockscreen_widget"
+           android:title="@string/choose_user_selected_lockscreen_widget_picker_title"
+           android:summary=""
+           android:persistent="false"/>
+
+        <PreferenceScreen
             android:fragment="com.android.settings.OwnerInfoSettings"
             android:key="owner_info_settings"
             android:title="@string/owner_info_settings_title"
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java
index 4657be5..aab4ba6 100644
--- a/src/com/android/settings/ChooseLockPassword.java
+++ b/src/com/android/settings/ChooseLockPassword.java
@@ -40,6 +40,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.View.OnClickListener;
+import android.view.accessibility.AccessibilityEvent;
 import android.view.inputmethod.EditorInfo;
 import android.widget.Button;
 import android.widget.TextView;
@@ -272,8 +273,15 @@
         }
 
         protected void updateStage(Stage stage) {
+            final Stage previousStage = mUiStage;
             mUiStage = stage;
             updateUi();
+
+            // If the stage changed, announce the header for accessibility. This
+            // is a no-op when accessibility is disabled.
+            if (previousStage != stage) {
+                mHeaderText.announceForAccessibility(mHeaderText.getText());
+            }
         }
 
         /**
@@ -378,8 +386,8 @@
                 errorMsg = validatePassword(pin);
                 if (errorMsg == null) {
                     mFirstPin = pin;
-                    updateStage(Stage.NeedToConfirm);
                     mPasswordEntry.setText("");
+                    updateStage(Stage.NeedToConfirm);
                 }
             } else if (mUiStage == Stage.NeedToConfirm) {
                 if (mFirstPin.equals(pin)) {
@@ -389,11 +397,11 @@
                     mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
                     getActivity().finish();
                 } else {
-                    updateStage(Stage.ConfirmWrong);
                     CharSequence tmp = mPasswordEntry.getText();
                     if (tmp != null) {
                         Selection.setSelection((Spannable) tmp, 0, tmp.length());
                     }
+                    updateStage(Stage.ConfirmWrong);
                 }
             }
             if (errorMsg != null) {
@@ -415,6 +423,7 @@
 
         private void showError(String msg, final Stage next) {
             mHeaderText.setText(msg);
+            mHeaderText.announceForAccessibility(mHeaderText.getText());
             Message mesg = mHandler.obtainMessage(MSG_SHOW_ERROR, next);
             mHandler.removeMessages(MSG_SHOW_ERROR);
             mHandler.sendMessageDelayed(mesg, ERROR_MESSAGE_TIMEOUT);
diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java
index 180eee1..295e8ea 100644
--- a/src/com/android/settings/ChooseLockPattern.java
+++ b/src/com/android/settings/ChooseLockPattern.java
@@ -429,6 +429,7 @@
          * @param stage
          */
         protected void updateStage(Stage stage) {
+            final Stage previousStage = mUiStage;
 
             mUiStage = stage;
 
@@ -493,6 +494,12 @@
                 case ChoiceConfirmed:
                     break;
             }
+
+            // If the stage changed, announce the header for accessibility. This
+            // is a no-op when accessibility is disabled.
+            if (previousStage != stage) {
+                mHeaderText.announceForAccessibility(mHeaderText.getText());
+            }
         }
 
 
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index 1229046..96839ba 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -35,6 +35,7 @@
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityEvent;
 import android.view.inputmethod.EditorInfo;
 import android.widget.Button;
 import android.widget.TextView;
@@ -173,6 +174,7 @@
 
         private void showError(int msg) {
             mHeaderText.setText(msg);
+            mHeaderText.announceForAccessibility(mHeaderText.getText());
             mPasswordEntry.setText(null);
             mHandler.postDelayed(new Runnable() {
                 public void run() {
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 2892930..dd375cc 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -180,7 +180,6 @@
         }
 
         private void updateStage(Stage stage) {
-
             switch (stage) {
                 case NeedToUnlock:
                     if (mHeaderText != null) {
@@ -220,6 +219,10 @@
                     mLockPatternView.setEnabled(false); // appearance of being disabled
                     break;
             }
+
+            // Always announce the header for accessibility. This is a no-op
+            // when accessibility is disabled.
+            mHeaderTextView.announceForAccessibility(mHeaderTextView.getText());
         }
 
         private Runnable mClearPatternRunnable = new Runnable() {
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index c2b5cc1..9c7f848 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -750,6 +750,8 @@
 
     @Override
     public void onAccountsUpdated(Account[] accounts) {
+        // TODO: watch for package upgrades to invalidate cache; see 7206643
+        mAuthenticatorHelper.updateAuthDescriptions(this);
         mAuthenticatorHelper.onAccountsUpdated(this, accounts);
         invalidateHeaders();
     }
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index 55f18d2..7690b7e 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -110,6 +110,8 @@
     private ApplicationsState mState;
     private ApplicationsState.Session mSession;
     private ApplicationsState.AppEntry mAppEntry;
+    private boolean mInitialized;
+    private boolean mShowUninstalled;
     private PackageInfo mPackageInfo;
     private CanBeOnSdCardChecker mCanBeOnSdCardChecker;
     private View mRootView;
@@ -767,6 +769,17 @@
         setAppLabelAndIcon(mPackageInfo);
         refreshButtons();
         refreshSizeInfo();
+
+        if (!mInitialized) {
+            // First time init: are we displaying an uninstalled app?
+            mInitialized = true;
+            mShowUninstalled = (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0;
+        } else if (!mShowUninstalled) {
+            // All other times: if we did not start out with the app uninstalled,
+            // then if it becomes uninstalled we want to go away.
+            return (mAppEntry.info.flags&ApplicationInfo.FLAG_INSTALLED) == 0;
+        }
+
         return true;
     }