Merge "Embed the app restrictions fragment in the dual-pane settings." into jb-mr2-dev
diff --git a/Android.mk b/Android.mk
index 22c7143..c8b81dc 100644
--- a/Android.mk
+++ b/Android.mk
@@ -13,6 +13,8 @@
 
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
 
+LOCAL_AAPT_FLAGS += -c zz_ZZ
+
 include $(BUILD_PACKAGE)
 
 # Use the folloing include to make our test apk.
diff --git a/src/com/android/settings/LocalePicker.java b/src/com/android/settings/LocalePicker.java
index 8ea99a1..6600703 100644
--- a/src/com/android/settings/LocalePicker.java
+++ b/src/com/android/settings/LocalePicker.java
@@ -23,8 +23,10 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ListView;
+import android.content.Context;
 
 import com.android.settings.SettingsPreferenceFragment.SettingsDialogFragment;
+import com.android.settings.DevelopmentSettings;
 
 import java.util.Locale;
 
@@ -46,6 +48,15 @@
     }
 
     @Override
+    protected boolean isInDeveloperMode() {
+        final boolean showDev = getActivity().getSharedPreferences(DevelopmentSettings.PREF_FILE,
+                Context.MODE_PRIVATE).getBoolean(
+                DevelopmentSettings.PREF_SHOW,
+                android.os.Build.TYPE.equals("eng"));
+        return showDev;
+    }
+
+    @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         if (savedInstanceState != null && savedInstanceState.containsKey(SAVE_TARGET_LOCALE)) {
diff --git a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
index c2ff0d9..2a5adb1 100644
--- a/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
+++ b/src/com/android/settings/inputmethod/InputMethodAndLanguageSettings.java
@@ -238,7 +238,16 @@
                 // and want to pretend that the language is valid for all locales.
                 // We need a way to support languages that aren't tied to a particular
                 // locale instead of hiding the locale qualifier.
-                if (hasOnlyOneLanguageInstance(language,
+                if (language.equals("zz")) {
+                    String country = conf.locale.getCountry();
+                    if (country.equals("ZZ")) {
+                        localeString = "[Developer] Accented English (zz_ZZ)";
+                    } else if (country.equals("ZY")) {
+                        localeString = "[Developer] Fake Bi-Directional (zz_ZY)";
+                    } else {
+                        localeString = "";
+                    }
+                } else if (hasOnlyOneLanguageInstance(language,
                         Resources.getSystem().getAssets().getLocales())) {
                     localeString = conf.locale.getDisplayLanguage(conf.locale);
                 } else {
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index 5b40656..5e2868e 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -384,6 +384,7 @@
             for (SelectableAppInfo app : visibleApps) {
                 String packageName = app.packageName;
                 if (packageName == null) continue;
+                final boolean isSettingsApp = packageName.equals(getActivity().getPackageName());
                 AppRestrictionsPreference p = new AppRestrictionsPreference(context, this);
                 final boolean hasSettings = resolveInfoListHasPackage(receivers, packageName);
                 p.setIcon(app.icon);
@@ -393,8 +394,7 @@
                             app.masterEntry.activityName));
                 }
                 p.setKey(PKG_PREFIX + packageName);
-                p.setSettingsEnabled(hasSettings
-                        || packageName.equals(getActivity().getPackageName()));
+                p.setSettingsEnabled(hasSettings || isSettingsApp);
                 p.setPersistent(false);
                 p.setOnPreferenceChangeListener(this);
                 p.setOnPreferenceClickListener(this);
@@ -411,7 +411,7 @@
                     p.setChecked(true);
                     p.setImmutable(true);
                     // If the app is required and has no restrictions, skip showing it
-                    if (!hasSettings) continue;
+                    if (!hasSettings && !isSettingsApp) continue;
                 } else if (!mNewUser && appInfoListHasPackage(userApps, packageName)) {
                     p.setChecked(true);
                 }
@@ -420,7 +420,7 @@
                     p.setChecked(mSelectedPackages.get(packageName));
                 }
                 mAppList.addPreference(p);
-                if (packageName.equals(getActivity().getPackageName())) {
+                if (isSettingsApp) {
                     p.setOrder(MAX_APP_RESTRICTIONS * 1);
                 } else {
                     p.setOrder(MAX_APP_RESTRICTIONS * (i + 2));
diff --git a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
index 138a9d3..63ef549 100644
--- a/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
+++ b/src/com/android/settings/wifi/p2p/WifiP2pSettings.java
@@ -45,6 +45,7 @@
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceGroup;
 import android.preference.PreferenceScreen;
+import android.text.InputFilter;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Gravity;
@@ -430,6 +431,7 @@
             return dialog;
         } else if (id == DIALOG_RENAME) {
             mDeviceNameText = new EditText(getActivity());
+            mDeviceNameText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(30)});
             if (mSavedDeviceName != null) {
                 mDeviceNameText.setText(mSavedDeviceName);
                 mDeviceNameText.setSelection(mSavedDeviceName.length());