Merge "Import translations. DO NOT MERGE" into lmp-dev
diff --git a/res/drawable-hdpi/setup_illustration_tile.jpg b/res/drawable-hdpi/setup_illustration_tile.jpg
index ed6575c..9931a23 100644
--- a/res/drawable-hdpi/setup_illustration_tile.jpg
+++ b/res/drawable-hdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-mdpi/setup_illustration_tile.jpg b/res/drawable-mdpi/setup_illustration_tile.jpg
index 9dbe131..7923fb4 100644
--- a/res/drawable-mdpi/setup_illustration_tile.jpg
+++ b/res/drawable-mdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xhdpi/setup_illustration_tile.jpg b/res/drawable-xhdpi/setup_illustration_tile.jpg
index 71dabd5..57bccca 100644
--- a/res/drawable-xhdpi/setup_illustration_tile.jpg
+++ b/res/drawable-xhdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xxhdpi/setup_illustration_tile.jpg b/res/drawable-xxhdpi/setup_illustration_tile.jpg
index 46b3d02..2ba33fa 100644
--- a/res/drawable-xxhdpi/setup_illustration_tile.jpg
+++ b/res/drawable-xxhdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/drawable-xxxhdpi/illustration_tile.jpg b/res/drawable-xxxhdpi/illustration_tile.jpg
deleted file mode 100644
index ab3899e..0000000
--- a/res/drawable-xxxhdpi/illustration_tile.jpg
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/setup_illustration_tile.jpg b/res/drawable-xxxhdpi/setup_illustration_tile.jpg
new file mode 100644
index 0000000..4e67026
--- /dev/null
+++ b/res/drawable-xxxhdpi/setup_illustration_tile.jpg
Binary files differ
diff --git a/res/layout/enable_accessibility_service_dialog_content.xml b/res/layout/enable_accessibility_service_dialog_content.xml
index fbeeb27..25c6ba2 100644
--- a/res/layout/enable_accessibility_service_dialog_content.xml
+++ b/res/layout/enable_accessibility_service_dialog_content.xml
@@ -28,6 +28,12 @@
         android:paddingStart="16dip"
         android:paddingEnd="16dip" >
 
+        <TextView android:id="@+id/encryption_warning"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:padding="10dip"
+            android:textAppearance="?android:attr/textAppearanceMedium"/>
+
         <TextView android:id="@+id/capabilities_header"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
diff --git a/res/mipmap-hdpi/ic_launcher_settings.png b/res/mipmap-hdpi/ic_launcher_settings.png
index ea89c14..252e6b4 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 5c271e5..d2ecee9 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 ee67928..fa8c813 100644
--- a/res/mipmap-xhdpi/ic_launcher_settings.png
+++ b/res/mipmap-xhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/res/mipmap-xxhdpi/ic_launcher_settings.png b/res/mipmap-xxhdpi/ic_launcher_settings.png
index 50893ab..3fa69e9 100644
--- a/res/mipmap-xxhdpi/ic_launcher_settings.png
+++ b/res/mipmap-xxhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/res/mipmap-xxxhdpi/ic_launcher_settings.png b/res/mipmap-xxxhdpi/ic_launcher_settings.png
index 23bf9be..72946b7 100644
--- a/res/mipmap-xxxhdpi/ic_launcher_settings.png
+++ b/res/mipmap-xxxhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 139bacc..e38ed39 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -3665,6 +3665,14 @@
     <!-- Title for the list of capabilities of an accessibility service. -->
     <string name="capabilities_list_title"><xliff:g id="service" example="TalkBack">%1$s</xliff:g>
         needs to:</string>
+    <!-- Warning that the device data will not be encrypted with password or PIN if
+        enabling an accessibility service and there is a secure lock setup. [CHAR LIMIT=NONE] -->
+    <string name="enable_service_encryption_warning">If you turn on <xliff:g id="service"
+        example="TalkBack">%1$s</xliff:g>, your data\'s encryption won\'t be as strong.</string>
+    <!-- Warning that the device data will not be encrypted with password or PIN if
+         choosing a secure lock and there is an enabled accessibility service. [CHAR LIMIT=NONE] -->
+    <string name="secure_lock_encryption_warning">Because you\'ve turned on an accessibility service,
+        encryption based on this type of lock won\'t be as strong.</string>
 
     <!-- Title for the capability of an accessibility service to receive events and keys. -->
     <string name="capability_title_receiveAccessibilityEvents">Observe your actions</string>
@@ -4817,15 +4825,6 @@
     <string name="show_all_anrs_summary">Show App Not Responding dialog
         for background apps</string>
 
-    <!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=100] -->
-    <string name="dev_settings_use_google_settings">Please use GoogleSettings app for this operation</string>
-
-    <!-- UI debug setting: webview data reduction proxy [CHAR LIMIT=50] -->
-    <string name="webview_data_reduction_proxy">Reduce WebView Network Usage</string>
-    <!-- UI debug setting: webview data reduction proxy summary [CHAR LIMIT=200] -->
-    <string name="webview_data_reduction_proxy_summary">Reduce network usage by
-        proxying WebView connections through Google compression servers</string>
-
     <!-- Activity title for network data usage summary. [CHAR LIMIT=25] -->
     <string name="data_usage_summary_title">Data usage</string>
     <!-- Activity title for Appk data usage summary. [CHAR LIMIT=25] -->
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 807ae8b..128aa5f 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -311,10 +311,6 @@
             android:title="@string/show_all_anrs"
             android:summary="@string/show_all_anrs_summary"/>
 
-        <CheckBoxPreference
-            android:key="webview_data_reduction_proxy"
-            android:title="@string/webview_data_reduction_proxy"
-            android:summary="@string/webview_data_reduction_proxy_summary"/>
      </PreferenceCategory>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/ChooseLockGeneric.java b/src/com/android/settings/ChooseLockGeneric.java
index c444dc4..c65aa21 100644
--- a/src/com/android/settings/ChooseLockGeneric.java
+++ b/src/com/android/settings/ChooseLockGeneric.java
@@ -16,6 +16,7 @@
 
 package com.android.settings;
 
+import android.accessibilityservice.AccessibilityServiceInfo;
 import android.app.Activity;
 import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
@@ -32,6 +33,7 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityManager;
 import android.widget.ListView;
 
 import com.android.internal.widget.LockPatternUtils;
@@ -213,6 +215,7 @@
                 }
                 addPreferencesFromResource(R.xml.security_settings_picker);
                 disableUnusablePreferences(quality, allowBiometric);
+                updatePreferenceSummaryIfNeeded();
             } else {
                 updateUnlockMethodAndFinish(quality, false);
             }
@@ -292,6 +295,28 @@
             }
         }
 
+        private void updatePreferenceSummaryIfNeeded() {
+            if (AccessibilityManager.getInstance(getActivity()).getEnabledAccessibilityServiceList(
+                    AccessibilityServiceInfo.FEEDBACK_ALL_MASK).isEmpty()) {
+                return;
+            }
+
+            CharSequence summary = getString(R.string.secure_lock_encryption_warning);
+
+            PreferenceScreen screen = getPreferenceScreen();
+            final int preferenceCount = screen.getPreferenceCount();
+            for (int i = 0; i < preferenceCount; i++) {
+                Preference preference = screen.getPreference(i);
+                switch (preference.getKey()) {
+                    case KEY_UNLOCK_SET_PATTERN:
+                    case KEY_UNLOCK_SET_PIN:
+                    case KEY_UNLOCK_SET_PASSWORD: {
+                        preference.setSummary(summary);
+                    } break;
+                }
+            }
+        }
+
         /**
          * Check whether the key is allowed for fallback (e.g. bio sensor). Returns true if it's
          * supported as a backup.
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index 8bc4b64..f5704c1 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -31,9 +31,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ResolveInfo;
-import android.database.Cursor;
 import android.hardware.usb.IUsbManager;
-import android.net.Uri;
 import android.net.wifi.WifiManager;
 import android.os.AsyncTask;
 import android.os.BatteryManager;
@@ -61,7 +59,6 @@
 import android.view.IWindowManager;
 import android.view.View;
 import android.view.accessibility.AccessibilityManager;
-import android.webkit.WebView;
 import android.widget.Switch;
 import android.widget.TextView;
 
@@ -154,11 +151,6 @@
 
     private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
 
-    private static final String WEBVIEW_DATA_REDUCTION_PROXY_KEY = "webview_data_reduction_proxy";
-    // GoogleSetting name for the data reduction proxy setting.
-    // Setting type: int ( 0 = disallow, 1 = allow )
-    private static final String WEBVIEW_DATA_REDUCTION_PROXY = "use_webview_data_reduction_proxy";
-
     private static final String PROCESS_STATS = "proc_stats";
 
     private static final String TAG_CONFIRM_ENFORCE = "confirm_enforce";
@@ -171,11 +163,6 @@
 
     private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
 
-    // The setting Uri. Used when querying GoogleSettings.
-    private static final Uri GOOGLE_SETTINGS_CONTENT_URI = Uri.parse("content://com.google.settings/partner");
-    private static final String GOOGLE_SETTINGS_COMPONENT = "com.google.android.gms";
-    private static final String GOOGLE_SETTINGS_ACTIVITY = ".app.settings.GoogleSettingsActivity";
-
     private static String DEFAULT_LOG_RING_BUFFER_SIZE_IN_BYTES = "262144"; // 256K
 
     private IWindowManager mWindowManager;
@@ -242,8 +229,6 @@
 
     private CheckBoxPreference mShowAllANRs;
 
-    private CheckBoxPreference mWebViewDataReductionProxy;
-
     private PreferenceScreen mProcessStats;
     private final ArrayList<Preference> mAllPrefs = new ArrayList<Preference>();
 
@@ -380,15 +365,6 @@
 
         mProcessStats = (PreferenceScreen) findPreference(PROCESS_STATS);
         mAllPrefs.add(mProcessStats);
-
-        mWebViewDataReductionProxy = findAndInitCheckboxPref(WEBVIEW_DATA_REDUCTION_PROXY_KEY);
-        mWebViewDataReductionProxy.setOnPreferenceChangeListener(
-                new Preference.OnPreferenceChangeListener() {
-                    @Override
-                    public boolean onPreferenceChange(Preference preference, Object newValue) {
-                        return handleDataReductionProxyPreferenceChange();
-                    }
-                });
     }
 
     private ListPreference addListPreference(String prefKey) {
@@ -557,7 +533,6 @@
         updateImmediatelyDestroyActivitiesOptions();
         updateAppProcessLimitOptions();
         updateShowAllANRsOptions();
-        updateWebViewDataReductionProxyOptions();
         updateVerifyAppsOverUsbOptions();
         updateBugreportOptions();
         updateForceRtlOptions();
@@ -1302,73 +1277,6 @@
             getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
     }
 
-    // Reads the googlesetting and converts to an int. Throws an exception if GoogleSettings
-    // provider does not exist or if the setting name cannot be found.
-    private int getGoogleSettingValue(String name) throws Exception {
-        String value = null;
-        Cursor c = null;
-        try {
-            ContentResolver resolver = getActivity().getContentResolver();
-            c = resolver.query(GOOGLE_SETTINGS_CONTENT_URI, new String[] { "value" },
-                    "name=?", new String[]{ name }, null);
-            if (c != null && c.moveToNext()) value = c.getString(0);
-        } finally {
-            if (c != null) c.close();
-        }
-        // Throw an exception if value is null. This will indicate that setting is not found.
-        return Integer.parseInt(value);
-    }
-
-    private boolean handleDataReductionProxyPreferenceChange() {
-        int val;
-        try {
-            val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
-        } catch (Exception e) {
-            // Accessing GoogleSettings failed. Use the developer setting.
-            return true;
-        }
-
-        Intent i = new Intent();
-        i.setClassName(GOOGLE_SETTINGS_COMPONENT,
-                GOOGLE_SETTINGS_COMPONENT + GOOGLE_SETTINGS_ACTIVITY);
-        try {
-            startActivity(i);
-        } catch (android.content.ActivityNotFoundException ex) {
-            // We found the GoogleSetting but for some reason activity not found.
-            // Do our best and put an alert dialog
-            new AlertDialog.Builder(getActivity()).setMessage(
-                    getActivity().getResources().getString(
-                        R.string.dev_settings_use_google_settings))
-                        .setPositiveButton(android.R.string.ok, this)
-                        .show();
-        }
-        // Use GoogleSettings to set.
-        return false;
-    }
-
-    private void writeWebViewDataReductionProxyOptions() {
-        Settings.Secure.putInt(getActivity().getContentResolver(),
-                Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY,
-                mWebViewDataReductionProxy.isChecked() ? 1 : 0);
-        Intent intent = new Intent(WebView.DATA_REDUCTION_PROXY_SETTING_CHANGED);
-        // Broadcast to all apps running as current user.
-        getActivity().sendBroadcastAsUser(intent, UserHandle.CURRENT);
-    }
-
-    private void updateWebViewDataReductionProxyOptions() {
-        int val = -1;
-        try {
-              val = getGoogleSettingValue(WEBVIEW_DATA_REDUCTION_PROXY);
-        } catch (Exception e) {
-            // Accessing GoogleSettings failed. Use the developer setting
-        }
-        if (val == -1) {
-            val = Settings.Secure.getInt(getActivity().getContentResolver(),
-                    Settings.Secure.WEBVIEW_DATA_REDUCTION_PROXY, 0);
-        }
-        updateCheckBox(mWebViewDataReductionProxy, val != 0);
-    }
-
     @Override
     public void onSwitchChanged(Switch switchView, boolean isChecked) {
         if (switchView != mSwitchBar.getSwitch()) {
@@ -1488,8 +1396,6 @@
             writeImmediatelyDestroyActivitiesOptions();
         } else if (preference == mShowAllANRs) {
             writeShowAllANRsOptions();
-        } else if (preference == mWebViewDataReductionProxy) {
-            writeWebViewDataReductionProxyOptions();
         } else if (preference == mForceHardwareUi) {
             writeHardwareUiOptions();
         } else if (preference == mForceMsaa) {
diff --git a/src/com/android/settings/TetherSettings.java b/src/com/android/settings/TetherSettings.java
index 45d8dee..c611772 100644
--- a/src/com/android/settings/TetherSettings.java
+++ b/src/com/android/settings/TetherSettings.java
@@ -30,6 +30,7 @@
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.content.res.AssetManager;
 import android.hardware.usb.UsbManager;
 import android.net.ConnectivityManager;
@@ -471,16 +472,37 @@
         return false;
     }
 
-    boolean isProvisioningNeeded() {
-        if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)) {
+    public static boolean isProvisioningNeededButUnavailable(Context context) {
+        String[] provisionApp = context.getResources().getStringArray(
+                com.android.internal.R.array.config_mobile_hotspot_provision_app);
+        return (isProvisioningNeeded(provisionApp)
+                && !isIntentAvailable(context, provisionApp));
+    }
+
+    private static boolean isIntentAvailable(Context context, String[] provisionApp) {
+        if (provisionApp.length <  2) {
+            throw new IllegalArgumentException("provisionApp length should at least be 2");
+        }
+        final PackageManager packageManager = context.getPackageManager();
+        Intent intent = new Intent(Intent.ACTION_MAIN);
+        intent.setClassName(provisionApp[0], provisionApp[1]);
+
+        return (packageManager.queryIntentActivities(intent,
+                PackageManager.MATCH_DEFAULT_ONLY).size() > 0);
+    }
+
+
+    private static boolean isProvisioningNeeded(String[] provisionApp) {
+        if (SystemProperties.getBoolean("net.tethering.noprovisioning", false)
+                || provisionApp == null) {
             return false;
         }
-        return mProvisionApp.length == 2;
+        return (provisionApp.length == 2);
     }
 
     private void startProvisioningIfNecessary(int choice) {
         mTetherChoice = choice;
-        if (isProvisioningNeeded()) {
+        if (isProvisioningNeeded(mProvisionApp)) {
             Intent intent = new Intent(Intent.ACTION_MAIN);
             intent.setClassName(mProvisionApp[0], mProvisionApp[1]);
             intent.putExtra(TETHER_CHOICE, mTetherChoice);
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java
index 4efbe02..5ec513f 100644
--- a/src/com/android/settings/TrustedCredentialsSettings.java
+++ b/src/com/android/settings/TrustedCredentialsSettings.java
@@ -316,7 +316,11 @@
             final TextView title = (TextView) convertView.findViewById(android.R.id.title);
             final UserHandle profile = getGroup(groupPosition);
             final UserInfo userInfo = mUserManager.getUserInfo(profile.getIdentifier());
-            title.setText(userInfo.name);
+            if (userInfo.isManagedProfile()) {
+                title.setText(R.string.category_work);
+            } else {
+                title.setText(R.string.category_personal);
+            }
             title.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);
 
             return convertView;
diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java
index ab7e28b..9cb3d72 100644
--- a/src/com/android/settings/WirelessSettings.java
+++ b/src/com/android/settings/WirelessSettings.java
@@ -367,6 +367,10 @@
         } else {
             Preference p = findPreference(KEY_TETHER_SETTINGS);
             p.setTitle(Utils.getTetheringLabel(cm));
+
+            // Grey out if provisioning is not available.
+            p.setEnabled(!TetherSettings
+                    .isProvisioningNeededButUnavailable(getActivity()));
         }
 
         // Enable link to CMAS app settings depending on the value in config.xml.
diff --git a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
index f4b85f3..2375061 100644
--- a/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleAccessibilityServicePreferenceFragment.java
@@ -36,6 +36,7 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import com.android.internal.widget.LockPatternUtils;
 import com.android.settings.R;
 import com.android.settings.widget.ToggleSwitch;
 import com.android.settings.widget.ToggleSwitch.OnBeforeCheckedChangeListener;
@@ -201,6 +202,17 @@
         View content = inflater.inflate(R.layout.enable_accessibility_service_dialog_content,
                 null);
 
+        TextView encryptionWarningView = (TextView) content.findViewById(
+                R.id.encryption_warning);
+        if (LockPatternUtils.isDeviceEncrypted()) {
+            String text = getString(R.string.enable_service_encryption_warning,
+                    info.getResolveInfo().loadLabel(getPackageManager()));
+            encryptionWarningView.setText(text);
+            encryptionWarningView.setVisibility(View.VISIBLE);
+        } else {
+            encryptionWarningView.setVisibility(View.GONE);
+        }
+
         TextView capabilitiesHeaderView = (TextView) content.findViewById(
                 R.id.capabilities_header);
         capabilitiesHeaderView.setText(getString(R.string.capabilities_list_title,