diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index f6cefba7b77cc..9d7995205e042 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -1268,6 +1268,14 @@
application is desired. -->
com.android.mms
+
+
+
true
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5c42d04c78c0d..8bf1aac836b21 100755
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -903,6 +903,7 @@
+
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java
index 1fd68b8c8d38e..52bf560f6cc70 100644
--- a/services/core/java/com/android/server/pm/PackageManagerService.java
+++ b/services/core/java/com/android/server/pm/PackageManagerService.java
@@ -2191,7 +2191,8 @@ public class PackageManagerService extends IPackageManager.Stub {
// If this is the first boot, and it is a normal boot, then
// we need to initialize the default preferred apps.
if (!mRestoredSettings && !onlyCore) {
- mSettings.readDefaultPreferredAppsLPw(this, 0);
+ mSettings.applyDefaultPreferredAppsLPw(this, UserHandle.USER_OWNER);
+ applyFactoryDefaultBrowserLPw(UserHandle.USER_OWNER);
}
// If this is first boot after an OTA, and a normal boot, then
@@ -2375,13 +2376,72 @@ public class PackageManagerService extends IPackageManager.Stub {
if (DEBUG_DOMAIN_VERIFICATION) Slog.d(TAG, "End priming domain verifications");
}
+ private void applyFactoryDefaultBrowserLPw(int userId) {
+ // The default browser app's package name is stored in a string resource,
+ // with a product-specific overlay used for vendor customization.
+ String browserPkg = mContext.getResources().getString(
+ com.android.internal.R.string.default_browser);
+ if (browserPkg != null) {
+ // non-empty string => required to be a known package
+ PackageSetting ps = mSettings.mPackages.get(browserPkg);
+ if (ps == null) {
+ Slog.e(TAG, "Product default browser app does not exist: " + browserPkg);
+ browserPkg = null;
+ } else {
+ mSettings.setDefaultBrowserPackageNameLPw(browserPkg, userId);
+ }
+ }
+
+ // Nothing valid explicitly set? Make the factory-installed browser the explicit
+ // default. If there's more than one, just leave everything alone.
+ if (browserPkg == null) {
+ calculateDefaultBrowserLPw(userId);
+ }
+ }
+
+ private void calculateDefaultBrowserLPw(int userId) {
+ List allBrowsers = resolveAllBrowserApps(userId);
+ final String browserPkg = (allBrowsers.size() == 1) ? allBrowsers.get(0) : null;
+ mSettings.setDefaultBrowserPackageNameLPw(browserPkg, userId);
+ }
+
+ private List resolveAllBrowserApps(int userId) {
+ // Match all generic http: 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
+ List list = queryIntentActivities(intent, null, 0, userId);
+
+ final int count = list.size();
+ List result = new ArrayList(count);
+ for (int i=0; i 1
+ }
+ }
}
}
@@ -4464,7 +4524,7 @@ public class PackageManagerService extends IPackageManager.Stub {
synchronized (mPackages) {
final int count = candidates.size();
- // First, try to use the domain prefered App. Partition the candidates into four lists:
+ // First, try to use the domain preferred app. Partition the candidates into four lists:
// one for the final results, one for the "do not use ever", one for "undefined status"
// and finally one for "Browser App type".
for (int n=0; n