diff --git a/res/values/strings.xml b/res/values/strings.xml
index 16925d0d733..0adf5be64df 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5657,6 +5657,7 @@
emergency ice app default
apps download applications system
apps permissions security
+ apps default
slide password pattern pin
@@ -6212,4 +6213,13 @@
- %d apps can open their domain URLs
+
+ Default Apps
+
+
+ Default Browser
+
+
+ No default Browser
+
diff --git a/res/xml/advanced_apps.xml b/res/xml/advanced_apps.xml
index 682ab2dddbe..0307a60889a 100644
--- a/res/xml/advanced_apps.xml
+++ b/res/xml/advanced_apps.xml
@@ -19,6 +19,12 @@
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:key="applications_settings">
+
+
+
+
+
+
+
+
+
diff --git a/src/com/android/settings/InstrumentedFragment.java b/src/com/android/settings/InstrumentedFragment.java
index 604af186830..ff6f21967bb 100644
--- a/src/com/android/settings/InstrumentedFragment.java
+++ b/src/com/android/settings/InstrumentedFragment.java
@@ -23,9 +23,11 @@ import com.android.internal.logging.MetricsLogger;
* Instrumented fragment that logs visibility state.
*/
public abstract class InstrumentedFragment extends PreferenceFragment {
- // Declare new temproary categories here, starting after this value.
+ // Declare new temporary categories here, starting after this value.
public static final int VIEW_CATEGORY_UNDECLARED = 100000;
+ public static final int VIEW_CATEGORY_DEFAULT_APPS = VIEW_CATEGORY_UNDECLARED + 1;
+
/**
* Declare the view of this category.
*
diff --git a/src/com/android/settings/applications/DefaultBrowserPreference.java b/src/com/android/settings/applications/DefaultBrowserPreference.java
new file mode 100644
index 00000000000..b9ea9c04715
--- /dev/null
+++ b/src/com/android/settings/applications/DefaultBrowserPreference.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.applications;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.os.UserHandle;
+import android.preference.ListPreference;
+import android.util.ArrayMap;
+import android.util.AttributeSet;
+
+import com.android.settings.R;
+
+import java.util.List;
+
+public class DefaultBrowserPreference extends ListPreference {
+
+ final private PackageManager mPm;
+
+ public DefaultBrowserPreference(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ mPm = context.getPackageManager();
+ loadBrowserApps();
+ }
+
+ private void loadBrowserApps() {
+ ArrayMap browsers = resolveBrowserApps();
+
+ setEntries(browsers.values().toArray(new CharSequence[browsers.size()]));
+ setEntryValues(browsers.keySet().toArray(new String[browsers.size()]));
+ }
+
+ private ArrayMap resolveBrowserApps() {
+ ArrayMap result = new ArrayMap<>();
+
+ // Create an Intent that will match ALL Browser Apps
+ Intent intent = new Intent();
+ intent.setAction(Intent.ACTION_VIEW);
+ intent.addCategory(Intent.CATEGORY_BROWSABLE);
+ intent.setData(Uri.parse("http:"));
+
+ // Resolve that intent and check that the handleAllWebDataURI boolean is set
+ PackageManager packageManager = getContext().getPackageManager();
+ List list = packageManager.queryIntentActivitiesAsUser(intent, 0,
+ UserHandle.myUserId());
+
+ final int count = list.size();
+ for (int i=0; i