Merge "Import revised translations."
diff --git a/res/layout/preference_inputmethod.xml b/res/layout/preference_inputmethod.xml
index 0edc060..0e0c1ef 100644
--- a/res/layout/preference_inputmethod.xml
+++ b/res/layout/preference_inputmethod.xml
@@ -33,13 +33,11 @@
             android:id="@android:id/widget_frame"
             android:layout_width="wrap_content"
             android:layout_height="match_parent"
-            android:layout_marginLeft="10dip"
             android:gravity="center_vertical"
             android:orientation="vertical" />
         <RelativeLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="15dip"
             android:layout_marginRight="6dip"
             android:layout_marginTop="6dip"
             android:layout_marginBottom="6dip"
diff --git a/res/mipmap-hdpi/ic_launcher_settings.png b/res/mipmap-hdpi/ic_launcher_settings.png
index 4d117c1..90ab026 100644
--- a/res/mipmap-hdpi/ic_launcher_settings.png
+++ b/res/mipmap-hdpi/ic_launcher_settings.png
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_settings.png b/res/mipmap-mdpi/ic_launcher_settings.png
index 40bdcf4..6ee212c 100644
--- a/res/mipmap-mdpi/ic_launcher_settings.png
+++ b/res/mipmap-mdpi/ic_launcher_settings.png
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_settings.png b/res/mipmap-xhdpi/ic_launcher_settings.png
index 50ca0db..cfef912 100644
--- a/res/mipmap-xhdpi/ic_launcher_settings.png
+++ b/res/mipmap-xhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/src/com/android/settings/MasterClear.java b/src/com/android/settings/MasterClear.java
index 29a92b1..39b17a9 100644
--- a/src/com/android/settings/MasterClear.java
+++ b/src/com/android/settings/MasterClear.java
@@ -16,8 +16,6 @@
 
 package com.android.settings;
 
-import com.android.settings.R;
-
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.accounts.AuthenticatorDescription;
@@ -30,6 +28,7 @@
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Environment;
+import android.os.SystemProperties;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.util.Log;
@@ -107,7 +106,7 @@
      * keyguard confirmation if the user has currently enabled one.  If there
      * is no keyguard available, we simply go to the final confirmation prompt.
      */
-    private Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
+    private final Button.OnClickListener mInitiateListener = new Button.OnClickListener() {
 
         public void onClick(View v) {
             if (!runKeyguardConfirmation(KEYGUARD_REQUEST)) {
@@ -138,9 +137,12 @@
          * If the external storage is emulated, it will be erased with a factory
          * reset at any rate. There is no need to have a separate option until
          * we have a factory reset that only erases some directories and not
-         * others.
+         * others. Likewise, if it's non-removable storage, it could potentially have been
+         * encrypted, and will also need to be wiped.
          */
-        if (Environment.isExternalStorageEmulated()) {
+        boolean isExtStorageEmulated = Environment.isExternalStorageEmulated();
+        if (isExtStorageEmulated
+                || (!Environment.isExternalStorageRemovable() && isExtStorageEncrypted())) {
             mExternalStorageContainer.setVisibility(View.GONE);
 
             final View externalOption = mContentView.findViewById(R.id.erase_external_option_text);
@@ -148,6 +150,10 @@
 
             final View externalAlsoErased = mContentView.findViewById(R.id.also_erases_external);
             externalAlsoErased.setVisibility(View.VISIBLE);
+
+            // If it's not emulated, it is on a separate partition but it means we're doing
+            // a force wipe due to encryption.
+            mExternalStorage.setChecked(!isExtStorageEmulated);
         } else {
             mExternalStorageContainer.setOnClickListener(new View.OnClickListener() {
 
@@ -161,6 +167,11 @@
         loadAccountList();
     }
 
+    private boolean isExtStorageEncrypted() {
+        String state = SystemProperties.get("vold.decrypt");
+        return !"".equals(state);
+    }
+
     private void loadAccountList() {
         View accountsLabel = mContentView.findViewById(R.id.accounts_label);
         LinearLayout contents = (LinearLayout)mContentView.findViewById(R.id.accounts);
diff --git a/src/com/android/settings/deviceinfo/Memory.java b/src/com/android/settings/deviceinfo/Memory.java
index e257f86..728e558 100644
--- a/src/com/android/settings/deviceinfo/Memory.java
+++ b/src/com/android/settings/deviceinfo/Memory.java
@@ -60,7 +60,7 @@
     // one's preference is disabled
     private Preference mLastClickedMountToggle;
     private String mClickedMountPoint;
-    
+
     // Access using getMountService()
     private IMountService mMountService = null;
 
@@ -197,7 +197,7 @@
        }
        return mMountService;
     }
-    
+
     @Override
     public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
         for (int i = 0; i < mStorageVolumePreferenceCategories.length; i++) {
@@ -225,7 +225,7 @@
 
         return false;
     }
-     
+
     private final BroadcastReceiver mMediaScannerReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
@@ -267,7 +267,7 @@
             mLastClickedMountToggle.setEnabled(false);
             mLastClickedMountToggle.setTitle(mResources.getString(R.string.sd_ejecting_title));
             mLastClickedMountToggle.setSummary(mResources.getString(R.string.sd_ejecting_summary));
-            mountService.unmountVolume(mClickedMountPoint, true);
+            mountService.unmountVolume(mClickedMountPoint, true, false);
         } catch (RemoteException e) {
             // Informative dialog to user that unmount failed.
             showDialogInner(DLG_ERROR_UNMOUNT);
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index 65e9169..4454389 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -19,16 +19,18 @@
 import com.android.settings.R;
 import com.android.settings.Settings.SpellCheckersSettingsActivity;
 import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.UserDictionarySettings;
 import com.android.settings.Utils;
 import com.android.settings.VoiceInputOutputSettings;
 
 import android.app.Activity;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
+import android.database.ContentObserver;
 import android.os.Bundle;
+import android.os.Handler;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -74,6 +76,9 @@
     private InputMethodManager mImm;
     private List<InputMethodInfo> mImis;
     private boolean mIsOnlyImeSettings;
+    private Handler mHandler;
+    @SuppressWarnings("unused")
+    private SettingsObserver mSettingsObserver;
 
     @Override
     public void onCreate(Bundle icicle) {
@@ -122,6 +127,9 @@
         if (scp != null) {
             scp.setFragmentIntent(this, intent);
         }
+
+        mHandler = new Handler();
+        mSettingsObserver = new SettingsObserver(mHandler, getActivity());
     }
 
     private void updateInputMethodSelectorSummary(int value) {
@@ -269,6 +277,22 @@
                 ((InputMethodPreference)pref).updateSummary();
             }
         }
+        updateCurrentImeName();
+    }
+
+    private void updateCurrentImeName() {
+        final Context context = getActivity();
+        if (context == null || mImm == null) return;
+        final Preference curPref = getPreferenceScreen().findPreference(KEY_CURRENT_INPUT_METHOD);
+        if (curPref != null) {
+            final CharSequence curIme = InputMethodAndSubtypeUtil.getCurrentInputMethodName(
+                    context, getContentResolver(), mImm, mImis, getPackageManager());
+            if (!TextUtils.isEmpty(curIme)) {
+                synchronized(this) {
+                    curPref.setSummary(curIme);
+                }
+            }
+        }
     }
 
     private InputMethodPreference getInputMethodPreference(InputMethodInfo imi, int imiSize) {
@@ -333,4 +357,19 @@
             root.addPreference(mInputMethodPreferenceList.get(i));
         }
     }
+
+    private class SettingsObserver extends ContentObserver {
+        public SettingsObserver(Handler handler, Context context) {
+            super(handler);
+            final ContentResolver cr = context.getContentResolver();
+            cr.registerContentObserver(
+                    Settings.Secure.getUriFor(Settings.Secure.DEFAULT_INPUT_METHOD), false, this);
+            cr.registerContentObserver(Settings.Secure.getUriFor(
+                    Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE), false, this);
+        }
+
+        @Override public void onChange(boolean selfChange) {
+            updateCurrentImeName();
+        }
+    }
 }
diff --git a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
index 413b5b4..df58ec0 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndSubtypeUtil.java
@@ -19,7 +19,9 @@
 import com.android.settings.SettingsPreferenceFragment;
 
 import android.content.ContentResolver;
+import android.content.Context;
 import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
@@ -28,6 +30,7 @@
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.InputMethodSubtype;
 
 import java.util.HashMap;
@@ -148,6 +151,28 @@
         return set;
     }
 
+    public static CharSequence getCurrentInputMethodName(Context context, ContentResolver resolver,
+            InputMethodManager imm, List<InputMethodInfo> imis, PackageManager pm) {
+        if (resolver == null || imis == null) return null;
+        final String currentInputMethodId = Settings.Secure.getString(resolver,
+                Settings.Secure.DEFAULT_INPUT_METHOD);
+        if (TextUtils.isEmpty(currentInputMethodId)) return null;
+        for (InputMethodInfo imi : imis) {
+            if (currentInputMethodId.equals(imi.getId())) {
+                final InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
+                final CharSequence imiLabel = imi.loadLabel(pm);
+                final CharSequence summary = subtype != null
+                        ? TextUtils.concat(subtype.getDisplayName(context,
+                                    imi.getPackageName(), imi.getServiceInfo().applicationInfo),
+                                            (TextUtils.isEmpty(imiLabel) ?
+                                                    "" : " - " + imiLabel))
+                        : imiLabel;
+                return summary;
+            }
+        }
+        return null;
+    }
+
     public static void saveInputMethodSubtypeList(SettingsPreferenceFragment context,
             ContentResolver resolver, List<InputMethodInfo> inputMethodInfos,
             boolean hasHardKeyboard) {