Merge "Add Indexable.SearchIndexProvider.getNonIndexableKeys(Context)"
diff --git a/res/values-ca/strings.xml b/res/values-ca/strings.xml
index aafbd04..b0d7b49 100644
--- a/res/values-ca/strings.xml
+++ b/res/values-ca/strings.xml
@@ -1024,8 +1024,8 @@
     <string name="location_neighborhood_level" msgid="5626515380188353712">"Permet que les aplicacions utilitzin el servei d\'ubicació de Google per calcular la teva ubicació més ràpidament. Es recopilaran dades d\'ubicació anònimes i s\'enviaran a Google."</string>
     <string name="location_neighborhood_level_wifi" msgid="4234820941954812210">"Ubicació determinada per Wi-Fi"</string>
     <string name="location_gps" msgid="8392461023569708478">"Satèl·lits GPS"</string>
-    <string name="location_street_level" product="tablet" msgid="1669562198260860802">"Permet que les aplicacions utilitzin el GPS de la tauleta per determinar la teva ubicació"</string>
-    <string name="location_street_level" product="default" msgid="4617445745492014203">"Permet que les aplicacions utilitzin el GPS del telèfon per determinar la teva ubicació"</string>
+    <string name="location_street_level" product="tablet" msgid="1669562198260860802">"Permet que les aplicacions utilitzin el GPS de la tauleta per determinar la teva ubicació exacta"</string>
+    <string name="location_street_level" product="default" msgid="4617445745492014203">"Permet que les aplicacions utilitzin el GPS del telèfon per determinar la teva ubicació exacta"</string>
     <string name="assisted_gps" msgid="4649317129586736885">"Utilitza GPS assistit"</string>
     <string name="assisted_gps_enabled" msgid="8751899609589792803">"Utilitza el servidor per ajudar al GPS (desmarqueu-ho per reduir l\'ús de la xarxa)"</string>
     <string name="assisted_gps_disabled" msgid="6982698333968010748">"Utilitza el servidor per ajudar al GPS (desmarqueu-ho per millorar el rendiment del GPS)"</string>
diff --git a/res/values-es/strings.xml b/res/values-es/strings.xml
index 880e7bb..92d7216 100644
--- a/res/values-es/strings.xml
+++ b/res/values-es/strings.xml
@@ -1024,8 +1024,8 @@
     <string name="location_neighborhood_level" msgid="5626515380188353712">"Permitir que las aplicaciones usen el servicio de ubicación de Google para calcular tu ubicación más rápido. Se recopilarán datos de ubicación anónimos y se enviarán a Google"</string>
     <string name="location_neighborhood_level_wifi" msgid="4234820941954812210">"Ubicación determinada por Wi-Fi"</string>
     <string name="location_gps" msgid="8392461023569708478">"Satélites GPS"</string>
-    <string name="location_street_level" product="tablet" msgid="1669562198260860802">"Permitir que las aplicaciones usen el GPS del tablet para determinar tu ubicación"</string>
-    <string name="location_street_level" product="default" msgid="4617445745492014203">"Permitir que las aplicaciones usen el GPS del teléfono para determinar tu ubicación"</string>
+    <string name="location_street_level" product="tablet" msgid="1669562198260860802">"Permitir que las aplicaciones usen el GPS del tablet para determinar tu ubicación exacta"</string>
+    <string name="location_street_level" product="default" msgid="4617445745492014203">"Permitir que las aplicaciones usen el GPS del teléfono para determinar tu ubicación exacta"</string>
     <string name="assisted_gps" msgid="4649317129586736885">"Utilizar GPS asistido"</string>
     <string name="assisted_gps_enabled" msgid="8751899609589792803">"Utilizar el servidor para asistir al GPS (desactivar para reducir el uso de la red)"</string>
     <string name="assisted_gps_disabled" msgid="6982698333968010748">"Utilizar el servidor para asistir al GPS (desactivar para mejorar el rendimiento del GPS)"</string>
diff --git a/src/com/android/settings/ChooseLockSettingsHelper.java b/src/com/android/settings/ChooseLockSettingsHelper.java
index a069712..15d1203 100644
--- a/src/com/android/settings/ChooseLockSettingsHelper.java
+++ b/src/com/android/settings/ChooseLockSettingsHelper.java
@@ -25,6 +25,7 @@
 
 public final class ChooseLockSettingsHelper {
 
+    static final String EXTRA_KEY_TYPE = "type";
     static final String EXTRA_KEY_PASSWORD = "password";
 
     private LockPatternUtils mLockPatternUtils;
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java
index 7fc48cd..a2302bb 100644
--- a/src/com/android/settings/ConfirmLockPassword.java
+++ b/src/com/android/settings/ConfirmLockPassword.java
@@ -28,6 +28,7 @@
 import android.os.CountDownTimer;
 import android.os.Handler;
 import android.os.SystemClock;
+import android.os.storage.StorageManager;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.TextWatcher;
@@ -168,6 +169,9 @@
             if (mLockPatternUtils.checkPassword(pin)) {
 
                 Intent intent = new Intent();
+                intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
+                                mIsAlpha ? StorageManager.CRYPT_TYPE_PASSWORD
+                                         : StorageManager.CRYPT_TYPE_PIN);
                 intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD, pin);
 
                 getActivity().setResult(RESULT_OK, intent);
diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java
index 81b325b..a4b9991 100644
--- a/src/com/android/settings/ConfirmLockPattern.java
+++ b/src/com/android/settings/ConfirmLockPattern.java
@@ -27,6 +27,7 @@
 import android.os.CountDownTimer;
 import android.os.SystemClock;
 import android.os.Bundle;
+import android.os.storage.StorageManager;
 import android.widget.TextView;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -266,6 +267,8 @@
                 if (mLockPatternUtils.checkPattern(pattern)) {
 
                     Intent intent = new Intent();
+                    intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
+                                    StorageManager.CRYPT_TYPE_PATTERN);
                     intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD,
                                     LockPatternUtils.patternToString(pattern));
 
diff --git a/src/com/android/settings/CryptKeeperConfirm.java b/src/com/android/settings/CryptKeeperConfirm.java
index 4822a83..71d5e96 100644
--- a/src/com/android/settings/CryptKeeperConfirm.java
+++ b/src/com/android/settings/CryptKeeperConfirm.java
@@ -72,7 +72,7 @@
                     IMountService mountService = IMountService.Stub.asInterface(service);
                     try {
                         Bundle args = getIntent().getExtras();
-                        mountService.encryptStorage(args.getString("password"));
+                        mountService.encryptStorage(args.getInt("type", -1), args.getString("password"));
                     } catch (Exception e) {
                         Log.e("CryptKeeper", "Error while encrypting...", e);
                     }
diff --git a/src/com/android/settings/CryptKeeperSettings.java b/src/com/android/settings/CryptKeeperSettings.java
index cedf530..1846580 100644
--- a/src/com/android/settings/CryptKeeperSettings.java
+++ b/src/com/android/settings/CryptKeeperSettings.java
@@ -29,6 +29,7 @@
 import android.content.res.Resources;
 import android.os.BatteryManager;
 import android.os.Bundle;
+import android.os.storage.StorageManager;
 import android.preference.Preference;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
@@ -41,10 +42,6 @@
 
     private static final int KEYGUARD_REQUEST = 55;
 
-    // This is the minimum acceptable password quality.  If the current password quality is
-    // lower than this, encryption should not be activated.
-    static final int MIN_PASSWORD_QUALITY = DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
-
     // Minimum battery charge level (in percent) to launch encryption.  If the battery charge is
     // lower than this, encryption should not be activated.
     private static final int MIN_BATTERY_LEVEL = 80;
@@ -157,24 +154,18 @@
      * @return true if confirmation launched
      */
     private boolean runKeyguardConfirmation(int request) {
-        // 1.  Confirm that we have a sufficient PIN/Password to continue
-        LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
-        int quality = lockPatternUtils.getActivePasswordQuality();
-        if (quality == DevicePolicyManager.PASSWORD_QUALITY_BIOMETRIC_WEAK
-            && lockPatternUtils.isLockPasswordEnabled()) {
-            // Use the alternate as the quality. We expect this to be
-            // PASSWORD_QUALITY_SOMETHING(pattern) or PASSWORD_QUALITY_NUMERIC(PIN).
-            quality = lockPatternUtils.getKeyguardStoredPasswordQuality();
-        }
-        if (quality < MIN_PASSWORD_QUALITY) {
-            return false;
-        }
-        // 2.  Ask the user to confirm the current PIN/Password
         Resources res = getActivity().getResources();
-        return new ChooseLockSettingsHelper(getActivity(), this)
-                .launchConfirmationActivity(request,
-                        res.getText(R.string.master_clear_gesture_prompt),
-                        res.getText(R.string.master_clear_gesture_explanation));
+        ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
+
+        if (helper.utils().getKeyguardStoredPasswordQuality()
+                == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+            showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
+            return true;
+        }
+
+        return helper.launchConfirmationActivity(request,
+                res.getText(R.string.master_clear_gesture_prompt),
+                res.getText(R.string.master_clear_gesture_explanation));
     }
 
     @Override
@@ -188,17 +179,19 @@
         // If the user entered a valid keyguard trace, present the final
         // confirmation prompt; otherwise, go back to the initial state.
         if (resultCode == Activity.RESULT_OK && data != null) {
+            int type = data.getIntExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE, -1);
             String password = data.getStringExtra(ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD);
             if (!TextUtils.isEmpty(password)) {
-                showFinalConfirmation(password);
+                showFinalConfirmation(type, password);
             }
         }
     }
 
-    private void showFinalConfirmation(String password) {
+    private void showFinalConfirmation(int type, String password) {
         Preference preference = new Preference(getActivity());
         preference.setFragment(CryptKeeperConfirm.class.getName());
         preference.setTitle(R.string.crypt_keeper_confirm_title);
+        preference.getExtras().putInt("type", type);
         preference.getExtras().putString("password", password);
         ((SettingsActivity) getActivity()).onPreferenceStartFragment(null, preference);
     }